You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Laurent Pellegrino <la...@gmail.com> on 2012/07/10 16:58:11 UTC

Query manipulation and serialization questions

Hello,

I am manipulating Query objects and I was wondering if there is an
utility class that transforms directly a SortCondition (retrieved
through Query#getOrderBy()) to its associated Op operator? Same
question for ElementFilter?

Is there something similar to Transformers (provided for algebra
transformation) but for Elements?

Finally, is there a class that can serialize/deserialize SortCondition
and ElementFilter objects? Otherwise, if I switch to the algebra, is
there a class that can serialize/deserialize any Op?

Kind Regards,

Laurent

Re: Query manipulation and serialization questions

Posted by Laurent Pellegrino <la...@gmail.com>.
> To and from a Query oor to and from a string?

The former, to and from a Query (or an object retrieved from a Query).

Thank you Andy.

Laurent

On Tue, Jul 10, 2012 at 10:26 PM, Andy Seaborne <an...@apache.org> wrote:
> On 10/07/12 15:58, Laurent Pellegrino wrote:
>>
>> Hello,
>>
>> I am manipulating Query objects and I was wondering if there is an
>> utility class that transforms directly a SortCondition (retrieved
>> through Query#getOrderBy()) to its associated Op operator? Same
>> question for ElementFilter?
>
>
> Expressions don't need translation - the AST produced by the parser (the E_*
> classes) is the algebra form.
>
> See
>
> AlgebraGenerator.compileModifiers
>
>
>> Is there something similar to Transformers (provided for algebra
>> transformation) but for Elements?
>
>
> There is a visitor pattern but not a transformation pattern on top of that.
>
>
>>
>> Finally, is there a class that can serialize/deserialize SortCondition
>> and ElementFilter objects?
>
>
>
>> Otherwise, if I switch to the algebra, is
>> there a class that can serialize/deserialize any Op?
>
>
> To and from a Query oor to and from a string?
>
> == serialize/dersialize an Op
> as an algebra syntax:
>
> SSE.write
> SSE.parseOp
>
>
> == Query
>
> OpAsQuery does a fairly good job.
>
> 1/ It is possible to write algebra expressions for which there is no query
> 2/ OpAsQuery isn't perfect.
>
>>
>> Kind Regards,
>
>
>
>>
>> Laurent
>>
>
>

Re: Query manipulation and serialization questions

Posted by Andy Seaborne <an...@apache.org>.
On 10/07/12 15:58, Laurent Pellegrino wrote:
> Hello,
>
> I am manipulating Query objects and I was wondering if there is an
> utility class that transforms directly a SortCondition (retrieved
> through Query#getOrderBy()) to its associated Op operator? Same
> question for ElementFilter?

Expressions don't need translation - the AST produced by the parser (the 
E_* classes) is the algebra form.

See

AlgebraGenerator.compileModifiers

> Is there something similar to Transformers (provided for algebra
> transformation) but for Elements?

There is a visitor pattern but not a transformation pattern on top of that.

>
> Finally, is there a class that can serialize/deserialize SortCondition
> and ElementFilter objects?


> Otherwise, if I switch to the algebra, is
> there a class that can serialize/deserialize any Op?

To and from a Query oor to and from a string?

== serialize/dersialize an Op
as an algebra syntax:

SSE.write
SSE.parseOp


== Query

OpAsQuery does a fairly good job.

1/ It is possible to write algebra expressions for which there is no query
2/ OpAsQuery isn't perfect.

>
> Kind Regards,


>
> Laurent
>