以文本方式查看主题 - 计算机科学论坛 (http://bbs.xml.org.cn/index.asp) -- 『 Semantic Web(语义Web)/描述逻辑/本体 』 (http://bbs.xml.org.cn/list.asp?boardid=2) ---- [求助]用SPARQL查詢property結果會這樣?? (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=52430) |
-- 作者:j08102728 -- 发布时间:9/8/2007 8:46:00 PM -- [求助]用SPARQL查詢property結果會這樣?? 請問各位大大們: try{ FileInputStream file=new FileInputStream("PeriodicTable.owl"); InputStreamReader in=new InputStreamReader(file,"UTF-8"); Model tempModel =ModelFactory.createDefaultModel(); tempModel.read(in,null); String qureyString= "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+ "PREFIX table:<http://www.daml.org/2003/01/periodictable/PeriodicTable#>"+ "SELECT *"+ "WHERE{"+ "table:group_17 ?p table:I ." + "}"; Query query =QueryFactory.create(querytString); QueryExecution qe=QueryExecutionFactory.create(query,tempModel); ResultSet results=qe.execSelect(); ResultSetFormatter.out(System.out,results,query); qe.close(); PeriodicTable.owl: 因為我查主體.客體都有值跑出來!! |
-- 作者:jpz6311whu -- 发布时间:9/8/2007 11:40:00 PM -- --------------------------------------------------------------------- | p | ===================================================================== | <http://www.daml.org/2003/01/periodictable/PeriodicTable#element> | --------------------------------------------------------------------- |
-- 作者:j08102728 -- 发布时间:9/9/2007 9:24:00 PM -- 謝謝大大...問題已解決 原來我多打這一行 Query query =QueryFactory.create(querytString); 但不知道為何多這行 |
-- 作者:gandangs -- 发布时间:11/19/2007 12:28:00 PM -- 想请教下已经用 InputStreamReader in=new InputStreamReader(file,"UTF-8");处理中文 可是到了 ResultSetFormatter.out(System.out,results,query);查询出来的结果怎么显示是乱码呢?英文数字的都可以正常显示. |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
46.875ms |