RDFS: same property for multiple domains

房东的猫 提交于 2020-01-01 07:03:32

问题


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?


回答1:


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." .


来源:https://stackoverflow.com/questions/23724182/rdfs-same-property-for-multiple-domains

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!