I want to query an ontology which contains implicit properties hold by owl:equivalentclass
objects. How can I achieve this?
The ontology holds triples like this:
<plantURI> rdf:type <http://purl.obolibrary.org/obo/FLOPO_0004148>
.
The class <http://purl.obolibrary.org/obo/FLOPO_0004148>
has the following definition:
<owl:Class rdf:about="http://purl.obolibrary.org/obo/FLOPO_0004148">
<owl:equivalentClass>
<owl:Restriction>
<owl:onProperty rdf:resource="http://purl.obolibrary.org/obo/BFO_0000051"/>
<owl:someValuesFrom>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://purl.obolibrary.org/obo/PO_0009046"/>
<owl:Restriction>
<owl:onProperty rdf:resource="http://purl.obolibrary.org/obo/RO_0000053"/>
<owl:someValuesFrom rdf:resource="http://purl.obolibrary.org/obo/PATO_0000320"/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:someValuesFrom>
</owl:Restriction>
</owl:equivalentClass>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">flower green</rdfs:label>
</owl:Class>
However, I don't want to query simply for the URI like this:
SELECT * {
?s rdf:type <http://purl.obolibrary.org/obo/FLOPO_0004148>
}
but I want to query sometimes only for one of its implicit properties, for example the property <http://purl.obolibrary.org/obo/PATO_0000320>
("green") - searching for all plants that are green in any way.
So, the best query would look like this:
SELECT * {
?s ?p <http://purl.obolibrary.org/obo/PATO_0000320>
}
Which gives me the object, because implicitly the object holds this property.
This probably involves reasoning in Virtuoso. However, after some hours I cannot come up with any solution how to do this in SPARQL.
Virtuoso provides reasoning and inference in two forms. 1. Built-in -- this is based on canned rules covering the relations semantics for owl:equivalentClass, owl:equivalentProperty, owl:inverseOf, owl:sameAs, owl:InverseFunctionalProperty, owl:SymmetricProperty, rdfs:subClassOf, rdfs:subPropertyOf (this is supported in both open source and commercial editions)
You appear right now to simply require owl:equivalentClass reasoning, so you can look at the following built-in inference and reasoning examples:
Equivalent Class Reasoning Enabled
Live Query Results Page (solution is produced based on effects of reasoning and inference)
Equivalent Class Reasoning Disabled (notice DEFINE input:inference pragma commented out)
Live Query Results Page (should be empty)
Example source code document from our Github Repository.