I've got a sucessful result when executing *outside* our intranet (LAN). All the 43016 results were returned. It seems that there are so many requests (when executing in the Local Network) that the server or the client can not properly handle them. Suggestions? I could not receive more than 5000 results when querying inside the LAN. Results come much faster, but the exception always occurs.
Regis. 2012/4/7 Regis Pires Magalhães <regispires...@gmail.com> > > I get a "java.net.NoRouteToHostException: Cannot assign requested address" > exception when I execute que following code: > > import com.hp.hpl.jena.query.QueryExecution; > import com.hp.hpl.jena.query.QueryExecutionFactory; > import com.hp.hpl.jena.query.QueryFactory; > import com.hp.hpl.jena.query.QuerySolution; > import com.hp.hpl.jena.query.ResultSet; > import com.hp.hpl.jena.rdf.model.ModelFactory; > import com.hp.hpl.jena.sparql.core.DatasetImpl; > > public class Query { > public static void main(String[] args) { > String query = "PREFIX owl: < > http://www.w3.org/2002/07/owl#>\n" + > "PREFIX geopos: < > http://www.w3.org/2003/01/geo/wgs84_pos#>\n" + > "select ?s ?lat ?long where {\n" + > " SERVICE < > http://fuseki.mooo.com/lgd-dbpedia/sparql> {\n" + > " select * where {\n" + > " ?s owl:sameAs ?geo .\n" + > " FILTER > regex(str(?geo),\"dbpedia\")\n" + > " } \n" + > " }\n" + > " SERVICE < > http://fuseki.mooo.com/dbpedia-geo/sparql> {\n" + > " select * where{\n" + > " ?geo geopos:lat ?lat ;\n" + > " geopos:long ?long .\n" + > " } \n" + > " } \n" + > "} \n"; > > long start = System.currentTimeMillis(); > QueryExecution exec = > QueryExecutionFactory.create(QueryFactory.create(query), > new > DatasetImpl(ModelFactory.createDefaultModel())); > ResultSet rs = exec.execSelect(); > int n = 0; > while (rs.hasNext()) { > rs.next(); > System.out.print(++n + " "); > } > long time = System.currentTimeMillis() - start; > System.out.println(n + " results found in " + time + > "ms."); > } > } > > The same query runs perfectly when a do limit in the first SERVICE select: > > String query = "PREFIX owl: < > http://www.w3.org/2002/07/owl#>\n" + > "PREFIX geopos: < > http://www.w3.org/2003/01/geo/wgs84_pos#>\n" + > "select ?s ?lat ?long where {\n" + > " SERVICE < > http://fuseki.mooo.com/lgd-dbpedia/sparql> {\n" + > " select * where {\n" + > " ?s owl:sameAs ?geo .\n" + > " FILTER > regex(str(?geo),\"dbpedia\")\n" + > " } *limit 20000* \n" + > " }\n" + > " service < > http://fuseki.mooo.com/dbpedia-geo/sparql> {\n" + > " select * where{\n" + > " ?geo geopos:lat ?lat ;\n" + > " geopos:long ?long .\n" + > " } \n" + > " } \n" + > "} \n"; > > > What can I do to fix the problem? It always occurs when the query is run, > even when the Fuseki Sparql Endpoint is running locally. > I did not observe any problem related to the network. The problem persists > when the code (query) is executed in different hosts. > I am using Jena classes from "fuseki-server.jar" in the client classpath. > I've also tested different Fuseki jar versions: 0.2.1, 0.2.2. > The full stack trace is this: > > Exception in thread "main" HttpException: > java.net.NoRouteToHostException: Cannot assign requested address: > java.net.NoRouteToHostException: Cannot assign requested address > at > com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:216) > at com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:157) > at com.hp.hpl.jena.sparql.engine.http.Service.exec(Service.java:71) > at > com.hp.hpl.jena.sparql.engine.main.iterator.QueryIterService.nextStage(QueryIterService.java:53) > at > com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:113) > at > com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:65) > at > com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108) > at > com.hp.hpl.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:65) > at > com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108) > at > com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40) > at > com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108) > at > com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40) > at > com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108) > at > com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:72) > at Query.main(Query.java:34) > Caused by: java.net.NoRouteToHostException: Cannot assign requested address > at java.net.PlainSocketImpl.socketConnect(Native Method) > at > java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327) > at > java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193) > at > java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180) > at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384) > at java.net.Socket.connect(Socket.java:546) > at java.net.Socket.connect(Socket.java:495) > at sun.net.NetworkClient.doConnect(NetworkClient.java:178) > at sun.net.www.http.HttpClient.openServer(HttpClient.java:409) > at sun.net.www.http.HttpClient.openServer(HttpClient.java:530) > at sun.net.www.http.HttpClient.<init>(HttpClient.java:240) > at sun.net.www.http.HttpClient.New(HttpClient.java:321) > at sun.net.www.http.HttpClient.New(HttpClient.java:338) > at > sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:935) > at > sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:876) > at > sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:801) > at > com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:199) > ... 14 more > > Best regards, > Regis. > >