shexTest

NPM Version ShapeExpressions Gitter chat https://gitter.im/shapeExpressions/Lobby

Try the test viewer.

shexTest

Directories:

schemas

The ShExC and ShExJ files with the same stem name are equivalent. A ShExC syntax test consists of these steps:

negativeSyntax

These tests violate the ShEx2 grammar.

negativeStrucutre

These tests should raise errors when parsed, noting the rule about nested ValueAnd and ValueOr expressions.

validation

A ShEx validator is logic-conformant when it returns success for the tests of type ValidationTest and failure for the tests of type ValidationFailure. A ShEx validator is result-conformant (experimental) when it executes as ValidationTest and produces the same result structure as produced by this procedure:

coverage

One frequently wants to ask “does the test suite include X”. One way to test that is to guess by the relatively formulaic filenames and test names in validation/manifest. Another is to “grep” through the JSON representations of the queries for something with the appropriate structure, e.g. using jq to EachOfs that include a pattern with a min cardinality of 0:

(for f in schemas/*.json; do
  jq -e '.[]|..|objects|select(.type=="EachOf").expressions[]|select(.min==0)' $f > /dev/null &&
  echo $f;
  done
)

which yields the files which include this pattern:

schemas/1val1IRIREFExtra1Or.json
schemas/3circularRef1.json
schemas/kitchenSink.json

validation-contrib and schemas-contrib

doc

Grammars for the three renderings of a ShEx schema, and the pieces that relate them:

Manifests: manifest and manifest-ld

Each suite directory has two manifests – two resources, each with its representations:

Each manifest-ld.yaml says what its directory’s manifest.ttl says, in that format:

"@context":
  - https://www.w3.org/ns/shex-manifest.jsonld
  - https://www.w3.org/ns/shex-test.jsonld
comment: "ShEx validation tests"
entries:
  ## empty {
  - name: "0_empty"
    status: conformant
    trait: [Empty]
    comment: "<S1> {  } on {  }"
    approval: Approved
    schemaURL: ../schemas/0
    shape: http://a.example/S1
    dataURL: empty.ttl
    node: http://a.example/dummy

The scripts, with bin/manifest-ld-terms.js as the one table of which key is which legacy predicate:

shex.js’s validation and parser suites read manifest-ld wherever a corpus has it, and its packages/shex-manifest/test/TestSuiteManifest-test.js checks that these manifests are the format of shex.js’s own examples manifests:

Two things a reader of the graph should know. An entry is identified by its name, not by an IRI, so a reference from one test to another (sameSemanticsAs: "#1dotRefLNex1", 23 of them) names an IRI the YAML’s graph says nothing else about; bin/manifest-ld-to-legacy-ttl.js gives each entry that IRI, <#name>, in the Turtle. And the two contexts are published only once w3c/ns takes them: until then https://www.w3.org/ns/shex-manifest.jsonld and https://www.w3.org/ns/shex-test.jsonld are found in a w3c/ns checkout (shex.js carries a copy of both).