简体   繁体   English

RDFS:多个域的相同属性

[英]RDFS: same property for multiple domains

I have an RDFS ontology with two completely separate classes: User and Venue . 我有一个RDFS本体,有两个完全独立的类: UserVenue I want them both to have names which are provided through a property called hasName , which for a User should look similar to: 我希望它们都具有通过名为hasName的属性提供的名称,对于User hasName ,它应该类似于:

<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. 但是,如果我想要一个Venue ,它也不会验证。

How should I approach this? 我该怎么做呢?

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. 但是 ,虽然这是有效的RDF,但它并不意味着您可能认为它意味着什么。 In RDF, multiple domains are defined to have intersection semantics. 在RDF中,多个域被定义为具有交叉语义。 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). 这意味着如果您如上所述定义多个域,则RDF推理器将推断具有属性“hasName”的任何内容都是user venue (而不是/或)。

To express that something that has a name is a user or a venue , you have several options. 要表达具有名称的内容是user venue ,您有多种选择。 One way is to find (or create) a common superclass of user and venue , and make that your domain: 一种方法是找到(或创建)一个共同的超类uservenue ,并使其成为您的域名:

 <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. 另一种方法是使用owl:unionOf这两个类作为域。 However, this approach requires the use of OWL, so a simple RDFS reasoner will not be able to fully interpret it. 但是,这种方法需要使用OWL,因此简单的RDFS推理器将无法完全解释它。

As an aside, a tip: start using Turtle syntax instead of RDF/XML. 顺便说一句,提示:开始使​​用Turtle语法而不是RDF / XML。 It's far easier to read and edit. 它更容易阅读和编辑。 For example, your original property definitions would look like this in Turtle: 例如,您的原始属性定义在Turtle中将如下所示:

 :hasName a rdf:Property ;
          rdfs:domain :user ;
          rdfs:range rdfs:Literal ;
          rdfs:comment "Comment here. Blah blah blah." .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM