I have an RDFS ontology with two completely separate classes: User
and Venue
. I want them both to have names which are provided through a property called hasName
, which for a User
should look similar to:
<rdf:Property rdf:ID="hasName">
<rdfs:comment>
Comment here. Blah blah blah.
</rdfs:comment>
<rdfs:domain rdf:resource="#user"/>
<rdfs:range rdf:resource="Literal"/>
</rdf:Property>
However, if I want it for a Venue
as well, it doesn't validate.
How should I approach this?
You can in principle just specify multiple domain properties:
However, while this is valid RDF, it does not mean what you might think it means. In RDF, multiple domains are defined to have intersection semantics. This means that if you define multiple domains as above, an RDF reasoner will infer that anything that has a property 'hasName' is both a
user
and avenue
(instead of either/or).To express that something that has a name is a
user
or avenue
, you have several options. One way is to find (or create) a common superclass ofuser
andvenue
, and make that your domain:An alternative is that you work with a
owl:unionOf
the two classes as your domain. However, this approach requires the use of OWL, so a simple RDFS reasoner will not be able to fully interpret it.As an aside, a tip: start using Turtle syntax instead of RDF/XML. It's far easier to read and edit. For example, your original property definitions would look like this in Turtle: