RDFS:多个域的相同属性 [英] RDFS: same property for multiple domains

查看:94
本文介绍了RDFS:多个域的相同属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个RDFS本体,具有两个完全独立的类:UserVenue.我希望它们都具有通过称为hasName的属性提供的名称,对于User而言,该属性应类似于:

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>

但是,如果我也想要Venue的话,它就不会生效.

However, if I want it for a Venue as well, it doesn't validate.

我应该如何处理?

推荐答案

原则上,您可以指定多个域属性:

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>

然而,尽管这是有效的RDF,但这并不意味着您可能会认为这意味着什么.在RDF中,多个域被定义为具有交集语义.这意味着,如果您如上所述定义多个域,则RDF推理程序将推断出具有"hasName"属性的任何事物都为user venue(而不是"/"或"/") .

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

要表达一个具有名称的东西是user 一个venue,您有几种选择.一种方法是找到(或创建)uservenue的公共超类,并使其成为您的域:

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>

另一种选择是,您将两个类作为owl:unionOf作为您的域.但是,此方法需要使用OWL,因此简单的RDFS推理程序将无法完全解释它.

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.

顺便提一下,提示:开始使​​用Turtle语法而不是RDF/XML.阅读和编辑要容易得多.例如,您原始的属性定义在Turtle中将如下所示:

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

这篇关于RDFS:多个域的相同属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆