I'm beginner in RDF and OWL ontologies.
I'm trying to transform this diagram into OWL syntax.
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<!-- OWL Class Definition - Robot Position -->
<owl:Class rdf:ID="house" />
<owl:Class rdf:ID="room" />
<owl:Class rdf:ID="kitchen" />
<owl:Class rdf:ID="garden" />
<owl:Class rdf:ID="table" />
<owl:Class rdf:ID="chair" />
<owl:ObjectProperty rdf:ID="composedBy">
<rdfs:domain rdf:resource="#house"/>
<rdfs:rang rdf:resource="#room" >
</owl:ObjectProperty>
</rdf:RDF>
I don't know how to do to make the composed by relation used many times. I'm thinking to make the range to take in a collection type with
(house)---composedBy---(room, kitchen, garden)
but, I want to use the same relation with
(kitchen)---comoposedBy---(table, chair)
The validator is making an error because I used composedBy as an ID twice. (I removed it now)
How can I do to translate this diagram correctly.
:))
If you're trying to say that a House must have a (or at least one) Kitchen, and must have a (or at least one) Room, and must have a (or at least one) Garden, then unionOf isn't really solving the issue here. Rather than worrying about the range of the composition property, I think it might be more helpful if you have a more generic component property, and express the different relationships that must hold by using existential restrictions. E.g., you could say that
House ⊑ =1 hasPart.Kitchen
House ⊑ ≥2 hasPart.Room
House ⊑ ∃hasPart.Garden
to say that a House has exactly one Kitchen, at least two Room, and at least one Garden. Similarly, you could say that has a table and a chair with
Kitchen ⊑ ∃hasPart.Chair
Kitchen ⊑ ∃hasPart.Table
In Protégé, this would look like:
The RDF serialization in Turtle and RDF/XML are:
@prefix : <http://www.example.org/houses#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://www.example.org/houses>
a owl:Ontology .
:hasPart a owl:ObjectProperty .
:Table a owl:Class .
:Room a owl:Class .
:Garden a owl:Class .
:Chair a owl:Class .
:House a owl:Class ;
rdfs:subClassOf [ a owl:Restriction ;
owl:minQualifiedCardinality "2"^^xsd:nonNegativeInteger ;
owl:onClass :Room ;
owl:onProperty :hasPart
] ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty :hasPart ;
owl:someValuesFrom :Garden
] ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onClass :Kitchen ;
owl:onProperty :hasPart ;
owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger
] .
:Kitchen a owl:Class ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty :hasPart ;
owl:someValuesFrom :Table
] ;
rdfs:subClassOf [ a owl:Restriction ;
owl:onProperty :hasPart ;
owl:someValuesFrom :Chair
] .
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns="http://www.example.org/houses#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://www.example.org/houses"/>
<owl:Class rdf:about="http://www.example.org/houses#Room"/>
<owl:Class rdf:about="http://www.example.org/houses#House">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty>
<owl:ObjectProperty rdf:about="http://www.example.org/houses#hasPart"/>
</owl:onProperty>
<owl:onClass rdf:resource="http://www.example.org/houses#Room"/>
<owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
>2</owl:minQualifiedCardinality>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.example.org/houses#hasPart"/>
<owl:someValuesFrom>
<owl:Class rdf:about="http://www.example.org/houses#Garden"/>
</owl:someValuesFrom>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.example.org/houses#hasPart"/>
<owl:onClass>
<owl:Class rdf:about="http://www.example.org/houses#Kitchen"/>
</owl:onClass>
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger"
>1</owl:qualifiedCardinality>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:about="http://www.example.org/houses#Chair"/>
<owl:Class rdf:about="http://www.example.org/houses#Table"/>
<owl:Class rdf:about="http://www.example.org/houses#Kitchen">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.example.org/houses#hasPart"/>
<owl:someValuesFrom rdf:resource="http://www.example.org/houses#Table"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.example.org/houses#hasPart"/>
<owl:someValuesFrom rdf:resource="http://www.example.org/houses#Chair"/>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
</rdf:RDF>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With