0

How can I get the parent class of an owl:intersectionOf collection?

For example :

<owl:Class rdf:about="http://www.co-ode.org/ontologies/pizza/pizza.owl#Country">
    <owl:equivalentClass>
        <owl:Class>
            <owl:intersectionOf rdf:parseType="Collection">
                <rdf:Description rdf:about="http://www.co-ode.org/ontologies/pizza/pizza.owl#DomainConcept"/>
                <owl:Class>
                    <owl:oneOf rdf:parseType="Collection">
                        <rdf:Description rdf:about="http://www.co-ode.org/ontologies/pizza/pizza.owl#America"/>
                        <rdf:Description rdf:about="http://www.co-ode.org/ontologies/pizza/pizza.owl#England"/>
                        <rdf:Description rdf:about="http://www.co-ode.org/ontologies/pizza/pizza.owl#France"/>
                        <rdf:Description rdf:about="http://www.co-ode.org/ontologies/pizza/pizza.owl#Germany"/>
                        <rdf:Description rdf:about="http://www.co-ode.org/ontologies/pizza/pizza.owl#Italy"/>
                    </owl:oneOf>
                </owl:Class>
            </owl:intersectionOf>
        </owl:Class>
    </owl:equivalentClass>
    <rdfs:comment xml:lang="en">A class that is equivalent to the set of individuals that are described in the enumeration - ie Countries can only be either America, England, France, Germany or Italy and nothing else. Note that these individuals have been asserted to be allDifferent from each other.</rdfs:comment>
    <rdfs:label xml:lang="en">Country</rdfs:label>
    <rdfs:label xml:lang="pt">Pais</rdfs:label>
    <skos:prefLabel xml:lang="en">Country</skos:prefLabel>
</owl:Class>

I want to get as a response Country when I have the parameter Italy

j_schneider
  • 65
  • 1
  • 10
  • Possible duplicate of [Sparql query Subclass or EquivalentTo](https://stackoverflow.com/questions/21092246/sparql-query-subclass-or-equivalentto) – UninformedUser May 21 '18 at 07:41
  • Please use the search next time, a similar question was already answered here. Short answer, it's getting ugly with SPARQL to query complex OWL class expressions. And to some extent it's impossible to do it for arbitrary class expressions. The reason? Well, SPARQL is a query language for RDF, OWL constructs are usually represented by multiple RDF triples. Good luck – UninformedUser May 21 '18 at 07:43

1 Answers1

0

Finally, I found a solution to my question.

PREFIX :<http://www.co-ode.org/ontologies/pizza/pizza.owl#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl:<http://www.w3.org/2002/07/owl#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>


SELECT ?parent
FROM <http://localhost:8080/PizzaDS/data/PizzaGraph>
WHERE {
:Italy rdf:type/rdfs:subClassOf* ?parent. 
FILTER(regex(str(?parent), "Country")). 
}

With that query I get the correct answer ":Country"

j_schneider
  • 65
  • 1
  • 10