以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Semantic Web(语义Web)/描述逻辑/本体 』  (http://bbs.xml.org.cn/list.asp?boardid=2)
----  请教一个jena的查询出所有数据的语法  (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=91788)


--  作者:allen2006cyb@126.com
--  发布时间:7/9/2011 5:08:00 PM

--  请教一个jena的查询出所有数据的语法
自己构造了个超级简单的本体,就一个class,下面有5个属性。
从网上找了个查询出单个对象的所有数据,机器上运行的很正常,能够把对象C-000301的所有列提取出来,语法如下:
String prefix = "PREFIX owl: <http://www.w3.org/2002/07/owl#>"+
                     "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"+
                     "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " +
                     "PREFIX  base:<http://www.owl-ontologies.com/Ontology1310193754.owl#> ";
     
     String k="base:C-000301 ";
     //String select =  "SELECT ?dormitory ?major ?sex ?age ?attend ";
     String select =  "SELECT * ";
     
     String where =  "WHERE { "+
           "OPTIONAL { "+ k +
                                " base:caseName ?caseName ."+
                       " }"+
                       "OPTIONAL { "+ k +
                                " base:caseDescription ?caseDescription ."+
                       " }"+
                       "OPTIONAL { "+ k +
                                " base:caseConsignor ?caseConsignor ."+
                       " }"+
                       "OPTIONAL { "+ k +
                                " base:caseTime ?caseTime ."+
                       " }"+  
                       "OPTIONAL { "+ k +
                            " base:caseDetail ?caseDetail ."+
                       " }"+   
                      " }";

现在我的owl里面有5个对象,全部提取出来的语法怎么写呢,类似sql里面select * from case的语句?
谢谢各位了!!


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
70.313ms