@shexjs/eval-validator-api
v1.0.0-alpha.31
Published
Shape Expressions triple expression evaluator api - defines how @shexjs/validator invokes regex evaluators.
Downloads
1,249
Readme
@shexjs/eval-validator-api
The interface between @shexjs/validator and its pluggable matching engines: types for compiling a shape's triple expression and matching a node's triples against it, plus what the engine hands back (solutions, errors) and the hooks it calls along the way (semantic-action dispatch, EXTENDS/RESTRICTS handling, no-triple-constraint checks).
The validator walks shape expressions (AND/OR/NOT, node constraints, references); when it reaches a Shape, it asks an engine implementing this API to match the triple expression inside. Two implementations ship with the suite:
@shexjs/eval-threaded-nerr(default) — enumerates every way the data fails to match;@shexjs/eval-simple-1err— stops at the first error.
An engine exports a RegexpModule (a ValidatorRegexModule): compile(schema, shape, index) returns the ValidatorRegexEngine that matches one shape's expression. Select an engine with the validator's regexModule option:
new ShExValidator(schema, db, {
regexModule: require("@shexjs/eval-simple-1err").RegexpModule
});There is nothing to call directly in this package unless you are writing an engine; depend on it for the types and the contract.
Install
npm install @shexjs/eval-validator-api@shexjs/eval-validator-api is one of the shex.js packages; installing shex pulls in the whole suite, and its README maps them.
