以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Semantic Web(语义Web)/描述逻辑/本体 』  (http://bbs.xml.org.cn/list.asp?boardid=2)
----  我的简单owl查询为什么查询不出来呢?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=73938)


--  作者:lihan6415151528
--  发布时间:4/7/2009 11:38:00 AM

--  我的简单owl查询为什么查询不出来呢?
简单的查询代码:
public static void main(String[] a)
 {
  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();


 }

owl文件里面的确有:
  <owl:Class rdf:ID="Trees">
    <rdfs:subClassOf>
      <owl:Class rdf:ID="Plant"/>
    </rdfs:subClassOf>
  </owl:Class>


为什么只出来
-----
| y |
=====
-----
呢?


--  作者:jpz6311whu
--  发布时间:4/7/2009 1:11:00 PM

--  
请楼主把d://NewAnimalTest_bef_mysql.owl本体库最开头的部分贴出来看看,就是声明命名空间和本体库import的部分
--  作者:lihan6415151528
--  发布时间:4/7/2009 3:47:00 PM

--  
楼主加我Q好吗  397764284   谢谢
--  作者:university2046
--  发布时间:9/17/2009 3:27:00 PM

--  
我也遇到同样的问题呢
--  作者:springbird
--  发布时间:9/17/2009 6:36:00 PM

--  
楼主解决了吗,我也遇到了同样的问题,交流一下,我的QQ1102875406
--  作者:lgpxzyb
--  发布时间:9/21/2009 11:13:00 AM

--  
把query里该加空格的地方加几个空格试试。多数情况是query写的有问题。
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms