'How to use SPARQL to CONSTRUCT owl:Restriction
I am trying to create OWL restrictions on some instances in my ontology. These instances are associated to classes via rdf:type relationships when they should be some kind of owl restriction. To solve this, I created a CONSTRUCT statement:
PREFIX myontology:<http://myontology.org/myonto/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
CONSTRUCT {
?entity rdf:type ?owlRestriction .
?owlRestriction a owl:Restriction .
?owlRestriction owl:onProperty myontology:someRelation .
?owlRestriction owl:someValuesFrom ?someClass .
}
WHERE {
?owlRestriction a owl:Restriction .
?entity a ?class .
?class rdfs:subClassOf* myontology:someSuperClass .
}
When I run this, however, the restriction created includes every subclass underneath the myontology:someSuperClass. How can I change the above query such that only the classes directly related to my instances via rdf:type get changed to restrictions?
Thank you for your help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
