The ShEx Test extension is a very simple extension intended for testing ShEx extension frameworks. Test participates in validate and has side-effects.

Example

The Test extension has two functions:

Example input schema with ShEx Test directives and input data:

PREFIX schema: <http://schema.org/>
PREFIX eval: <http://shex.io/extensions/Eval/>
BASE <http://schema.org/shex>

<#Recipe> EXTRA a {
    a [schema:Recipe];
    schema:datePublished .  
        %eval:{
          const val = ShEx.RdfTerm.getLiteralValue(ctx.object);
          isNaN(Date.parse(val))
            ? [{type: "SemActViolation", message: `"${val} is not a date`}]
            : []
        %}
}

PREFIX schema: <http://schema.org/>

<http://example.org/recipe>
  a schema:Recipe ;
  schema:datePublished "2020-01-01xx".

Definition

Eval's semantics are entirely dependent on the host language and API.

Parsing

Eval is evaluated by the host lanugage's eval function or its equivalent.

langaugeplatform/APIpackagesource
javascript shexjs packaged src

Issues

edited by: Eric Prud'hommeaux