新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   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等。
    [返回] W3CHINA.ORG讨论区 - 语义网·描述逻辑·本体·RDF·OWLW3CHINA.ORG讨论区 - Web新技术讨论『 Semantic Web(语义Web)/描述逻辑/本体 』 → 用Pellet推理 結果一樣??[求助] 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 2989 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 用Pellet推理 結果一樣??[求助] 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     j08102728 帅哥哟,离线,有人找我吗?
      
      
      等级:大二(研究C++)
      文章:40
      积分:259
      门派:XML.ORG.CN
      注册:2007/8/8

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

    請問大大們:
    小弟把Pellet推理機放進去,為啥沒推理出來??
    預期推論結果:LION(獅子)屬於Carnivore(肉食動物)
    程式如下:

    OntModel m = null;
            InputStreamReader in;
            try{
                Model cmodel=ModelFactory.createDefaultModel();
                Resource conf=cmodel.createResource();
                conf.addProperty(ReasonerVocabulary.EXT_REASONER_URL,cmodel.createResource("http://localhost:8081"));
                DIGReasonerFactory drf=(DIGReasonerFactory) ReasonerRegistry.theRegistry().getFactory(DIGReasonerFactory.URI);
                DIGReasoner r=(DIGReasoner) drf.create(conf);
                OntModelSpec spec=new OntModelSpec(OntModelSpec.OWL_DL_MEM);
                spec.setReasoner(r);
               m= ModelFactory.createOntologyModel(spec,null);
                FileInputStream file=new FileInputStream("Animal.owl");
                in =new InputStreamReader(file,"UTF-8");
                m.read(in,null);
                m.write(System.out);
            }catch(FileNotFoundException e){
                System.out.println("無法打開本體論檔案");
                System.exit(0);
            }catch(IOException e){
                e.printStackTrace();
            }

    OWL:
    <?xml version="1.0"?>
    <rdf:RDF
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns="http://www.owl-ontologies.com/Ontology1195606282.owl#"
        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#"
      xml:base="http://www.owl-ontologies.com/Ontology1195606282.owl">
      <owl:Ontology rdf:about=""/>
      <owl:Class rdf:ID="Giraffe">
        <rdfs:subClassOf>
          <owl:Class rdf:ID="Herbivore"/>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
          <owl:Restriction>
            <owl:onProperty>
              <owl:ObjectProperty rdf:ID="eat"/>
            </owl:onProperty>
            <owl:allValuesFrom>
              <owl:Class rdf:ID="Leaf"/>
            </owl:allValuesFrom>
          </owl:Restriction>
        </rdfs:subClassOf>
      </owl:Class>
      <owl:Class rdf:ID="Branch">
        <rdfs:subClassOf>
          <owl:Class rdf:ID="Plant"/>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
          <owl:Restriction>
            <owl:allValuesFrom>
              <owl:Class rdf:ID="Tree"/>
            </owl:allValuesFrom>
            <owl:onProperty>
              <owl:TransitiveProperty rdf:ID="is_part_of"/>
            </owl:onProperty>
          </owl:Restriction>
        </rdfs:subClassOf>
      </owl:Class>
      <owl:Class rdf:ID="Lion">
        <rdfs:subClassOf>
          <owl:Restriction>
            <owl:onProperty>
              <owl:ObjectProperty rdf:about="#eat"/>
            </owl:onProperty>
            <owl:allValuesFrom>
              <owl:Class rdf:about="#Herbivore"/>
            </owl:allValuesFrom>
          </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
          <owl:Class rdf:ID="Animal"/>
        </rdfs:subClassOf>
      </owl:Class>
      <owl:Class rdf:about="#Tree">
        <rdfs:subClassOf>
          <owl:Class rdf:about="#Plant"/>
        </rdfs:subClassOf>
      </owl:Class>
      <owl:Class rdf:about="#Animal">
        <owl:disjointWith>
          <owl:Class rdf:about="#Plant"/>
        </owl:disjointWith>
      </owl:Class>
      <owl:Class rdf:about="#Plant">
        <owl:disjointWith rdf:resource="#Animal"/>
      </owl:Class>
      <owl:Class rdf:about="#Leaf">
        <rdfs:subClassOf rdf:resource="#Plant"/>
        <rdfs:subClassOf>
          <owl:Restriction>
            <owl:allValuesFrom rdf:resource="#Branch"/>
            <owl:onProperty>
              <owl:TransitiveProperty rdf:about="#is_part_of"/>
            </owl:onProperty>
          </owl:Restriction>
        </rdfs:subClassOf>
      </owl:Class>
      <owl:Class rdf:ID="Carnivore">
        <owl:equivalentClass>
          <owl:Class>
            <owl:intersectionOf rdf:parseType="Collection">
              <owl:Class rdf:about="#Animal"/>
              <owl:Restriction>
                <owl:onProperty>
                  <owl:ObjectProperty rdf:ID="maineat"/>
                </owl:onProperty>
                <owl:allValuesFrom rdf:resource="#Animal"/>
              </owl:Restriction>
            </owl:intersectionOf>
          </owl:Class>
        </owl:equivalentClass>
      </owl:Class>
      <owl:Class rdf:about="#Herbivore">
        <rdfs:subClassOf rdf:resource="#Animal"/>
        <rdfs:subClassOf>
          <owl:Restriction>
            <owl:allValuesFrom rdf:resource="#Plant"/>
            <owl:onProperty>
              <owl:ObjectProperty rdf:about="#eat"/>
            </owl:onProperty>
          </owl:Restriction>
        </rdfs:subClassOf>
      </owl:Class>
      <owl:ObjectProperty rdf:ID="eated">
        <owl:inverseOf>
          <owl:ObjectProperty rdf:about="#eat"/>
        </owl:inverseOf>
        <rdfs:range rdf:resource="#Animal"/>
      </owl:ObjectProperty>
      <owl:ObjectProperty rdf:about="#maineat">
        <rdfs:subPropertyOf>
          <owl:ObjectProperty rdf:about="#eat"/>
        </rdfs:subPropertyOf>
      </owl:ObjectProperty>
      <owl:ObjectProperty rdf:about="#eat">
        <owl:inverseOf rdf:resource="#eated"/>
        <rdfs:domain rdf:resource="#Animal"/>
      </owl:ObjectProperty>
      <owl:TransitiveProperty rdf:about="#is_part_of">
        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
      </owl:TransitiveProperty>
    </rdf:RDF>


       收藏   分享  
    顶(0)
      




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

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客2
    发贴心情 
    推理的结果  m.write(System.out);这样是显示不出来的

    你可以试试listStatements

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/11/22 21:21:00
     
     j08102728 帅哥哟,离线,有人找我吗?
      
      
      等级:大二(研究C++)
      文章:40
      积分:259
      门派:XML.ORG.CN
      注册:2007/8/8

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给j08102728发送一个短消息 把j08102728加入好友 查看j08102728的个人资料 搜索j08102728在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看j08102728的博客3
    发贴心情 
    謝謝提點!!
    小弟還有個問題,假如在OWL裡已經設定條件如下:
    (1)
    某個Class:NoteBook 它有一個instance:ACER_TravelMate_6291
    另一個Class:Laptop 底下沒有instance
    已設定Class:NoteBook 等於 Class:Laptop這個條件
    那查詢Class:Laptop 有哪些instance 時,會找出:ACER_TravelMate_6291

    (2)
    已設好條件subject:組織 property:導入 object:IS,且企業和學校屬於組織的subclass
    那查詢 ?subject  property:導入 object:IS時,會找出subject:組織、企業、學校

    以上這兩個要用推理機推出來嗎??

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

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客4
    发贴心情 
    都要用推理
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/11/23 11:48:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/5/3 13:41:40

    本主题贴数4,分页: [1]

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