How to query implicit properties of owl:equivalentclass

232 Views Asked by At

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.

1

There are 1 best solutions below

0
On

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)

  1. Custom -- this is based on custom rules crafted using SPARQL and the Rules Language, courtesy of terms from the SPIN Ontology (this is a commercial edition only feature).

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

DEFINE input:inference 'urn:owl:equivalent:class:inference:rules'

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bmo: <http://purl.org/bmo/ns#> 
PREFIX fibo: <https://spec.edmcouncil.org/fibo/ontology/FND/AgentsAndPeople/People/Person>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>


SELECT DISTINCT ?s
WHERE {
        ?s a fibo:person .

      }
LIMIT 20

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)

# DEFINE input:inference 'urn:owl:equivalent:class:inference:rules'

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bmo: <http://purl.org/bmo/ns#> 
PREFIX fibo: <https://spec.edmcouncil.org/fibo/ontology/FND/AgentsAndPeople/People/Person>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>


SELECT DISTINCT ?s
WHERE {
        ?s a fibo:person .

      }
LIMIT 20

Live Query Results Page (should be empty)

Example source code document from our Github Repository.