Re: is this query in scope for sparql-exists

Of course if any of the outer variables are mapped to blank nodes then one of
the known problems with EXISTS is applicable.  You have not indicated that
this is the case and the change in behaviour when the extra triple pattern is
added indicates that blank nodes are not involved.

peter


On 09/27/2016 09:14 AM, Jeremy J Carroll wrote:
> Thank you so much for your attention.
> I have filed a bug with the implementor.
> 
> Jeremy 
> 
> 
> 
>> On Sep 27, 2016, at 5:13 AM, Peter F. Patel-Schneider <pfpschneider@gmail.com> wrote:
>>
>> It appears that the SPARQL implementation that you are using is somehow losing
>> the binding for ?MDxReport_B.  As far as I can tell, this is a bug in the
>> implementation and not a problem with the SPARQL specification.  Therefore
>> this is not in scope for the CG.
>>
>>
>> peter
>>
>>
>> On 09/26/2016 10:39 PM, Jeremy J Carroll wrote:
>>> Questions:
>>> with my example (1) below:
>>> A) is this an example of the defect that this group is addressing
>>> B) is my workaround (3) appropriate:
>>>   In particular, I would like this to be as ‘standards
>>> conferment’/interoperable as possible, given a bug in the spec.
>>>
>>> This query is matching cancer patients to potential experimental therapies
>>> matching their genetic profile.
>>>
>>> If A is answered in the affirmative, please feel free to use this query in any
>>> documentation you are developing.
>>>
>>> thanks
>>>
>>> Jeremy
>>> Senior Principal Architect, Syapse Inc.
>>>
>>>
>>> I have had an issue with the scope of the ?MDxReport_B variable in the
>>> following double negation (for all, expressed, as NOT EXISTS NOT)
>>>
>>> (1) 
>>>
>>> SELECT *
>>> WHERE {
>>>  ?Therapy_A rdf:type foo:Therapy .
>>>  ?MDxReport_B rdf:type foo:fooMolecularResultsReport .
>>>  ?MDxReport_B foo:hasPatient ?Patient_A .
>>>
>>>  ?Patient_A rdf:type foo:Patient .
>>>  ?MDxReport_B foo:hasNegativeFinding/foo:gene $j__4 .
>>>  ?Therapy_A foo:hasGeneEligibilityCriteria/foo:hasNegativeFinding/foo:gene  $j__4
>>>  FILTER NOT EXISTS { 
>>>    ?hasGeneEligibilityCriteria_A rdf:type foo:GeneEligibilityCriteria .
>>>    ?Therapy_A foo:hasGeneEligibilityCriteria ?hasGeneEligibilityCriteria_A .
>>>    ?hasGeneEligibilityCriteria_A foo:isRequiredCriteria True .
>>>    ?hasGeneEligibilityCriteria_A foo:criteriaType 'Inclusion'
>>>    FILTER NOT EXISTS { 
>>>      ?MDxReport_B foo:hasNegativeFinding/foo:gene $j__5 .
>>>      ?hasGeneEligibilityCriteria_A foo:hasNegativeFinding/foo:gene  $j__5
>>>    }
>>>  }
>>>  }
>>>
>>>
>>> This is being executed as if it were:
>>>
>>>
>>> (2)
>>>
>>> SELECT *
>>> WHERE {
>>>  ?Therapy_A rdf:type foo:Therapy .
>>>  ?MDxReport_B rdf:type foo:fooMolecularResultsReport .
>>>  ?MDxReport_B foo:hasPatient ?Patient_A .
>>>
>>>  ?Patient_A rdf:type foo:Patient .
>>>  ?MDxReport_B foo:hasNegativeFinding/foo:gene $j__4 .
>>>  ?Therapy_A foo:hasGeneEligibilityCriteria/foo:hasNegativeFinding/foo:gene  $j__4
>>>  FILTER NOT EXISTS { 
>>>    ?hasGeneEligibilityCriteria_A rdf:type foo:GeneEligibilityCriteria .
>>>    ?Therapy_A foo:hasGeneEligibilityCriteria ?hasGeneEligibilityCriteria_A .
>>>    ?hasGeneEligibilityCriteria_A foo:isRequiredCriteria True .
>>>    ?hasGeneEligibilityCriteria_A foo:criteriaType 'Inclusion'
>>>    FILTER NOT EXISTS { 
>>>      ?A_different_MDxReport_B foo:hasNegativeFinding/foo:gene $j__5 .
>>>      ?hasGeneEligibilityCriteria_A foo:hasNegativeFinding/foo:gene  $j__5
>>>    }
>>>  }
>>>  }
>>>
>>>
>>>
>>> where the variable in the doubly-nested EXISTS is not treated as the same variable as in the outer graph pattern
>>>
>>>
>>> It seems I can fix this by simply repeating the type triple:
>>>
>>>
>>> (3)
>>>
>>>
>>> SELECT *
>>> WHERE {
>>>  ?Therapy_A rdf:type foo:Therapy .
>>>  ?MDxReport_B rdf:type foo:fooMolecularResultsReport .
>>>  ?MDxReport_B foo:hasPatient ?Patient_A .
>>>
>>>  ?Patient_A rdf:type foo:Patient .
>>>  ?MDxReport_B foo:hasNegativeFinding/foo:gene $j__4 .
>>>  ?Therapy_A foo:hasGeneEligibilityCriteria/foo:hasNegativeFinding/foo:gene  $j__4
>>>  FILTER NOT EXISTS { 
>>>
>>>    ?MDxReport_B rdf:type foo:fooMolecularResultsReport .
>>>
>>>    ?hasGeneEligibilityCriteria_A rdf:type foo:GeneEligibilityCriteria .
>>>    ?Therapy_A foo:hasGeneEligibilityCriteria ?hasGeneEligibilityCriteria_A .
>>>    ?hasGeneEligibilityCriteria_A foo:isRequiredCriteria True .
>>>    ?hasGeneEligibilityCriteria_A foo:criteriaType 'Inclusion'
>>>    FILTER NOT EXISTS { 
>>>      ?MDxReport_B foo:hasNegativeFinding/foo:gene $j__5 .
>>>      ?hasGeneEligibilityCriteria_A foo:hasNegativeFinding/foo:gene  $j__5
>>>    }
>>>  }
>>>  }
>>>
>>>
>>> and then the SPARQL implementation I am using does seem to see that all
>>> instances of ?MDxReport_B
>>> are one and the same variable.
>>>
>>>
>>>
>>>
>>>
>>>
> 

Received on Tuesday, 27 September 2016 16:38:44 UTC