Does anyone have a checklist of things to look at when getting empty results in a SPARQL query? The work is in RDFLib. I'm looking at StackOverflow and some other things and am still coming up short. I know the query should return something because the usage view in Protege clearly shows it. And I'm not in a position to share my code. Thanks for any thoughts you have!
maybe it would be better to add line by line in SPARQL query and see what gives each addition
Does this offer any insight? https://www.stardog.com/labs/blog/joins-and-nulls-in-sparql/
Evangelos S. Phil T. thank you. This has helped. I鈥檓 now trying to figure out precisely how to query my restrictions. I've written it in a way I think I should but still empty set. So troubleshooting continues.
OK. So to make sure, is this the syntax for querying restrictions? I feel like I've exhausted my troubleshooting. The other parts of my queries are working. I'm trying to find every individual that meets this restriction. I truly welcome the feedback. Thank you. ?restriction rdf:type owl:Restriction . ?restriction owl:onProperty (name of property in my ontology) . ?restriction owl:someValuesFrom (Name of class in my ontology) .
This partial illustration is derived from The African Wildlife Ontology tutorial ontologies: requirements, design, and content
<owl:Class rdf:about="&AfricanWildlifeOntology1;lion">
<rdfs:subClassOf rdf:resource="&AfricanWildlifeOntology1;animal"/>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="&AfricanWildlifeOntology1;eats"/>
<owl:allValuesFrom rdf:resource="&AfricanWildlifeOntology1;herbivore"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="&AfricanWildlifeOntology1;eats"/>
<owl:someValuesFrom rdf:resource="&AfricanWildlifeOntology1;Impala"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:comment>Lions are animals that eat only herbivores.</rdfs:comment>
</owl:Class>
<owl:Class rdf:about="&AfricanWildlifeOntology1;Impala">
<rdfs:subClassOf rdf:resource="&AfricanWildlifeOntology1;animal"/>
<rdfs:comment>An african antelope http://en.wikipedia.org/wiki/Impala</rdfs:comment>
</owl:Class>
# Which animal eats which other animal?
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix : <http://www.meteck.org/teaching/ontologies/AfricanWildlifeOntology1.owl#>
select distinct *
where
{
?eats rdfs:subClassOf :animal, [
a owl:Restriction ;
owl:onProperty :eats;
owl:someValuesFrom ?eaten
] .
?eaten rdfs:subClassOf :animal .
filter(?eats != owl:Nothing)
}