It apparently worked for you. I consider this thread closed. http://sourceforge.net/mailarchive/forum.php?thread_name=201309031713122810608%40clas.ac.cn&forum_name=dbpedia-discussion
On Tue, Sep 3, 2013 at 4:57 AM, bocai <[email protected]> wrote: > Of course I can access the sparql endpoint at http://dbpedia.org/sparqlfrom > my jvm. > I think the error has relation with PREFIX. > > when I access with > "SELECT DISTINCT ?company where {?company a < > http://dbpedia.org/ontology/Company>} LIMIT 20"; > I can get result. But when I access with > "PREFIX dbpedia: <http://dbpedia.org/resource/> " + > "PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> " + > "select ?p where {?p dbpedia-owl:country dbpedia:Germany> .} LIMIT 10"; > there is not result > > log4j:WARN No appenders could be found for logger > (com.hp.hpl.jena.util.FileManager). > log4j:WARN Please initialize the log4j system properly. > log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for > more info. > ---------------------------------------------------------------- > | company | > ================================================================ > | <http://dbpedia.org/resource/%C3%9Cstra> | > | <http://dbpedia.org/resource/%C4%8Cesk%C3%A9_dr%C3%A1hy> | > | <http://dbpedia.org/resource/7th_Level> | > | <http://dbpedia.org/resource/A&W_Restaurants> | > | <http://dbpedia.org/resource/A._Lange_&_S%C3%B6hne> | > | <http://dbpedia.org/resource/ABB_Group> | > | <http://dbpedia.org/resource/ABC_Motors> | > | <http://dbpedia.org/resource/AG_Vulcan_Stettin> | > | <http://dbpedia.org/resource/AIDA_Cruises> | > | <http://dbpedia.org/resource/AM_General> | > | <http://dbpedia.org/resource/ARY_Group> | > | <http://dbpedia.org/resource/AVG_Technologies> | > | <http://dbpedia.org/resource/Abbott-Detroit> | > | <http://dbpedia.org/resource/Accenture> | > | <http://dbpedia.org/resource/Adnams_Brewery> | > | <http://dbpedia.org/resource/Aer_Arann> | > | <http://dbpedia.org/resource/Aero_Lloyd> | > | <http://dbpedia.org/resource/Aeropostal_Alas_de_Venezuela> | > | <http://dbpedia.org/resource/Afrinat_International_Airlines> | > | <http://dbpedia.org/resource/Afriqiyah_Airways> | > ---------------------------------------------------------------- > > > > > > > ---------------------------------------------------------------------- > > 发件人: Marco Neumann > 发送时间: 2013-09-03 15:04 > 收件人: users > 主题: Re: Re: JENA API question > make sure you can access the sparql endpoint at > http://dbpedia.org/sparqlfrom your > jvm. > > QueryExecution qexec = QueryExecutionFactory.sparqlService(" > http://dbpedia.org/sparql", query); > > > > On Mon, Sep 2, 2013 at 9:42 PM, bocai <[email protected]> wrote: > > > Oh, I changed Prefix from > > "PREFIX dbpedia: http://dbpedia.org/" > > to > > "PREFIX dbpedia: <http://dbpedia.org/resource/>" > > > > the error also changed as below: > > HttpException: java.net.SocketException: Connection reset: > > java.net.SocketException: Connection reset > > at > > > com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:529) > > at > com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:289) > > at com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:240) > > at > > > com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:302) > > at Dbpedia.GetFromSparql.SearchSparql(GetFromSparql.java:42) > > at Dbpedia.GetFromSparql.main(GetFromSparql.java:53) > > > > Caused by: java.net.SocketException: Connection reset > > at java.net.SocketInputStream.read(SocketInputStream.java:168) > > at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) > > at java.io.BufferedInputStream.read1(BufferedInputStream.java:258) > > at java.io.BufferedInputStream.read(BufferedInputStream.java:317) > > at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687) > > at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632) > > at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652) > > at > > > sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1064) > > at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373) > > at > > > com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:412) > > ... 5 more > > > > How can I do ? > > > > > > > > 发件人: Marco Neumann > > 发送时间: 2013-09-02 18:46 > > 收件人: users > > 主题: Re: JENA API question > > 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(); > > > } > > > > > > } > > > > > > > > > - > > > > > > --- > > Marco Neumann > > KONA > > > > > -- > > > --- > Marco Neumann > KONA > -- --- Marco Neumann KONA
