npm.io
1.0.0-alpha.33 • Published 2 weeks ago

@shexjs/eval-validator-api

Licence
MIT
Version
1.0.0-alpha.33
Deps
2
Size
47 kB
Vulns
0
Weekly
0
Stars
62

@shexjs/eval-validator-api

npm version CI

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:

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.

Keywords