Re: getting the query from an SXP expression

On 01/12/2021 20:30, Gregg Kellogg wrote:
> (Sorry, previous reply was inadvertently not reply all).
> 
> I recall some discussion about this several years ago, and it may be 
> possible, at least in limited cases. I’m also not aware of any other 
> platforms which use SPARQL S-Expressions which do any de-compilation.

Jena tries to - it's quite pragmatic:

https://github.com/apache/jena/blob/main/jena-arq/src/main/java/org/apache/jena/sparql/algebra/OpAsQuery.java

     Andy

> I had thought that this would be good for the sparql-client gem, which 
> could take an SSE input and turn it into SPARQL Grammar, and for trivial 
> use cases it shouldn’t be too difficult to do, but I never pursued the 
> issue. I’d be happy for someone to look into this further and maybe 
> create a PR, even if it is only a partial solution. To not get lost, it 
> might be good to create an issue in 
> https://github.com/ruby-rdf/sparql-client/issues 
> <https://github.com/ruby-rdf/sparql-client/issues> so that we don’t 
> loose discussions again.
> 
> Typically, the SXP is intended for optimization and execution, not to 
> round trip back to the sparql grammar. There may be some other work on 
> this, but I’m not aware of any. There’s quire a bit of activity in 
> http://rdf.js.org/query-spec/ <http://rdf.js.org/query-spec/>c 
> <https://github.com/rdfjs/query-spec> for that JavaScript community, and 
> there may be some work there that could be leveraged.
> 
> In general, I would welcome more collaboration on the Ruby RDF/SPARQL 
> gems, which have been fairly quiet for a while, other than for basic 
> maintenance. I am planning a 3.2 release, but that will mostly be to 
> maintain dependencies and minimum Ruby versions.
> 
> Gregg Kellogg
> gregg@greggkellogg.net <mailto:gregg@greggkellogg.net>
> 
>> On Dec 1, 2021, at 6:35 AM, Daniel Hernandez <daniel@degu.cl 
>> <mailto:daniel@degu.cl>> wrote:
>>
>>
>> In the previous example I made a mistake it is `parse` instead of `for`
>> (the question is the same).
>>
>> Daniel Hernandez <daniel@degu.cl <mailto:daniel@degu.cl>> writes:
>>
>>> Hi all,
>>>
>>> I am trying to get the SPARQL query of a sse expression.
>>> For instance, if I have
>>>
>>> exp = SPARQL::Algebra::Expression.for "(project (?x) (bgp (triple ?s 
>>> ?p ?x)))"
>>>
>>> then I want the string "SELECT ?x WHERE {?s ?p ?x}".
>>>
>>> Thanks,
>>> Daniel
>>
> 

Received on Wednesday, 1 December 2021 21:13:23 UTC