以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Semantic Web(语义Web)/描述逻辑/本体 』  (http://bbs.xml.org.cn/list.asp?boardid=2)
----  请教allValuesFrom取多值问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=76510)


--  作者:adwar
--  发布时间:8/26/2009 6:50:00 PM

--  请教allValuesFrom取多值问题
例如在在有wood,tree,branch这三个类,分别属于Plant类,现有is_part_of属性,现想表示branch类其中的is_part_of属性的值域可以取多个类为值得(tree,wood),不知道allvaluesfrom怎么可以接多个值的呢,下面我写了一些简单的代码,不知道正确与否,请指教~~

<owl:Class rdf:ID="Wood">
    <rdfs:subClassOf>
      <owl:Class rdf:ID="Plant"/>
    </rdfs:subClassOf>
  </owl:Class>
  <owl:Class rdf:ID="Branch">
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty>
          <owl:ObjectProperty rdf:ID="is_part_of"/>
        </owl:onProperty>
        <owl:allValuesFrom rdf:resource="#Wood"/>
      </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:subClassOf rdf:resource="#Plant"/>
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty>
          <owl:ObjectProperty rdf:about="#is_part_of"/>
        </owl:onProperty>
        <owl:allValuesFrom>
          <owl:Class rdf:ID="Tree"/>
        </owl:allValuesFrom>
      </owl:Restriction>
    </rdfs:subClassOf>
  </owl:Class>
  <owl:Class rdf:about="#Tree">
    <rdfs:subClassOf rdf:resource="#Plant"/>
  </owl:Class>


--  作者:laotao
--  发布时间:8/26/2009 8:59:00 PM

--  
UnionOf?
--  作者:cjdby
--  发布时间:8/26/2009 10:21:00 PM

--  
(A or B or ...)?
--  作者:adwar
--  发布时间:8/26/2009 11:09:00 PM

--  
不知道我以上写的语法对不对呢?
如果用UnionOf定义一个匿名类,会不会不是很符合语义呢,毕竟试想下tree和wood联合在一起好象没什么意义。
--  作者:laotao
--  发布时间:8/27/2009 4:13:00 PM

--  
<owl:ObjectProperty rdf:about="#is_part_of"/>一行可能会导致语法错误,这一行的功能好像与前面的 <owl:ObjectProperty rdf:ID="is_part_of"/>是相同的,这样在同一个xml:base的scope里面就有两个is_part_of了 (The rdf:ID attribute on a node element (not property element, that has another meaning) can be used instead of rdf:about and gives a relative RDF URI reference equivalent to # concatenated with the rdf:ID attribute value. So for example if rdf:ID="name", that would be equivalent to rdf:about="#name". rdf:ID provides an additional check since the same name can only appear once in the scope of an xml:base value (or document, if none is given), so is useful for defining a set of distinct, related terms relative to the same RDF URI reference.)

如果你是想引用 <owl:ObjectProperty rdf:ID="is_part_of"/>一句定义的property,那第二个restriction里应该用rdf:resource而不是rdf:about

但是这样并不能表达你的语义。比如branch1 is_part_of a,根据第一个restriction可以得出a一定是个Wood,而根据第二个restriction又能得出a一定是个tree。这样a就既是Wood又是Tree (IntersectionOf), 而你想表达的好像是a可能是Wood也可能是Tree. (UnionOf)

其实OWL里的Class本来就只是一些集合,把什么Union在一起都是正常的……


--  作者:adwar
--  发布时间:8/28/2009 11:15:00 AM

--  
谢谢上面的答复.
我是新手,请多多指教,我是用protege建立的,有不知道怎样验证它的正确性,所以前来发问.
我已经大体看了OWL官方的那6个文档,不知道如果想继续深入要看什么呢?
--  作者:laotao
--  发布时间:8/28/2009 3:13:00 PM

--  
看来Protege是允许重复定义Property的,可能它会自动把第一个<owl:ObjectProperty rdf:ID="is_part_of"/>作为定义,后面无论是用ID还是about定义同名的Property都会指向这个resource

esw里列举了一些在线验证工具 (http://esw.w3.org/topic/SemanticWebTools#head-c5457b113c9ff892f0dfa7fe9e8ea7a19f36de49)

其实我是外行,只在业余时间看过一些资料。这本书好像不错,Semantic Web for the working Ontologist


--  作者:adwar
--  发布时间:8/28/2009 10:12:00 PM

--  
非常感谢 laotao。
有空连请教您
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
68.359ms