The building blocks that the SPARQL expression evaluation actors of Comunica are made of: the internal term representation, the type system, and the errors of expression evaluation.
This module is part of the Comunica framework, and should only be used by developers that want to build their own query engine.
Click here if you just want to query with Comunica.
To evaluate expressions rather than implement them, use Comunica SPARQL Expressions.
Learn more about expression evaluation.
$ yarn add @comunica/utils-expression-evaluator
Term and its subclasses (Literal, NumericLiteral, LangStringLiteral, DateTimeLiteral, ...),
Operator, Aggregate, Existence and Variable, the representation that evaluation works on,
together with the TermTransformer that creates terms from RDF/JS terms.declare and its Builder: define a function with overloads, backed by an OverloadTree
that resolves the implementation matching the argument types.TypeURL, TypeAlias, KnownLiteralTypes, isSubTypeOf and typedLiteral.SparqlOperator, NamedOperator, KnownOperator and GeneralOperator.ExpressionError and its subclasses, together with isExpressionError to recognize them.
These are the errors that are expected during evaluation, and that FILTER and ORDER BY respond to differently.parseDateTime, parseDuration, toUTCDate,
addDurationToDateTime, ...prepareEvaluatorActionContext: derives the context entries an evaluator needs from the ones it was given.SPARQL algebra expressions are transformed into the internal representation of this package by the
AlgebraTransformer,
after which the evaluator recursively evaluates them.
Tests for functions built on these utilities are written as test tables;
see @comunica/utils-jest.