新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   >>中国XML论坛<<     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论Semantic Web(语义Web,语义网或语义万维网, Web 3.0)及相关理论,如:Ontology(本体,本体论), OWL(Web Ontology Langauge,Web本体语言), Description Logic(DL, 描述逻辑),RDFa,Ontology Engineering等。
    [返回] 中文XML论坛 - 专业的XML技术讨论区W3CHINA.ORG讨论区 - Web新技术讨论『 Semantic Web(语义Web)/描述逻辑/本体 』 → [求助]OWL:sameAs如何实现? 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 24230 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [求助]OWL:sameAs如何实现? 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     icecoolfire 帅哥哟,离线,有人找我吗?双子座1985-6-14
      
      
      等级:大二(研究汇编)
      文章:52
      积分:250
      门派:XML.ORG.CN
      注册:2007/12/3

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给icecoolfire发送一个短消息 把icecoolfire加入好友 查看icecoolfire的个人资料 搜索icecoolfire在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看icecoolfire的博客楼主
    发贴心情 [求助]OWL:sameAs如何实现?

    前一段时间在研究到OWL:sameAS这块,就尝试着进行多词同义的应用,我将“Jack”和“Jones”之间的关系设为owl:sameAs,然后对“Jack”的相关信息进行了编辑,接着利用Jena进行查询,结果如果查询“Jack”,那么可以得到预期的内容,如果查询“Jones”,则得到空白,那位大哥可以帮忙解释一下这是为什么?

       收藏   分享  
    顶(0)
      




    ----------------------------------------------
    新手,大家多多关照……

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/4/14 10:38:00
     
     jpz6311whu 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      等级:研三(收到微软亚洲研究院的Offer了)(版主)
      文章:1718
      积分:10610
      门派:W3CHINA.ORG
      注册:2005/4/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客2
    发贴心情 
    请楼主把你的程序源代码贴出来看看,你是如何通过jena查询的?
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/4/14 11:11:00
     
     icecoolfire 帅哥哟,离线,有人找我吗?双子座1985-6-14
      
      
      等级:大二(研究汇编)
      文章:52
      积分:250
      门派:XML.ORG.CN
      注册:2007/12/3

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给icecoolfire发送一个短消息 把icecoolfire加入好友 查看icecoolfire的个人资料 搜索icecoolfire在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看icecoolfire的博客3
    发贴心情 
    这个实验程序主体还是借鉴jiexincao大哥以前的那个程序:
    查询过程如下:
    public  ResIterator search(String item,String value){

        Property LookForProperty;
        ResIterator LookForResult=null;
        getInfModel myGet = new getInfModel ();

        LookForProperty=model.getProperty(myGet.itemToProperty(item));
        if(item.equals("author") )
        {
         Resource LookForValue;
         LookForValue=model.createResource(myGet.addNameSpace(value));
         LookForResult=model.listSubjectsWithProperty(LookForProperty,LookForValue);
        }
        else if (item.equals("title"))
        {
         String LookForValue = value;
         LookForResult=model.listSubjectsWithProperty(LookForProperty,LookForValue);
        }
        else if (item.equals("keywords"))
        {
    //     Resource LookForValue;
    //     LookForValue=model.createResource(myGet.addNameSpace(value));
         String LookForValue = value;
         LookForResult=model.listSubjectsWithProperty(LookForProperty,LookForValue);
        }
        else if (item.equals("ISBN"))
        {
         String LookForValue = value;
         LookForResult = model.listSubjectsWithProperty(LookForProperty,LookForValue);
        }

         return LookForResult;
    }
    public String getValue(Resource res,String item){
           String result=null;
           Property LookForProperty;
           LookForProperty=model.getProperty(myGet.itemToProperty(item));
           StmtIterator LookForResult=model.listStatements(res,LookForProperty,(RDFNode)null);

           while(LookForResult.hasNext() ){
           result=LookForResult.nextStatement().getObject().toString() ;
           }
           return myGet.removeType(result);//LookForResult.toString();
          }

    public  NodeIterator getIterator(String res,String item){
         NodeIterator result=null;
         Resource resource=model.createResource(myGet.addPrefix(res));
         Property property=model.getProperty(myGet.itemToProperty(item));
         result=model.listObjectsOfProperty(resource,property);
         return result;
         }

    另外构建的本体如下:
    <?xml version="1.0"?>
    <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:paper="http://www.icecoolfire.com#"
        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.icecoolfire.com#Publication"/>
      <owl:Class rdf:about="http://www.icecoolfire.com#Person"/>
      <owl:Class rdf:about="http://www.icecoolfire.com#Article"/>
      <owl:ObjectProperty rdf:about="http://www.icecoolfire.com#Published">
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
        <rdfs:range rdf:resource="http://www.icecoolfire.com#Publication"/>
      </owl:ObjectProperty>
      <owl:ObjectProperty rdf:about="http://www.icecoolfire.com#Citing">
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
        <owl:inverseOf>
          <owl:ObjectProperty rdf:about="http://www.icecoolfire.com#isCited"/>
        </owl:inverseOf>
        <rdfs:range rdf:resource="http://www.icecoolfire.com#Article"/>
      </owl:ObjectProperty>
      <owl:ObjectProperty rdf:about="http://www.icecoolfire.com#Author">
        <rdfs:range rdf:resource="http://www.icecoolfire.com#Person"/>
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
      </owl:ObjectProperty>
      <owl:ObjectProperty rdf:about="http://www.icecoolfire.com#indCiting">
        <rdfs:range rdf:resource="http://www.icecoolfire.com#Article"/>
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
      </owl:ObjectProperty>
      <owl:ObjectProperty rdf:about="http://www.icecoolfire.com#bothCited">
        <rdfs:range rdf:resource="http://www.icecoolfire.com#Article"/>
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
        <owl:inverseOf rdf:resource="http://www.icecoolfire.com#bothCited"/>
        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#SymmetricProperty"/>
      </owl:ObjectProperty>
      <owl:ObjectProperty rdf:about="http://www.icecoolfire.com#isCited">
        <rdfs:range rdf:resource="http://www.icecoolfire.com#Article"/>
        <owl:inverseOf rdf:resource="http://www.icecoolfire.com#Citing"/>
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
      </owl:ObjectProperty>
      <owl:DatatypeProperty rdf:about="http://www.icecoolfire.com#Title">
        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
      </owl:DatatypeProperty>
      <owl:DatatypeProperty rdf:about="http://www.icecoolfire.com#ISBN">
        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
      </owl:DatatypeProperty>
      <owl:DatatypeProperty rdf:about="http://www.icecoolfire.com#content">
        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
      </owl:DatatypeProperty>
      <owl:DatatypeProperty rdf:about="http://www.icecoolfire.com#keywords">
        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
      </owl:DatatypeProperty>
      <owl:SymmetricProperty rdf:about="http://www.icecoolfire.com#bothCiting">
        <rdfs:domain rdf:resource="http://www.icecoolfire.com#Article"/>
        <owl:inverseOf rdf:resource="http://www.icecoolfire.com#bothCiting"/>
        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
        <rdfs:range rdf:resource="http://www.icecoolfire.com#Article"/>
      </owl:SymmetricProperty>
      <paper:Publication rdf:ID="High_education"/>
      <paper:Person rdf:ID="Gary"/>
      <paper:Article rdf:ID="Ontology">
        <paper:isCited>
          <paper:Article rdf:ID="Regular_Expression">
            <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >regular</paper:keywords>
            <paper:Author>
              <paper:Person rdf:ID="Peter"/>
            </paper:Author>
            <paper:Published>
              <paper:Publication rdf:ID="People_mail"/>
            </paper:Published>
            <paper:Citing rdf:resource="#Ontology"/>
            <paper:isCited>
              <paper:Article rdf:ID="Core_Java">
                <paper:Author rdf:resource="#Gary"/>
                <paper:Citing>
                  <paper:Article rdf:ID="JSP_design">
                    <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                    >JSP</paper:keywords>
                    <paper:Author>
                      <paper:Person rdf:ID="Jack">
                        <owl:sameAs>
                          <paper:Person rdf:ID="Jim">
                            <owl:sameAs rdf:resource="#Jack"/>
                          </paper:Person>
                        </owl:sameAs>
                      </paper:Person>
                    </paper:Author>
                    <paper:Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                    >JSP design</paper:Title>
                    <paper:ISBN rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                    >ISBN978-7-115-16000-2</paper:ISBN>
                    <paper:isCited rdf:resource="#Core_Java"/>
                    <paper:Published rdf:resource="#High_education"/>
                    <paper:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                    >something about how to design the web with the help of JSP language</paper:content>
                    <paper:isCited>
                      <paper:Article rdf:ID="Computer_Orgnazation">
                        <paper:isCited rdf:resource="#Ontology"/>
                        <paper:Citing>
                          <paper:Article rdf:ID="Programming_Csharp">
                            <paper:Citing>
                              <paper:Article rdf:ID="ASP.NET">
                                <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                                >asp</paper:keywords>
                                <paper:Author>
                                  <paper:Person rdf:ID="Williams">
                                    <owl:sameAs>
                                      <paper:Person rdf:ID="Kim">
                                        <owl:sameAs rdf:resource="#Williams"/>
                                      </paper:Person>
                                    </owl:sameAs>
                                  </paper:Person>
                                </paper:Author>
                                <paper:Citing>
                                  <paper:Article rdf:ID="Modern_Information_Retrival">
                                    <paper:ISBN rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                                    >ISBN978-7-115-16000-6</paper:ISBN>
                                    <paper:Citing>
                                      <paper:Article rdf:ID="semantic_web">
                                        <paper:content rdf:datatype=
                                        "http://www.w3.org/2001/XMLSchema#string"
                                        >introduce the progess of  semantic web</paper:content>
                                        <paper:Citing>
                                          <paper:Article rdf:ID="Wordnet">
                                            <paper:isCited rdf:resource="#semantic_web"/>
                                            <paper:isCited>
                                              <paper:Article rdf:ID="OWL">
                                                <paper:isCited rdf:resource="#Regular_Expression"/>
                                                <paper:Citing>
                                                  <paper:Article rdf:ID="RDF">
                                                    <paper:Citing rdf:resource="#Ontology"/>
                                                    <paper:content
                                                     rdf:datatype=
                                                    "http://www.w3.org/2001/XMLSchema#string"
                                                    >introduce the concept of Resource Description Framework</paper:content>
                                                    <paper:isCited rdf:resource="#OWL"/>
                                                    <paper:isCited rdf:resource="#semantic_web"/>
                                                    <paper:Author rdf:resource="#Peter"/>
                                                    <paper:Published>
                                                      <paper:Publication rdf:ID="Nature"/>
                                                    </paper:Published>
                                                    <paper:keywords
                                                     rdf:datatype=
                                                    "http://www.w3.org/2001/XMLSchema#string"
                                                    >RDF</paper:keywords>
                                                    <paper:isCited rdf:resource="#Ontology"/>
                                                    <paper:ISBN rdf:datatype=
                                                    "http://www.w3.org/2001/XMLSchema#string"
                                                    >ISBN978-7-115-16000-10</paper:ISBN>
                                                    <paper:Citing rdf:resource="#OWL"/>
                                                    <paper:Title rdf:datatype=
                                                    "http://www.w3.org/2001/XMLSchema#string"
                                                    >RDF</paper:Title>
                                                  </paper:Article>
                                                </paper:Citing>
                                                <paper:Citing rdf:resource="#Ontology"/>
                                                <paper:Citing rdf:resource="#Wordnet"/>
                                                <paper:isCited rdf:resource="#semantic_web"/>
                                                <paper:Title rdf:datatype=
                                                "http://www.w3.org/2001/XMLSchema#string"
                                                >OWL</paper:Title>
                                                <paper:Author>
                                                  <paper:Person rdf:ID="Tom"/>
                                                </paper:Author>
                                                <paper:content rdf:datatype=
                                                "http://www.w3.org/2001/XMLSchema#string"
                                                >introduce the content of the Ontology Web Language</paper:content>
                                                <paper:ISBN rdf:datatype=
                                                "http://www.w3.org/2001/XMLSchema#string"
                                                >ISBN978-7-115-16000-8</paper:ISBN>
                                                <paper:keywords rdf:datatype=
                                                "http://www.w3.org/2001/XMLSchema#string"
                                                >OWL</paper:keywords>
                                                <paper:isCited rdf:resource="#RDF"/>
                                                <paper:Published>
                                                  <paper:Publication rdf:ID="Oreilly"/>
                                                </paper:Published>
                                              </paper:Article>
                                            </paper:isCited>
                                            <paper:Title rdf:datatype=
                                            "http://www.w3.org/2001/XMLSchema#string"
                                            >wordnet</paper:Title>
                                            <paper:Author rdf:resource="#Kim"/>
                                            <paper:isCited rdf:resource="#Programming_Csharp"/>
                                            <paper:isCited>
                                              <paper:Article rdf:ID="Search_Engine">
                                                <paper:Citing rdf:resource="#Wordnet"/>
                                                <paper:isCited rdf:resource="#Programming_Csharp"/>
                                                <paper:Title rdf:datatype=
                                                "http://www.w3.org/2001/XMLSchema#string"
                                                >Search_Engine</paper:Title>
                                                <paper:Citing rdf:resource="#Modern_Information_Retrival"/>
                                                <paper:content rdf:datatype=
                                                "http://www.w3.org/2001/XMLSchema#string"
                                                >tell you how to construct a search engine by yourself</paper:content>
                                                <paper:keywords rdf:datatype=
                                                "http://www.w3.org/2001/XMLSchema#string"
                                                >search</paper:keywords>
                                                <paper:keywords rdf:datatype=
                                                "http://www.w3.org/2001/XMLSchema#string"
                                                >engine</paper:keywords>
                                                <paper:Author rdf:resource="#Peter"/>
                                                <paper:Citing rdf:resource="#Core_Java"/>
                                                <paper:ISBN rdf:datatype=
                                                "http://www.w3.org/2001/XMLSchema#string"
                                                >ISBN978-7-115-16000-5</paper:ISBN>
                                                <paper:Published>
                                                  <paper:Publication rdf:ID="Info.Sci."/>
                                                </paper:Published>
                                                <paper:isCited rdf:resource="#JSP_design"/>
                                              </paper:Article>
                                            </paper:isCited>
                                            <paper:Published rdf:resource="#Nature"/>
                                            <paper:Citing rdf:resource="#JSP_design"/>
                                            <paper:content rdf:datatype=
                                            "http://www.w3.org/2001/XMLSchema#string"
                                            >prepared for wordnet</paper:content>
                                            <paper:keywords rdf:datatype=
                                            "http://www.w3.org/2001/XMLSchema#string"
                                            >semantic</paper:keywords>
                                            <paper:ISBN rdf:datatype=
                                            "http://www.w3.org/2001/XMLSchema#string"
                                            >ISBN978-7-115-16000-13</paper:ISBN>
                                          </paper:Article>
                                        </paper:Citing>
                                        <paper:isCited rdf:resource="#Programming_Csharp"/>
                                        <paper:Author rdf:resource="#Jack"/>
                                        <paper:keywords rdf:datatype=
                                        "http://www.w3.org/2001/XMLSchema#string"
                                        >semantic</paper:keywords>
                                        <paper:Citing rdf:resource="#RDF"/>
                                        <paper:keywords rdf:datatype=
                                        "http://www.w3.org/2001/XMLSchema#string"
                                        >web</paper:keywords>
                                        <paper:Citing rdf:resource="#OWL"/>
                                        <paper:isCited rdf:resource="#Modern_Information_Retrival"/>
                                        <paper:Title rdf:datatype=
                                        "http://www.w3.org/2001/XMLSchema#string"
                                        >semantic web</paper:Title>
                                        <paper:Published rdf:resource="#People_mail"/>
                                        <paper:ISBN rdf:datatype=
                                        "http://www.w3.org/2001/XMLSchema#string"
                                        >ISBN978-7-115-16000-7</paper:ISBN>
                                      </paper:Article>
                                    </paper:Citing>
                                    <paper:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                                    >The book comprises two portions which complement and balance each other.The core portion includes nine chapters authored or coauthored by the designers of the book.The second portion which is fully intergrated with first,is formed by six state-of-the-art charpters written by leading reasearches in their fields.</paper:content>
                                    <paper:isCited rdf:resource="#ASP.NET"/>
                                    <paper:keywords rdf:datatype=
                                    "http://www.w3.org/2001/XMLSchema#string"
                                    >information</paper:keywords>
                                    <paper:keywords rdf:datatype=
                                    "http://www.w3.org/2001/XMLSchema#string"
                                    >modern</paper:keywords>
                                    <paper:isCited rdf:resource="#Search_Engine"/>
                                    <paper:isCited rdf:resource="#Core_Java"/>
                                    <paper:Published rdf:resource="#People_mail"/>
                                    <paper:Author rdf:resource="#Peter"/>
                                    <paper:Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                                    >Modern_Information_Retrival</paper:Title>
                                  </paper:Article>
                                </paper:Citing>
                                <paper:isCited rdf:resource="#Programming_Csharp"/>
                                <paper:Author rdf:resource="#Kim"/>
                                <paper:Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                                >ASP.NET</paper:Title>
                                <paper:Published rdf:resource="#Nature"/>
                                <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                                >net</paper:keywords>
                                <paper:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                                >something about how to use the language of ASP.NET</paper:content>
                                <paper:ISBN rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                                >ISBN978-7-115-16000-4</paper:ISBN>
                              </paper:Article>
                            </paper:Citing>
                            <paper:Citing rdf:resource="#Wordnet"/>
                            <paper:isCited rdf:resource="#Core_Java"/>
                            <paper:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                            >something about how to utilise the language of Csharp</paper:content>
                            <paper:Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                            >Programming Csharp</paper:Title>
                            <paper:Author>
                              <paper:Person rdf:ID="James"/>
                            </paper:Author>
                            <paper:Citing rdf:resource="#Search_Engine"/>
                            <paper:isCited rdf:resource="#Regular_Expression"/>
                            <paper:Published rdf:resource="#Oreilly"/>
                            <paper:ISBN rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                            >ISBN978-7-115-16000-3</paper:ISBN>
                            <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                            >Csharp</paper:keywords>
                            <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                            >programming</paper:keywords>
                            <paper:isCited rdf:resource="#Computer_Orgnazation"/>
                            <paper:Citing rdf:resource="#semantic_web"/>
                          </paper:Article>
                        </paper:Citing>
                        <paper:ISBN rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                        >ISBN978-7-115-16000-11</paper:ISBN>
                        <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                        >computer</paper:keywords>
                        <paper:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                        >something about the compouter</paper:content>
                        <paper:Author rdf:resource="#Jack"/>
                        <paper:Published rdf:resource="#People_mail"/>
                        <paper:Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                        >computer orgnazation</paper:Title>
                        <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                        >orgnazation</paper:keywords>
                        <paper:Citing rdf:resource="#JSP_design"/>
                      </paper:Article>
                    </paper:isCited>
                    <paper:Citing rdf:resource="#Search_Engine"/>
                    <paper:isCited rdf:resource="#Wordnet"/>
                  </paper:Article>
                </paper:Citing>
                <paper:isCited rdf:resource="#Search_Engine"/>
                <paper:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                >something about how to utilise the language of Java</paper:content>
                <paper:Citing rdf:resource="#Regular_Expression"/>
                <paper:Published>
                  <paper:Publication rdf:ID="Machine"/>
                </paper:Published>
                <paper:ISBN rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                >ISBN978-7-115-16000-1</paper:ISBN>
                <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                >Java</paper:keywords>
                <paper:Citing rdf:resource="#Modern_Information_Retrival"/>
                <paper:Citing rdf:resource="#Programming_Csharp"/>
                <paper:Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
                >Core Java</paper:Title>
              </paper:Article>
            </paper:isCited>
            <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >expression</paper:keywords>
            <paper:ISBN rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >ISBN978-7-115-16000-12</paper:ISBN>
            <paper:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >something about how to design the web with the help of Regular_Expression</paper:content>
            <paper:Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
            >Regular Expression</paper:Title>
            <paper:Citing rdf:resource="#OWL"/>
            <paper:Citing rdf:resource="#Programming_Csharp"/>
          </paper:Article>
        </paper:isCited>
        <paper:Author>
          <paper:Person rdf:ID="Jones"/>
        </paper:Author>
        <paper:Citing rdf:resource="#RDF"/>
        <paper:ISBN rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
        >ISBN978-7-115-16000-8</paper:ISBN>
        <paper:Citing rdf:resource="#Computer_Orgnazation"/>
        <paper:isCited rdf:resource="#OWL"/>
        <paper:content rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
        >introduce the new concept of ontology</paper:content>
        <paper:isCited rdf:resource="#RDF"/>
        <paper:keywords rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
        >ontology</paper:keywords>
        <paper:Published rdf:resource="#Oreilly"/>
        <paper:Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
        >Ontology</paper:Title>
      </paper:Article>
    </rdf:RDF>

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

    ----------------------------------------------
    新手,大家多多关照……

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/4/14 14:19:00
     
     jpz6311whu 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      等级:研三(收到微软亚洲研究院的Offer了)(版主)
      文章:1718
      积分:10610
      门派:W3CHINA.ORG
      注册:2005/4/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客4
    发贴心情 
    main函数呢?
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/4/14 15:46:00
     
     icecoolfire 帅哥哟,离线,有人找我吗?双子座1985-6-14
      
      
      等级:大二(研究汇编)
      文章:52
      积分:250
      门派:XML.ORG.CN
      注册:2007/12/3

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给icecoolfire发送一个短消息 把icecoolfire加入好友 查看icecoolfire的个人资料 搜索icecoolfire在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看icecoolfire的博客5
    发贴心情 
    import com.hp.hpl.jena.rdf.model.*;

    public class Test {
     public static void myTest(String item,String value)
     { 
      String temp = null;
      int citedNumber = 0;
      searchResult mysearch = new searchResult();
      display mydisplay = new display();
      ResIterator result = mysearch.search(item,value);
      while(result.hasNext())
      {
       citedNumber = 0;
       Resource res = result.nextResource();
          
       NodeIterator cited = mydisplay.getIterator(res.toString().split("#")[1],"isCited");
       if(cited!=null)
       {
        while(cited.hasNext())
        {
         temp = cited.next().toString();
         citedNumber=citedNumber+1;     
        }
       }
       else
       {
        System.out.println("cited is null!");
       }
       System.out.print(mysearch.getValue(res,"title"));
       System.out.print("     ");
       System.out.print(mysearch.getValue(res,"author"));
       System.out.print("     ");
       System.out.print("The book is cited "+citedNumber+" times");
       
       System.out.println();
       
      }
     }
     
     public static void main(String[] args)
     {
      String item = "author";
      String value = "Jim";
      myTest(item,value);
     }
    }
    这里value的值如果是Jack,就可以得到预期结果,如果是Jim则不行。这是为什么呀?

    ----------------------------------------------
    新手,大家多多关照……

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/4/15 14:47:00
     
     jpz6311whu 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      等级:研三(收到微软亚洲研究院的Offer了)(版主)
      文章:1718
      积分:10610
      门派:W3CHINA.ORG
      注册:2005/4/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客6
    发贴心情 
    public  ResIterator search(String item,String value){

        Property LookForProperty;
        ResIterator LookForResult=null;
        getInfModel myGet = new getInfModel ();

        LookForProperty=model.getProperty(myGet.itemToProperty(item));
        if(item.equals("author") )
        {
    ---

    这个getInfModel 是什么?代码贴出来看看,是什么样的推理model

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/4/15 16:31:00
     
     icecoolfire 帅哥哟,离线,有人找我吗?双子座1985-6-14
      
      
      等级:大二(研究汇编)
      文章:52
      积分:250
      门派:XML.ORG.CN
      注册:2007/12/3

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给icecoolfire发送一个短消息 把icecoolfire加入好友 查看icecoolfire的个人资料 搜索icecoolfire在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看icecoolfire的博客7
    发贴心情 
    package zyb;
    import com.hp.hpl.jena.rdf.*;
    import com.hp.hpl.jena.rdf.model.*;
    import com.hp.hpl.jena.ontology.*;
    import com.hp.hpl.jena.reasoner.*;
    import com.hp.hpl.jena.vocabulary.*;
    import com.hp.hpl.jena.reasoner.rulesys.*;
    import com.hp.hpl.jena.util.*;
    import java.lang.*;
    import java.util.*;
    import java.io.*;
    public class getInfModel {

       public InfModel getAInfModel(){
       InfModel infModel;
          String file = "../../ontology/paper.owl";
          Model data = ModelFactory.createDefaultModel();
          Model model = ModelFactory.createDefaultModel();
          InputStream in ;
         try{
             in = FileManager.get().open( file );
         data.read(in, "");
         }
         catch (Exception e ){}
          Resource configuration=model.createResource() ;
          configuration.addProperty(ReasonerVocabulary.PROPruleMode, "forward");
          configuration.addProperty(ReasonerVocabulary.PROPruleSet,  "../../rules/paper.rules");
          Reasoner reasoner = GenericRuleReasonerFactory.theInstance().create(configuration);
          infModel=ModelFactory.createInfModel(reasoner, data);
       return infModel;
       }
         public String itemToProperty(String item){
       String property=null;
         if (item.equals("title")){
               property="http://www.icecoolfire.com#Title";
           }
           else if(item.equals("ISBN")){
                property="http://www.icecoolfire.com#ISBN";
           }
           else if(item.equals("keywords")){
                property="http://www.icecoolfire.com#keywords";
           }
           else if(item.equals("author")){
                property="http://www.icecoolfire.com#Author";
           }
           else if(item.equals("content") )   {
            property="http://www.icecoolfire.com#content";
           }
           else if(item.equals("pulished") )   {
            property="http://www.icecoolfire.com#Published";
           }
           else if(item.equals("Citing") )   {
                   property="http://www.icecoolfire.com#Citing";
               }
    //       else if(item.equals("bothCiting") )   {
    //            property="http://www.icecoolfire.com#bothCiting";
    //                }
           else if(item.equals("isCited"))
           {
            property="http://www.icecoolfire.com#isCited";
           }
           else if(item.equals("indCiting"))
           {
            property="http://www.icecoolfire.com#indCiting";
           }
            else if(item.equals("bothCited") )   {
            property="http://www.icecoolfire.com#bothCited";
           }


       return property;
       }
       public String addNameSpace(String value){
             String result=value;
             result="http://www.owl-ontologies.com/unnamed.owl#" + value;
             return result;
       }
         public String removeType(String sou){
           String result=sou;
           if(sou.indexOf("^^")>0){
           result=sou.substring(0,sou.indexOf("^^"));
           }
           return result;
    }
       public String addPrefix(String sou){
       String result=null;
       result="http://www.owl-ontologies.com/unnamed.owl#"+sou;
       return result;
       }
    }

    ----------------------------------------------
    新手,大家多多关照……

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/4/15 23:12:00
     
     jpz6311whu 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      等级:研三(收到微软亚洲研究院的Offer了)(版主)
      文章:1718
      积分:10610
      门派:W3CHINA.ORG
      注册:2005/4/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客8
    发贴心情 
    rules里面要加这几条:

    [rdfs8:  (?a rdfs:subClassOf ?b), (?b rdfs:subClassOf ?c) -> (?a rdfs:subClassOf ?c)]

    [rdfs9:  (?x rdfs:subClassOf ?y), (?a rdf:type ?x) -> (?a rdf:type ?y)]

    [sameIndividualAs3: (?X owl:sameAs ?Y), (?X rdf:type owl:Thing), (?Y rdf:type owl:Thing)
                        -> (?X owl:sameIndividualAs ?Y) ]

    [sameIndividualAs4: (?X owl:sameIndividualAs ?Y), (?X ?P ?V) -> (?Y ?P ?V) ]

    [sameIndividualAs5: (?X owl:sameIndividualAs ?Y), (?V ?P ?X) -> (?V ?P ?Y) ]

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/4/17 11:28:00
     
     icecoolfire 帅哥哟,离线,有人找我吗?双子座1985-6-14
      
      
      等级:大二(研究汇编)
      文章:52
      积分:250
      门派:XML.ORG.CN
      注册:2007/12/3

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给icecoolfire发送一个短消息 把icecoolfire加入好友 查看icecoolfire的个人资料 搜索icecoolfire在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看icecoolfire的博客9
    发贴心情 
    谢谢jpz6311whu大哥
    不过我加了这几条,还是不行,我现在的rules文件是这样的
    [indCiting: (?c http://www.icecoolfire.com#Citing ?b),(?b http://www.icecoolfire.com#Citing ?a)->(?c  http://www.icecoolfire.com#indCiting ?a)]

    [bothCiting: (?a http://www.icecoolfire.com#Citing ?c),(?b http://www.icecoolfire.com#Citing ?c),notEqual(?a, ?b)->(?a http://www.icecoolfire.com#bothCiting ?b)]

    [bothCited: (?a http://www.icecoolfire.com#Citing ?b),(?a http://www.icecoolfire.com#Citing ?c),notEqual(?b, ?c)->(?b  http://www.icecoolfire.com#bothCited ?c)]

    [rdfs8:  (?a rdfs:subClassOf ?b), (?b rdfs:subClassOf ?c) -> (?a rdfs:subClassOf ?c)]

    [rdfs9:  (?x rdfs:subClassOf ?y), (?a rdf:type ?x) -> (?a rdf:type ?y)]

    [sameIndividualAs3: (?X owl:sameAs ?Y), (?X rdf:type owl:Thing), (?Y rdf:type owl:Thing) -> (?X owl:sameIndividualAs ?Y) ]

    [sameIndividualAs4: (?X owl:sameIndividualAs ?Y), (?X ?P ?V) -> (?Y ?P ?V) ]

    [sameIndividualAs5: (?X owl:sameIndividualAs ?Y), (?V ?P ?X) -> (?V ?P ?Y) ]

    您看需不需要在本体文件owl中再进行修改呢?

    ----------------------------------------------
    新手,大家多多关照……

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/4/17 14:26:00
     
     icecoolfire 帅哥哟,离线,有人找我吗?双子座1985-6-14
      
      
      等级:大二(研究汇编)
      文章:52
      积分:250
      门派:XML.ORG.CN
      注册:2007/12/3

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给icecoolfire发送一个短消息 把icecoolfire加入好友 查看icecoolfire的个人资料 搜索icecoolfire在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看icecoolfire的博客10
    发贴心情 
    而且不是说,在OWL中,owl:sameAs仅仅是owl:sameIndividualAs的同义词吗,那上面的规则又有什么意义?

    ----------------------------------------------
    新手,大家多多关照……

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/4/17 15:25:00
     
     GoogleAdSense双子座1985-6-14
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/12/18 20:28:37

    本主题贴数24,分页: [1] [2] [3]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    265.625ms