Validate a directory

source · output · proof · check · playground


The question

Does each person have one string name and an integer age of at least eighteen?

Historical background

SHACL became a W3C Recommendation in 2017 for describing and checking the expected shape of RDF data. It gives violations a standard RDF result structure. The directory uses it to express requirements for names and ages and to report which entries fail them. W3C, 2017 SHACL Recommendation

What we tell eyemind

Reusable name and age property shapes target the people in the same Turtle snapshot. The constraints follow W3C SHACL.

What eyemind concludes

Alice conforms. Bob yields two validation results: a missing name and an age below eighteen. The report has sh:conforms false; each result records its focus, source shape, component, path, severity and supplied message.

One conclusion in the JavaScript check report is:

result_rdf(…, iri('http://www.w3.org/ns/shacl#conforms'), literal('false', datatype('http://www.w3.org/2001/XMLSchema#boolean')), 'default_graph')

What the proof establishes

The saved proof is checked against the compiled LS program. It establishes the reported conclusions from the supplied data and rules. Validation and conflict reports are conclusions too; exit code 0 means evaluation completed.

Try it

node bin/eyemind.js --shacl examples/people-shacl.ttl
node bin/eyemind.js --shacl --program examples/people-shacl.ttl > /tmp/people-shacl.js
node bin/eyemind.js --to turtle /tmp/people-shacl.js
node bin/eyemind.js --shacl --check-proof examples/proof/people-shacl.js examples/people-shacl.ttl

Give Bob a name and change his age to 18: the report conforms. These are required-field checks over the completed snapshot; a missing field is a validation result.