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