Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RDFS: same property for multiple domains

Tags:

rdf

ontology

rdfs

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?

like image 568
cgf Avatar asked Nov 07 '25 04:11

cgf


1 Answers

You can in principle just specify multiple domain properties:

<rdf:Property rdf:ID="hasName"> 
    <rdfs:domain rdf:resource="#user"/> 
    <rdfs:domain rdf:sources="#venue"/> 
</rdf:Property>

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 a venue (instead of either/or).

To express that something that has a name is a user or a venue, you have several options. One way is to find (or create) a common superclass of user and venue, and make that your domain:

 <rdf:Property rdf:ID="hasName"> 
        <rdfs:comment> 
            Comment here. Blah blah blah.
        </rdfs:comment>
        <rdfs:domain rdf:sources="#ThingsWithNames"/> 
    </rdf:Property>

   <rdfs:Class rdf:about="#ThingsWithNames"/> 
   <rdfs:Class rdf:about="#user">
        <rdfs:subClassOf rdf:resource="#ThingsWithNames"/>
   </rdfs:Class> 
   <rdfs:Class rdf:about="#venue">
        <rdfs:subClassOf rdf:resource="#ThingsWithNames"/>
   </rdfs:Class>

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:

 :hasName a rdf:Property ;
          rdfs:domain :user ;
          rdfs:range rdfs:Literal ;
          rdfs:comment "Comment here. Blah blah blah." .
like image 106
Jeen Broekstra Avatar answered Nov 08 '25 16:11

Jeen Broekstra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!