以文本方式查看主题 - 计算机科学论坛 (http://bbs.xml.org.cn/index.asp) -- 『 Semantic Web(语义Web)/描述逻辑/本体 』 (http://bbs.xml.org.cn/list.asp?boardid=2) ---- [求助]Pellet推理的顯示?? (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=56263) |
-- 作者:j08102728 -- 发布时间:12/1/2007 5:41:00 PM -- [求助]Pellet推理的顯示?? 小弟請問各位大大: 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); OntModel m=ModelFactory.createOntologyModel(spec,null); m.read("http://protege.stanford.edu/plugins/owl/owl-library/koala.owl"); StmtIterator i=m.listStatements(null, OWL.equivalentClass,OWL.Nothing);//---->這行代表什麼意思?? while(i.hasNext()){ System.out.println("Class"+i.nextStatement().getSubject()+"is unsatisfiable"); } 結果出來: 雖然文件有寫但還不懂什麼意思??
|
-- 作者:jpz6311whu -- 发布时间:12/1/2007 6:01:00 PM -- StmtIterator i=m.listStatements(null, OWL.equivalentClass,OWL.Nothing);//---->這行代表什麼意思?? -- |
-- 作者:j08102728 -- 发布时间:12/1/2007 6:18:00 PM -- 謝謝大大解說!! 那如何顯示他推論出OWL檔哪些東西出來? 可以寫寫個sample小弟參考 |
-- 作者:jpz6311whu -- 发布时间:12/1/2007 6:33:00 PM --
你贴出来的sample就是呀 |
-- 作者:j08102728 -- 发布时间:12/1/2007 8:52:00 PM -- 了解 剛剛小弟改寫一下: 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); OntModel ontmodel = null; InputStreamReader in; FileInputStream file=new FileInputStream("Animal.owl"); in =new InputStreamReader(file,"UTF-8"); ontmodel= (OntModel) ModelFactory.createOntologyModel(); ontmodel.read(in,null); in.close(); Model im=ModelFactory.createInfModel(r,ontmodel); im.write(System.out); 結果是 |
-- 作者:j08102728 -- 发布时间:12/1/2007 8:55:00 PM -- 會重覆許多~~不知道小弟哪個寫錯 因為我目的是印出推論後出來的OWL檔 |
-- 作者:jpz6311whu -- 发布时间:12/1/2007 10:07:00 PM --
"会重复许多"是什么意思?我觉得没有错呀,楼主认为哪里有问题? 不太明白问什么? |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
2,078.125ms |