I have a class , Person. There is a datatype property Profession whose value for a Person are {"Composer","Singer","Conductor"}. I have another class that is called Piece, and an object property composedBy. I want the range of composedBy to be all Persons whose Profession is "Composer"? How can I do this in OWL, and how can I express that OWL using Protégé?
How to use "all xs with value v for property p" as an object property range?
89 views Asked by MrRisoni AtThere are 2 answers
Your first description isn't too hard to express as a DL axiom (although, I'll use the name hasProfession to be more consistent with the other property name, composedBy).
There is a datatype property Profession whose value for a Person are {"Composer","Singer","Conductor"}.
Person ⊑ Profession only {"Composer, "Singer", "Conductor"}
The second isn't too tricky either:
I have another class that is called Piece, and an object property composedBy. I want the range of composedBy to be all Persons whose Profession is "Composer"?
Now, you need to be clearer here. You might mean that the range of composedBy is "all Persons whose profession is ‘Composer’", i.e., that anything that is the value of a composedBy statement is a Peron whose profession is ‘Composer’. However, you mentioned another class, Piece, so I think what you're asking is how to say that if a Piece is composedBy something, then that something is a Person whose profession is ‘Composer’. That would be this axiom:
Piece ⊑ ∀composedBy.(Person ⊓ hasProfession value "Composer")
If you want to copy and paste the ontology, here it is:
<rdf:RDF
xmlns="http://stackoverflow.com/q/20920232/1281433/composers#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://stackoverflow.com/q/20920232/1281433/composers"/>
<owl:Class rdf:about="http://stackoverflow.com/q/20920232/1281433/composers#Piece">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty rdf:about="http://stackoverflow.com/q/20920232/1281433/composers#composedBy"/>
</owl:onProperty>
<owl:allValuesFrom>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<owl:Class rdf:about="http://stackoverflow.com/q/20920232/1281433/composers#Person"/>
<owl:Restriction>
<owl:onProperty>
<owl:DatatypeProperty rdf:about="http://stackoverflow.com/q/20920232/1281433/composers#hasProfession"/>
</owl:onProperty>
<owl:hasValue>Composer</owl:hasValue>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:allValuesFrom>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:about="http://stackoverflow.com/q/20920232/1281433/composers#Person">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://stackoverflow.com/q/20920232/1281433/composers#hasProfession"/>
<owl:allValuesFrom>
<rdfs:Datatype>
<owl:oneOf>
<rdf:List>
<rdf:first>Composer</rdf:first>
<rdf:rest>
<rdf:List>
<rdf:first>Conductor</rdf:first>
<rdf:rest>
<rdf:List>
<rdf:first>Singer</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:List>
</rdf:rest>
</rdf:List>
</rdf:rest>
</rdf:List>
</owl:oneOf>
</rdfs:Datatype>
</owl:allValuesFrom>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
</rdf:RDF>
Define the range for
composedBy
to bePerson and some Profession {Composer}
What the range says is that the value of composedBy will be a Person and it will have a property Profession with possible values only Composer - it is a HasValue restriction.