以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Semantic Web(语义Web)/描述逻辑/本体 』  (http://bbs.xml.org.cn/list.asp?boardid=2)
----  [求助]读owl内的属性  (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=77849)


--  作者:jiangqiangln
--  发布时间:10/18/2009 1:48:00 PM

--  [求助]读owl内的属性
owl文件如下,请问如何才能读取到hastitile的值:
<?xml version="1.0"?>
<rdf:RDF
    xmlns:pub="http://www.domain2.com#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    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:about="http://www.domain2.com#Person"/>
  <owl:Class rdf:about="http://www.domain2.com#Publication"/>
  <owl:Class rdf:about="http://www.domain2.com#Article"/>
  <owl:ObjectProperty rdf:about="http://www.domain2.com#isCited">
    <rdfs:domain rdf:resource="http://www.domain2.com#Article"/>
    <owl:inverseOf>
      <owl:ObjectProperty rdf:about="http://www.domain2.com#Citing"/>
    </owl:inverseOf>
    <rdfs:range rdf:resource="http://www.domain2.com#Article"/>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:about="http://www.domain2.com#hasAuthor">
    <rdfs:range rdf:resource="http://www.domain2.com#Person"/>
    <rdfs:domain rdf:resource="http://www.domain2.com#Article"/>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:about="http://www.domain2.com#isPublished">
    <rdfs:range rdf:resource="http://www.domain2.com#Publication"/>
    <rdfs:domain rdf:resource="http://www.domain2.com#Article"/>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:about="http://www.domain2.com#Citing">
    <rdfs:domain rdf:resource="http://www.domain2.com#Article"/>
    <owl:inverseOf rdf:resource="http://www.domain2.com#isCited"/>
    <rdfs:range rdf:resource="http://www.domain2.com#Article"/>
  </owl:ObjectProperty>
  <owl:DatatypeProperty rdf:about="http://www.domain2.com#keywords">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="http://www.domain2.com#Article"/>
  </owl:DatatypeProperty>
  <owl:DatatypeProperty rdf:about="http://www.domain2.com#hasTitle">
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
    <rdfs:domain rdf:resource="http://www.domain2.com#Article"/>
  </owl:DatatypeProperty>
  <owl:DatatypeProperty rdf:about="http://www.domain2.com#content">
    <rdfs:domain rdf:resource="http://www.domain2.com#Article"/>
    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
  </owl:DatatypeProperty>
  <owl:SymmetricProperty rdf:about="http://www.domain2.com#bothCited">
    <owl:inverseOf rdf:resource="http://www.domain2.com#bothCited"/>
    <rdfs:range rdf:resource="http://www.domain2.com#Article"/>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
    <rdfs:domain rdf:resource="http://www.domain2.com#Article"/>
  </owl:SymmetricProperty>
  <owl:SymmetricProperty rdf:about="http://www.domain2.com#bothCiting">
    <rdfs:domain rdf:resource="http://www.domain2.com#Article"/>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
    <owl:inverseOf rdf:resource="http://www.domain2.com#bothCiting"/>
    <rdfs:range rdf:resource="http://www.domain2.com#Article"/>
  </owl:SymmetricProperty>
  <pub:Publication rdf:ID="Info.Sci."/>
  <pub:Person rdf:ID="Tom"/>
  <pub:Article rdf:ID="KB_757266_Individual_5">
    <pub:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">URI is BBBBBBBBBBBBBBBBBBBBBBBBBBB</pub:content>
    <pub:isCited>
      <pub:Article rdf:ID="KB_757266_Individual_3">
        <pub:hasTitle rdf:datatype="http://www.w3.org/2001/XMLSchema#string">RDF</pub:hasTitle>
        <pub:isPublished rdf:resource="#Info.Sci."/>
        <pub:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">RDF is JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ</pub:content>
        <pub:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string">RDF</pub:keywords>
        <pub:Citing>
          <pub:Article rdf:ID="KB_757266_Individual_2">
            <pub:hasTitle rdf:datatype="http://www.w3.org/2001/XMLSchema#string">XML</pub:hasTitle>
            <pub:isCited rdf:resource="#KB_757266_Individual_3"/>
            <pub:isPublished rdf:resource="#Info.Sci."/>
            <pub:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">XML is AAAAAAAAAAAAAAAAAAAAAAAAAAA</pub:content>
            <pub:hasAuthor>
              <pub:Person rdf:ID="Jack"/>
            </pub:hasAuthor>
            <pub:Citing rdf:resource="#KB_757266_Individual_5"/>
            <pub:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string">XML</pub:keywords>
            <pub:Citing>
              <pub:Article rdf:ID="KB_757266_Individual_6">
                <pub:isCited>
                  <pub:Article rdf:ID="KB_757266_Individual_4">
                    <pub:Citing rdf:resource="#KB_757266_Individual_3"/>
                    <pub:hasAuthor rdf:resource="#Tom"/>
                    <pub:Citing rdf:resource="#KB_757266_Individual_5"/>
                    <pub:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">OWL is GGGGGGGGGGGGGGGGGGgg</pub:content>
                    <pub:Citing rdf:resource="#KB_757266_Individual_2"/>
                    <pub:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string">OWL</pub:keywords>
                    <pub:isPublished rdf:resource="#Info.Sci."/>
                    <pub:hasTitle rdf:datatype="http://www.w3.org/2001/XMLSchema#string">OWL</pub:hasTitle>
                    <pub:Citing rdf:resource="#KB_757266_Individual_6"/>
                  </pub:Article>
                </pub:isCited>
                <pub:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Unicode</pub:keywords>
                <pub:isCited rdf:resource="#KB_757266_Individual_2"/>
                <pub:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Unicode is CCCCCCCCCCCCCCCCCCCCCcc</pub:content>
                <pub:hasTitle rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Unicode</pub:hasTitle>
                <pub:hasAuthor>
                  <pub:Person rdf:ID="peter"/>
                </pub:hasAuthor>
                <pub:isPublished rdf:resource="#Info.Sci."/>
                <pub:isCited rdf:resource="#KB_757266_Individual_3"/>
              </pub:Article>
            </pub:Citing>
            <pub:isCited rdf:resource="#KB_757266_Individual_4"/>
          </pub:Article>
        </pub:Citing>
        <pub:hasAuthor rdf:resource="#Jack"/>
        <pub:Citing rdf:resource="#KB_757266_Individual_5"/>
        <pub:Citing rdf:resource="#KB_757266_Individual_6"/>
        <pub:isCited rdf:resource="#KB_757266_Individual_4"/>
      </pub:Article>
    </pub:isCited>
    <pub:isCited rdf:resource="#KB_757266_Individual_4"/>
    <pub:hasAuthor rdf:resource="#peter"/>
    <pub:isPublished rdf:resource="#Info.Sci."/>
    <pub:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string">URI</pub:keywords>
    <pub:isCited rdf:resource="#KB_757266_Individual_2"/>
    <pub:hasTitle rdf:datatype="http://www.w3.org/2001/XMLSchema#string">URI</pub:hasTitle>
  </pub:Article>
</rdf:RDF>

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


--  作者:jiangqiangln
--  发布时间:10/18/2009 3:31:00 PM

--  
select ?book ?hasName
from  <http://vision.pku.edu.cn/test.owl>
where
{
?book test:hasName ?hasName.
}
结果是:
http://vision.pku.edu.cn/test.owl#B008 数据库@zh 

http://vision.pku.edu.cn/test.owl#A004 李四@zh 

http://vision.pku.edu.cn/test.owl#A002 王二@zh 

http://vision.pku.edu.cn/test.owl#B003 城域网@zh 

http://vision.pku.edu.cn/test.owl#A003 张三@zh 

http://vision.pku.edu.cn/test.owl#B004 数字图书馆@zh 

http://vision.pku.edu.cn/test.owl#B001 计算机@zh 

http://vision.pku.edu.cn/test.owl#P002 北京大学@zh 

http://vision.pku.edu.cn/test.owl#B005 数据挖掘@zh 

http://vision.pku.edu.cn/test.owl#P005 人民大学@zh 

http://vision.pku.edu.cn/test.owl#P003 清华大学@zh 

http://vision.pku.edu.cn/test.owl#A001 赵大@zh 

http://vision.pku.edu.cn/test.owl#B007 编程珠玑@zh 

http://vision.pku.edu.cn/test.owl#B006 机器学习@zh 

http://vision.pku.edu.cn/test.owl#A005 马五@zh 

http://vision.pku.edu.cn/test.owl#B002 局域网@zh 

http://vision.pku.edu.cn/test.owl#P001 机械工业@zh 

http://vision.pku.edu.cn/test.owl#P004 电子工业@zh 

http://vision.pku.edu.cn/test.owl#B009 SQL Server 指南@zh

但是我只想读取book及其hasname,应如何改呢?


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