简体   繁体   中英

Protege Equivalent to query

Please help to list all Mealcourse from the wine Ontology or happy to receive useful links like this one : Sparql query on restriction list (Equivalent To) in protégé

MealCourse and (hasFood value Pizza) and(hasDrink value Wine)

Thank you

This is a bit complicated, but if you look into the ontology everything that is defined as a :MealCourse is an owl:equivalentClass , so you need to first find all owl:equivalentClass and then if you look into the result you will see that they are made of owl:intersectionOf parts. Then you need to break this intersection and filter so that you will only get objects that have :MealCourse as part of the intersection.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://www.w3.org/TR/2003/PR-owl-guide-20031209/food#>
SELECT distinct *
    WHERE { ?subject owl:equivalentClass ?object. 
    ?object (owl:intersectionOf | owl:unionOf) ?node.
    ?node rdf:rest*/rdf:first ?eq.
    Filter ( ?eq in (:MealCourse ) )
}
orderBy ?subject

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM