- From: Jeremy J Carroll <jjc@syapse.com>
- Date: Mon, 26 Sep 2016 22:39:46 -0700
- To: public-sparql-exists@w3.org
- Cc: Bryan Thompson <bryan@blazegraph.com>
- Message-Id: <FEB55F5A-5B95-4738-AA57-A85E647B8967@syapse.com>
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 05:40:20 UTC