2

我有命名的对象属性employemployedBy因为它们彼此相反。如何将这些属性赋予实例?我的employ财产:

<owl:ObjectProperty rdf:ID="employ">
  <rdf:type rdf:resource="http://rdf.pozitron.com/organizations/" />
  <rdfs:domain rdf:resource="http://rdf.pozitron.com/organizations/"/>
  <rdfs:range rdf:resource="http://rdf.pozitron.com/people/"/>
</owl:ObjectProperty>

我的employedBy财产:

<owl:ObjectProperty rdf:ID="employedBy">
  <rdf:type rdf:resource="http://rdf.pozitron.com/people/" />
  <owl:inverseOf rdf:resource="#Employ" />
  <rdfs:domain rdf:resource="http://rdf.pozitron.com/people/"/>
  <rdfs:range rdf:resource="http://rdf.pozitron.com/organizations/"/>
</owl:ObjectProperty>

现在如何描述employemployedBy在这种情况下?假设 Pozitron 雇用 john 并且 john 受雇于 Pozitron。

<rdf:Description rdf:about="http://rdf.pozitron.com/people/john">
  <rdf:type rdf:resource="http://rdf.pozitron.com/people/"/>
  <person:personName>John</person:personName>
  <organization:organizationName>Pozitron</organization:organizationName>
</rdf:Description>
4

1 回答 1

7

使用 Turtle 之类的语法编写 RDF 比使用 RDF/XML 容易得多。您提供的数据不足以让我们使用(例如,基本 URI 未定义)。这是包含您的数据的完整 RDF/XML 文档(注意ex命名空间):

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:person="http://rdf.pozitron.com/people/"
    xmlns:organization="http://rdf.pozitron.com/organizations/"
    xml:base="http://example.org/"
    xmlns:ex="http://example.org/#">
  <owl:ObjectProperty rdf:ID="employ">
    <rdf:type rdf:resource="http://rdf.pozitron.com/organizations/" />
    <rdfs:domain rdf:resource="http://rdf.pozitron.com/organizations/"/>
    <rdfs:range rdf:resource="http://rdf.pozitron.com/people/"/>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:ID="employedBy">
    <rdf:type rdf:resource="http://rdf.pozitron.com/people/" />
    <owl:inverseOf rdf:resource="#Employ" />
    <rdfs:domain rdf:resource="http://rdf.pozitron.com/people/"/>
    <rdfs:range rdf:resource="http://rdf.pozitron.com/organizations/"/>
  </owl:ObjectProperty>
  <rdf:Description rdf:about="http://rdf.pozitron.com/people/john">
    <rdf:type rdf:resource="http://rdf.pozitron.com/people/"/>
    <person:personName>John</person:personName>
    <organization:organizationName>Pozitron</organization:organizationName>
  </rdf:Description>
</rdf:RDF>

在 Turtle 中,这是以下内容,并揭示了几个问题:

@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ex:      <http://example.org/#> .
@prefix person:  <http://rdf.pozitron.com/people/> .
@prefix organization:  <http://rdf.pozitron.com/organizations/> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

ex:employedBy
      a       person: , owl:ObjectProperty ;
      rdfs:domain person: ;
      rdfs:range organization: ;
      owl:inverseOf ex:Employ .

person:john
      a       person: ;
      organization:organizationName
              "Pozitron" ;
      person:personName "John" .

ex:employ
      a       owl:ObjectProperty , organization: ;
      rdfs:domain organization: ;
      rdfs:range person: .

这里的问题是:

  • employedBy的倒数是Employ,但没有该名称的属性,只有employ;
  • 该物业employorganization
  • 该物业employedByperson
  • john有一个organizationName
  • 没有组织Pozitron

这些在这种语法中很容易修复。我们还可以在我们这样做john employedBy Pozitron的同时添加三元组。Pozitron employ john我们最终得到:

@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ex:      <http://example.org/#> .
@prefix person:  <http://rdf.pozitron.com/people/> .
@prefix organization:  <http://rdf.pozitron.com/organizations/> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

ex:employedBy
      a       owl:ObjectProperty ;
      rdfs:domain person: ;
      rdfs:range organization: ;
      owl:inverseOf ex:employ .

organization:Pozitron
      a       organization: ;
      organization:organizationName
              "Pozitron" ;
      ex:employ person:john .

person:john
      a       person: ;
      person:personName "John" ;
      ex:employedBy organization:Pozitron .

ex:employ
      a       owl:ObjectProperty ;
      rdfs:domain organization: ;
      rdfs:range person: .

通过将其转换回来,我们也可以看到它在 RDF/XML 中的样子:

<rdf:RDF
    xmlns:ex="http://example.org/#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:person="http://rdf.pozitron.com/people/"
    xmlns:organization="http://rdf.pozitron.com/organizations/"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > 
  <rdf:Description rdf:about="http://example.org/#employedBy">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
    <rdfs:domain rdf:resource="http://rdf.pozitron.com/people/"/>
    <rdfs:range rdf:resource="http://rdf.pozitron.com/organizations/"/>
    <owl:inverseOf rdf:resource="http://example.org/#employ"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://rdf.pozitron.com/organizations/Pozitron">
    <rdf:type rdf:resource="http://rdf.pozitron.com/organizations/"/>
    <organization:organizationName>Pozitron</organization:organizationName>
    <ex:employ rdf:resource="http://rdf.pozitron.com/people/john"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://rdf.pozitron.com/people/john">
    <rdf:type rdf:resource="http://rdf.pozitron.com/people/"/>
    <person:personName>John</person:personName>
    <ex:employedBy rdf:resource="http://rdf.pozitron.com/organizations/Pozitron"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://example.org/#employ">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
    <rdfs:domain rdf:resource="http://rdf.pozitron.com/organizations/"/>
    <rdfs:range rdf:resource="http://rdf.pozitron.com/people/"/>
  </rdf:Description>
</rdf:RDF>

如果您使用的是可以处理逆属性的 OWL 推理器,那么您真的不需要同时编写john employedBy Pozitron and Pozitron employ john ; 你可以只写一个,推理者会推断出另一个。

于 2013-08-07T14:23:59.050 回答