做过本体查询的请进,求解~~~ 送分。。

lihan6415151528 2009-04-07 11:28:36
我的查询结果为什么是空呢?owl里面明明有:

<owl:Class rdf:ID="Trees">
<rdfs:subClassOf>
<owl:Class rdf:ID="Plant"/>
</rdfs:subClassOf>
</owl:Class>

查询代码:

OntModel text_ontmodel = ModelFactory.createOntologyModel();
OntDocumentManager dm = text_ontmodel.getDocumentManager();

dm.addAltEntry("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "file:d://NewAnimalTest_bef_mysql.owl");
text_ontmodel.read("http://www.w3.org/1999/02/22-rdf-syntax-ns#");

String prefix = "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "+" PREFIX base: <http://www.owl-ontologies.com/Ontology1229986688.owl> ";

String select = " SELECT ?y ";
String where = " where{?y rdfs:subClassOf base:Plant}";

Query query = QueryFactory.create(prefix + select + where);
Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
InfModel inf = ModelFactory.createInfModel(reasoner, text_ontmodel);

QueryExecution qe = QueryExecutionFactory.create(query,inf);

ResultSet results = qe.execSelect();
ResultSetFormatter.out(System.out,results,query);

qe.close();


昨天发的帖子http://topic.csdn.net/u/20090406/16/9aaf6319-4ead-4cc3-a851-2261142f17b1.html都没有人回答,帮顶也有分的
...全文
82 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
fenfeng214 2011-07-10
  • 打赏
  • 举报
回复
本体匹配不太好做啊,理论性真强
marry89 2009-04-25
  • 打赏
  • 举报
回复
你解决了没?我也是做本体的
tanwei1002 2009-04-08
  • 打赏
  • 举报
回复
Java不懂。。。。
rachel_tang 2009-04-07
  • 打赏
  • 举报
回复
解析?00

50,530

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧