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
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
In Protégé, this would look like:
The RDF serialization in Turtle and RDF/XML are:
Indeed the range of such a
composedBy
property should be a union.Since you have two different compositions in the UML class model, you may have to define two different OWL properties, like
houseComposedBy
andkitchenComposedBy
.As you have suggested in your comment, in principle, it's also an option to use XML namespaces for getting different names for these different
composedBy
OWL properties (like the qualified nameshouse:composedBy
andkitchen:composedBy
). In fact this corresponds to UML properties, which are always in the namespace defined by their (domain) class. So you would have to declare as many namespaces as you have classes that are the domain of acomposedBy
property.Edit: I'll try to wrap up the two answers of Joshua Taylor and myself.
allValuesFrom
restrictions on our generic hasPart property. In addition to theseallValuesFrom
restrictions, which are essential for the translation, we could also define cardinality restrictions corresponding to the multiplicity constraints defined in our UML class model (if there are any).