SPARQL AST
Status: WIP. Everything is subject to change. This is currently a quick & dirty
implementation of the minimal subset of SPARQL needed to implement the filter
language in sparql-rest
. The intent is to eventually support typed, in-memory
representation of the full abstract SPARQL abstract algebra (not preserving
insignificant syntactical details). See
§18 “Definition of SPARQL”
and in particular
§18.2 “Translation to the SPARQL Algebra”
This is not a parser but would be suitable for use as a parser output format in cases where exact syntax does not need to be preserved.
Motivation
Provide a basis for type safe operations on and serialization of SPARQL expressions. Intended applications include term rewriting systems.
Features
The package provides:
-
types: types for representing abstract SPARQL expressions
-
serialization : safe sparql serialization mapping JSON API documents and resources to record-type objects
-
possible TBD's: equivalency tests, common transforms (e.g. skolemization or other ops on open expressions)
Design
TBD
Roadmap
Should use a reified grammar (i.e. concrete data that can generate TS types, versus using TS as source of truth).
Related work
The SPIN vocabulary is a SPARQL-in-RDF representation, which should be consulted.
- SPARQLAlgebra.js: a "SPARQL to SPARQL Algebra converter"