Re: SPARQL JS lib, from textual syntax to algebra

On Nov 5, 2015, at 4:16 AM, Ruben Verborgh <ruben.verborgh@ugent.be> wrote:
> 
> Hi Miguel,
> 
>> are you aware of any Javascript library that is able to parse SPARQL and generate a representation based on SPARQL algebra?
> 
> A colleague of mine has extended the SPARQL.js code (https://github.com/RubenVerborgh/SPARQL.js) to output an algebra tree (as opposed to the current syntax tree). We have not released this code yet, but plan to do so.
> 
> We will use this for a next generation of our query engine, which currently follows the syntax tree (but should work with algebra).

The Ruby SPARQL gem parses to a form based on method calls with argument lists compared of method calls. This then becomes directly executable to perform the query. The s-expression serialization is simply a way to save this object form so that it can be re-created easily. We chose the Jena ARQ SSE representation for the algebra. This could have been done in YAML just as easily. Whatever is convenient for saving object trees would work, but SSE helped in development and testing as we could first ensure we create the same SSE before verifying it executes properly.

Gregg

>> My idea would be to leverage Ruben SPARQL parser and then transform his JSON representation of the Abstract Syntax Tree to a representation of the corresponding algebra tree (possibly in JSON too).
> 
> The main thing that needs to be decided is on how to represent such an abstract syntax tree in JSON.
> 
> Best,
> 
> Ruben

Received on Thursday, 5 November 2015 14:50:16 UTC