On 29/10/12 16:31, John Liu wrote:
Thank you very much Andy for your quick action.

It will be in tonight's snapshot build of 2.7.5-SNAPSHOT (it builds at about 
05:00 UTC)

When will Jena 2.7.5 be released?

We have just release 2.7.4 so not immediately.

We do, as a project, practice de facto, "green trunk" i.e. the trunk is in a state to be released (svn code trunk and nightly build, which is a build of trunk). The code even stamps the exact snapshot build and build timestamp to identify precisely which code it is.


Not all algebra expressions can be turned into a query. If you are
manipulating the algebra, you can create forms OpAsQuery does not recognize.

Can I assume that all ops which are compiled from a sparql query can
be turned back to a sparql query? For example, the following codes are
always working fine:

Yes but test. The idea is any valid query will be reversed into an equivalent query (equivalent => same answers ; it may not test .equals with the input - surface details have been lost in the algebra). It is a pragmatic reconstruction of an equivalent query, not a theoretically proven process.


           AlgebraGenerator ag = new AlgebraGenerator();
           Op op = ag.compile(query);

Op op = Algebra.compile(query) ;

           Query query2 = OpAsQuery.asQuery(op);


The reason why we use these functions is that we want to add filters
into the query in runtime, for example modifying the op by adding a
filter expression (op = OpFilter.filter(e, op);), is this the best
way to do that(adding a filter)?

Do you need to turn it back into query syntax? You can directly execute the algebra after modification.

        Andy


Thanks, John




________________________________
  From: Andy Seaborne <[email protected]>
To: [email protected]
Sent: Friday, October 26, 2012 6:19:00 PM
Subject: Re: ARQNotImplemented exception thrown by ARQ function calls

Oversight - I've just implemented it (it's not hard!).  It wil be in
tonight's snapshot build of 2.7.5-SNAPSHOT (it builds at about 05:00 UTC)

https://repository.apache.org/content/repositories/snapshots/org/apache/jena/apache-jena/

By the way, you can execute algebra expressions directly:

DatasetGraph dsg = ...
QueryIterator qIter = Algebra.exec(op, dsg) ;

Not all algebra expressions can be turned into a query. If you are
manipulating the algebra, you can create forms OpAsQuery does not recognize.

     Andy

On 26/10/12 22:24, John Liu wrote:
I use some Jena arq apis to modify the query for adding filter in runtime.

The query is

PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX onto: <http://dbpedia.org/ontology/>
SELECT * WHERE {
?p a onto:Place .
?p geo:l* ?loc .
}

There is valid card in the line "?p geo:l* ?loc ."

The funcations I used are:

       AlgebraGenerator ag = new AlgebraGenerator();
       Op op = ag.compile(query);
       op = OpFilter.filter(e, op);
       Query query2 = OpAsQuery.asQuery(op);

This query causes an ARQNotImplemented exception thrown in the last function 
call. The exception stack trace is:

com.hp.hpl.jena.sparql.ARQNotImplemented error occurred when handling the REST 
data service.
Not implemented: OpPath
    at 
com.hp.hpl.jena.sparql.algebra.OpAsQuery$Converter.visit(OpAsQuery.java:224)
    at com.hp.hpl.jena.sparql.algebra.op.OpPath.visit(OpPath.java:73)
    at 
com.hp.hpl.jena.sparql.algebra.OpAsQuery$Converter.asElementGroup(OpAsQuery.java:97)
    at 
com.hp.hpl.jena.sparql.algebra.OpAsQuery$Converter.asElement(OpAsQuery.java:88)
    at 
com.hp.hpl.jena.sparql.algebra.OpAsQuery$Converter.visit(OpAsQuery.java:168)
    at com.hp.hpl.jena.sparql.algebra.op.OpSequence.visit(OpSequence.java:75)
    at 
com.hp.hpl.jena.sparql.algebra.OpAsQuery$Converter.visit(OpAsQuery.java:473)
    at com.hp.hpl.jena.sparql.algebra.op.OpSlice.visit(OpSlice.java:50)
    at 
com.hp.hpl.jena.sparql.algebra.OpAsQuery$Converter.asElementGroup(OpAsQuery.java:97)
    at 
com.hp.hpl.jena.sparql.algebra.OpAsQuery$Converter.asElement(OpAsQuery.java:88)
    at 
com.hp.hpl.jena.sparql.algebra.OpAsQuery$Converter.visit(OpAsQuery.java:310)
    at com.hp.hpl.jena.sparql.algebra.op.OpFilter.visit(OpFilter.java:110)
    at com.hp.hpl.jena.sparql.algebra.OpAsQuery.asQuery(OpAsQuery.java:50)

The arq library I used is jena-arq-2.9.1 and the jean is jena-core-2.7.1

My question is if this is bug in the arq functions? I have tested these 
functions without adding the filter(the third call), but it still throws the 
exception.

If it isa bug, how can I file a defect to it?

If it is not, how can I fix my code to avoid this exception.

Thanks a lot for your help.

John


Reply via email to