I run it several times like you did it in a for sentence and the second time was much better like you said. Thanks a lot. Now I understand what yuo said about class loading.
2012/6/10 Federico López <[email protected]> > I'm using arq.2.8.8 in a Intel Core 2 Quad (2.33 Ghz) with 4.00 GB RAM > in Windows 7 x 64. > > I'm using Eclipse Indigo IDE. > > > OntologyAcces.HOSTQUERY="http://127.0.0.1:3030/tdb/query" is a constant > that keeps the value of the URL of the Fuseki server. > > > 2012/6/10 Andy Seaborne <[email protected]> > >> On 10/06/12 18:36, Federico López wrote: >> >>> I need to send a query to Fuseki server from Java ans ARQ is taking too >>> much time parsing and executing a simple query to Fuseki Server. This is >>> my >>> code: >>> >>> long before=new java.util.Date().getTime(); >>> Query query = >>> QueryFactory.create(**OntologyAcces.PREFIXES+"SELECT *{?s ?p ?o} LIMIT >>> 1000"); >>> long after=new java.util.Date().getTime(); >>> System.out.println("Parsing: "+(after-before)); >>> >> >> If this is the first time the query is parsed, java classloading will >> happen. >> >> I put that code (minus OntologyAcces.PREFIXES) in a loop executes 10 time >> and got: >> >> Parsing: 28 >> Parsing: 1 >> Parsing: 0 >> Parsing: 1 >> Parsing: 0 >> Parsing: 1 >> Parsing: 0 >> Parsing: 1 >> Parsing: 0 >> Parsing: 0 >> >> as you can see, the first time is expensive. >> >> Are you using a laptop? >> >> >> >> >>> QueryExecution qexec = >>> QueryExecutionFactory.**sparqlService(OntologyAcces.**HOST_QUERY, >>> query); >>> >> >> What's OntologyAcces.HOST_QUERY >> >> >> >>> ResultSet results = null; >>> >>> try{ >>> long beforeE=new java.util.Date().getTime(); >>> results = qexec.execSelect(); >>> long afterE=new java.util.Date().getTime(); >>> System.out.println("Execution: "+(afterE-beforeE)); >>> >>> // ResultSetFormatter.out(System.**out, results, query) ; >>> for(;results.hasNext();){ >>> QuerySolution qs = results.nextSolution(); >>> //System.out.println("I'm the subject: >>> "+qs.getResource("s")); >>> >>> } >>> qexec.close(); >>> } catch (Exception e) { >>> e.printStackTrace(); } >>> >>> >>> The parsing is taking up to 1000 ms and te execution is taking up to 200 >>> ms. The triple store answer is not taking much time, the trouble I have >>> is >>> with ARQ specifically. >>> >> >> 200ms to execute to a HTTP operation to a server without a pre-existing >> connection is quite reasonable. There are lots of things that might be >> being done. >> >> Andy >> >> > > > -- > *FEDERICO LÓPEZ GÓMEZ* > Estudiante Ingeniería de Sistemas > Universidad del Valle - Sede Tuluá > > -- *FEDERICO LÓPEZ GÓMEZ* Estudiante Ingeniería de Sistemas Universidad del Valle - Sede Tuluá
