change dbpedia prefix to "PREFIX dbpedia: <http://dbpedia.org/resource/>" +
On Mon, Sep 2, 2013 at 5:37 AM, bocai <[email protected]> wrote: > Hi, > I want to access remote sparql endpoint throuth JENA API. My program is > below. > After I ran the program, There is no record in resultset > ----- > | p | > ===== > ----- > But I visit http://dbpedia.org/sparql and ran this sparql ( select * > where {?p dbpedia-owl:country dbpedia:Germany.} LIMIT 10 ) as same as > sparql in my program, I can get the result i want > > p > http://dbpedia.org/resource/%C3%96lsen > http://dbpedia.org/resource/%C3%96stringen > http://dbpedia.org/resource/%C3%9Cbach-Palenberg > http://dbpedia.org/resource/%C3%9Cberherrn > http://dbpedia.org/resource/%C3%9Cdersdorf > http://dbpedia.org/resource/%C3%9Chlingen-Birkendorf > http://dbpedia.org/resource/%C3%9Crzig > http://dbpedia.org/resource/16_Blocks > http://dbpedia.org/resource/18_%E2%80%93_Allein_unter_M%C3%A4dchen > http://dbpedia.org/resource/2011_German_Grand_Prix > > > Can you point out my error? thanks very much! > > public static void SearchSparql(){ > try { > String queryStr = > "PREFIX dbpedia: <http://dbpedia.org/>" + > "PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>" + > "select * where {?p dbpedia-owl:country dbpedia:Germany.} LIMIT 10"; > > Query query = QueryFactory.create(queryStr); > QueryExecution qexec = QueryExecutionFactory.sparqlService(" > http://dbpedia.org/sparql", query); > ((QueryEngineHTTP)qexec).addParam("timeout", "10000") ; > ResultSet rs = qexec.execSelect(); > ResultSetFormatter.out(System.out, rs, query); > qexec.close(); > } catch (Exception e) { > e.printStackTrace(); > } > > } > > > 2013-09-02 bocai > 中国科学院国家科学图书馆成都分馆 中国科学院成都文献情报中心 > 联系电话:028-85220240 > 联系地址:610041 四川省成都市一环路南二段16号 > 电子邮箱:[email protected] > ---------------------------------------------------------------------- -- --- Marco Neumann KONA
