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

lihan6415151528 lihan6415151528 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的查询结果为什么是空呢?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都没有人回答,帮顶也有分的
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
lihan6415151528
Java 51,407 成员 86,132 内容