以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Semantic Web(语义Web)/描述逻辑/本体 』  (http://bbs.xml.org.cn/list.asp?boardid=2)
----  SPARQL Query查询OWL遇到的问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=65435)


--  作者:hrballen
--  发布时间:8/5/2008 4:07:00 PM

--  SPARQL Query查询OWL遇到的问题
请大家帮助一下,我姓用SPARQL Query来查询OWL本体中的Datatype属性值,不知查询语句怎么写?请指教,最好能详细些,谢谢!请推荐几篇相关的文章或帮助
--  作者:aximou
--  发布时间:8/6/2008 3:23:00 PM

--  
最详细的就是直接给你写出来!把你的本体文件贴上来吧!要不怎么详细呢??
--  作者:hrballen
--  发布时间:8/28/2008 7:23:00 PM

--  
<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns="http://www.owl-ontologies.com/unnamed.owl#"
  xml:base="http://www.owl-ontologies.com/unnamed.owl">
  <owl:Ontology rdf:about=""/>
  <owl:Class rdf:ID="Animal">
    <owl:disjointWith>
      <owl:Class rdf:ID="Plant"/>
    </owl:disjointWith>
  </owl:Class>
  <owl:Class rdf:ID="Herbivore">
    <rdfs:subClassOf rdf:resource="#Animal"/>
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:allValuesFrom>
          <owl:Class rdf:about="#Plant"/>
        </owl:allValuesFrom>
        <owl:onProperty>
          <owl:ObjectProperty rdf:ID="eat"/>
        </owl:onProperty>
      </owl:Restriction>
    </rdfs:subClassOf>
  </owl:Class>
  <owl:Class rdf:ID="小样">
    <rdfs:subClassOf rdf:resource="#Herbivore"/>
  </owl:Class>
  <owl:Class rdf:about="#Plant">
    <owl:disjointWith rdf:resource="#Animal"/>
  </owl:Class>
  <owl:Class rdf:ID="Leaf">
    <rdfs:subClassOf rdf:resource="#Plant"/>
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:allValuesFrom>
          <owl:Class rdf:ID="Branch"/>
        </owl:allValuesFrom>
        <owl:onProperty>
          <owl:TransitiveProperty rdf:ID="is_part_of"/>
        </owl:onProperty>
      </owl:Restriction>
    </rdfs:subClassOf>
  </owl:Class>
  <owl:Class rdf:ID="Giaffe">
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty>
          <owl:ObjectProperty rdf:about="#eat"/>
        </owl:onProperty>
        <owl:allValuesFrom rdf:resource="#Leaf"/>
      </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:subClassOf rdf:resource="#Herbivore"/>
  </owl:Class>
  <owl:Class rdf:about="#Branch">
    <rdfs:subClassOf rdf:resource="#Plant"/>
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty>
          <owl:TransitiveProperty 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:ID="Zoo"/>
  <owl:Class rdf:ID="Lion">
    <rdfs:subClassOf>
      <owl:Class rdf:ID="Carnivore"/>
    </rdfs:subClassOf>
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:allValuesFrom rdf:resource="#Herbivore"/>
        <owl:onProperty>
          <owl:ObjectProperty rdf:about="#eat"/>
        </owl:onProperty>
      </owl:Restriction>
    </rdfs:subClassOf>
  </owl:Class>
  <owl:Class rdf:about="#Carnivore">
    <owl:equivalentClass>
      <owl:Class>
        <owl:intersectionOf rdf:parseType="Collection">
          <owl:Restriction>
            <owl:allValuesFrom rdf:resource="#Animal"/>
            <owl:onProperty>
              <owl:ObjectProperty rdf:ID="maineat"/>
            </owl:onProperty>
          </owl:Restriction>
          <owl:Class rdf:about="#Animal"/>
        </owl:intersectionOf>
      </owl:Class>
    </owl:equivalentClass>
  </owl:Class>
  <owl:Class rdf:about="#Tree">
    <rdfs:subClassOf rdf:resource="#Plant"/>
  </owl:Class>
  <owl:ObjectProperty rdf:ID="eated">
    <owl:inverseOf>
      <owl:ObjectProperty rdf:about="#eat"/>
    </owl:inverseOf>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:ID="Belonging">
    <rdfs:range rdf:resource="#Zoo"/>
    <rdfs:domain rdf:resource="#Animal"/>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >属于</rdfs:comment>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:about="#maineat">
    <rdfs:subPropertyOf>
      <owl:ObjectProperty rdf:about="#eat"/>
    </rdfs:subPropertyOf>
    <owl:inverseOf>
      <owl:ObjectProperty rdf:ID="inverse_of_eat_14"/>
    </owl:inverseOf>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:about="#eat">
    <owl:inverseOf rdf:resource="#eated"/>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:about="#inverse_of_eat_14">
    <rdfs:subPropertyOf rdf:resource="#eated"/>
    <owl:inverseOf rdf:resource="#maineat"/>
  </owl:ObjectProperty>
  <owl:DatatypeProperty rdf:ID="Tel">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="#Zoo"/>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >电话号码</rdfs:comment>
  </owl:DatatypeProperty>
  <owl:DatatypeProperty rdf:ID="Address">
    <rdfs:domain rdf:resource="#Zoo"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >地址属性</rdfs:comment>
  </owl:DatatypeProperty>
  <owl:TransitiveProperty rdf:about="#is_part_of">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
  </owl:TransitiveProperty>
  <Lion rdf:ID="ShangLion">
    <eat>
      <Giaffe rdf:ID="Heihei">
        <eated rdf:resource="#ShangLion"/>
        <Belonging>
          <Zoo rdf:ID="Shanghai_Zoo">
            <Tel xml:lang="en">011-12345678</Tel>
            <Address xml:lang="en">Shanghai road</Address>
          </Zoo>
        </Belonging>
      </Giaffe>
    </eat>
    <Belonging rdf:resource="#Shanghai_Zoo"/>
  </Lion>
  <Lion rdf:ID="BeiLion">
    <Belonging>
      <Zoo rdf:ID="Beijing_Zoo">
        <Tel xml:lang="en">010-12345678</Tel>
        <Address xml:lang="en">Beijing Xizhimen Road</Address>
      </Zoo>
    </Belonging>
  </Lion>
  <Lion rdf:ID="TianLion">
    <Belonging>
      <Zoo rdf:ID="Tianjin_Zoo">
        <Address xml:lang="en">Tianjin road</Address>
        <Tel xml:lang="en">012-12345678</Tel>
      </Zoo>
    </Belonging>
  </Lion>
  <Branch rdf:ID="Branch_1"/>
  <Leaf rdf:ID="Leaf_2"/>
  <Tree rdf:ID="Tree_3"/>
  <Giaffe rdf:ID="Baibai">
    <Belonging rdf:resource="#Tianjin_Zoo"/>
  </Giaffe>
  <Giaffe rdf:ID="Lanlan">
    <Belonging rdf:resource="#Beijing_Zoo"/>
  </Giaffe>
</rdf:RDF>

<!-- Created with Protege (with OWL Plugin 2.1, Build 284)  http://protege.stanford.edu -->


--  作者:hrballen
--  发布时间:8/28/2008 7:29:00 PM

--  
如果我想查zoo的地址属性该怎么写?谢谢
另外,如何通过属性的值来显示他所属的类,比如通过上面的地址来得到zoo的名字

W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
62.500ms