On 22 Mar 2013, at 17:01, Diogo FC Patrao <[email protected]> wrote:
> I'm rendering back the query, implementing the OpAsQuery missing methods.
> However I got another doubt, check the query below:
>
> select ?p count( ?b ) { ?p a <http://marafo.com#Paciente>. ?a <
> http://marafo.com#tem> ?b. LET ( ?marafo := ?b+1 ) } group by ?p
>
>
> The generated algebra is:
>
> (project (?p ?.1)
>
> (assign ((?.1 ?.0))
>
> (group (?p) ((?.0 (count ?b)))
>
> I didn't get why is there this "(assign (?.1 ?.0) ) " thing... can someone
> enlighten me?
AFAIK it's simply an artifact of way the compiler works.
OpAsQuery handles this by remembering the aggregation as it goes (in
varExpression) and undoes the split later:
<https://github.com/apache/jena/blob/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/OpAsQuery.java#L523>
<https://github.com/apache/jena/blob/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/algebra/OpAsQuery.java#L56>
Damian