Skip to content

YAML-LD manifests in place of the authoritative Turtle - #91

Merged
ericprud merged 2 commits into
mainfrom
manifest-refactor
Oct 10, 2026
Merged

ericprud merged 2 commits into
mainfrom
manifest-refactor

Conversation

@ericprud

@ericprud ericprud commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Beside each */manifest.ttl, a manifest.yaml that says the same thing:

  • bin/ttl2yamlld.js writes it from the Turtle heuristically -- a transliteration of the token stream (a comment-keeping lexer, a parser for the shape a manifest has, an emitter driven by the context), not a parse to a graph and back -- so every comment comes across, where it was. The mf:entries collection and the definitions become one list of the tests themselves, in the collection's order.
  • manifest-context.jsonld is the context under which that YAML is, as JSON-LD, the same RDF graph as the Turtle. context.jsonld is not: it maps schema, data, shape and focus into sx: where the Turtle says sht:, and has no term for trait.
  • bin/yaml2jsonld.js writes from the YAML the manifest.jsonld that bin/genJSON.js writes from the Turtle, byte for byte, for all five manifests.

shex.js (branch manifest-refactor) holds the evidence: packages/shex-manifest/test/TestSuiteManifest-spike-test.js checks, per manifest, that the YAML is what the converter writes, carries every comment line, is the Turtle's graph (canonical N-Quads equal), and derives the committed manifest.jsonld; and TEST_yaml_manifest=true runs its validation and parser suites (5708 tests) from the YAML.

js-yaml joins the devDependencies for yaml2jsonld's command line.

vocab: mk_vocab.js maintains a second vocabulary, the ShEx manifest vocabulary

http://www.w3.org/ns/shex-manifest#, from vocab/manifest-vocab.csv: what a manifest of ShEx validations is written in -- Manifest and Entry, entries (an ordered list), name, an entry's schema, data and queryMap with their ...URL (by reference) and ...Label spellings -- with a context that also has comment (rdfs:comment) and node, shape and status aliased to the ShEx vocabulary's own shape-map terms. The test suite's manifests and implementations' example manifests share it.

mk_vocab.js takes --vocab shex|shex-manifest; what was hard-wired to the ShEx vocabulary (prefix, title, description, file names, the page's abstract) is per-vocabulary configuration. The ShEx outputs are byte-identical before and after.

Feature: the manifests in the ShEx manifest vocabulary, the legacy Turtle generated from them

manifest.yaml (beside each */manifest.ttl) is no longer the Turtle transliterated: it is the manifest in the format implementations use for their own examples -- the ShEx manifest vocabulary (https://www.w3.org/ns/shex-manifest, vocab/manifest-vocab.csv) plus this suite's terms (manifest-context.jsonld) -- so the legacy expression goes:

  • no test is typed: a validation test is an entry with a status, conformant or nonconformant; a schema that must be rejected says how (schemaError: syntax | structure); a representation test names its schema's three serializations;
  • an entry is named (name), its inputs are its own (no mf:action node), and approval is what mf:status was;
  • entries is one list of the tests themselves, in mf:entries order;
  • no @base: a reference is relative to the manifest.

bin/manifest-terms.js is the one table of which key is which legacy predicate. bin/ttl2yamlld.js (the migration, comments carried across) reads it one way; bin/yaml2ttl.js, new, and bin/yaml2jsonld.js read it the other way and write the legacy manifest.ttl and manifest.jsonld from the YAML. For all five manifests the generated Turtle's graph is the original's and the generated manifest.jsonld is the committed file byte for byte, so nothing was lost; shex.js's test checks it.

Quirks of the Turtle carried so that it can be written back: one test whose mf:name is not its fragment keeps both; mf:proposed/mf:Proposed stay distinct approval values; negativeStructure's mf:comment arcs stay mf:comment.

Feature: a blank-node or literal focus is a query map, not a node

node and shape are IRI references. A focus node that is a blank node or a literal (31 validation tests), or a shape that is a blank node, is now written as a ShapeMap association -- queryMap: "_:abcd@http://a.example/S1" -- because that is text. As a JSON-LD node reference a blank node's label does not survive (a processor relabels it), and the label is what those tests are about; a literal is no reference at all.

bin/manifest-terms.js parses and writes the association; yaml2ttl and yaml2jsonld put sht:focus and sht:shape back from it. The generated Turtle and manifest.jsonld are still the originals, graph for graph and byte for byte.

Feature: README says what shex.js checks of the YAML manifests, and what a reader of their graph should know

The claim that shex.js's validate runs validation/manifest.yaml as it runs its own examples was loose: validate runs the entries but does not compare them with their status. What is checked (shex.js, branch manifest-refactor, packages/shex-manifest/test/TestSuiteManifest-spike-test.js): each manifest read as JSON-LD drops nothing; @shexjs/manifest reads all five, plainly and as JSON-LD, into the same entries; and shex.js's examples runner gets the stated status for the 1239 of 1309 validation entries that need only what an example does.

Also notes that an entry is identified by its name, so the 23 test-to-test references are IRIs the YAML's own graph does not describe (the generated Turtle does), and that the contexts are published only once this is.

Eric Prud'hommeaux and others added 2 commits October 9, 2026 15:26
…eside the original manifest

Each suite directory (schemas, validation, negativeSyntax,
negativeStructure, validation-contrib) gets a second manifest.  The first,
`manifest`, keeps its name and its structure -- manifest.ttl, and the
manifest.jsonld bin/genJSON.js writes from it -- so the tools that read it
need not change.  The second, `manifest-ld`, is the same tests in the
YAML-LD format ShEx implementations use for their own example manifests:

  manifest-ld.yaml    the text to edit, comments and all
  manifest-ld.jsonld  its JSON: the same JSON-LD document, without comments
  manifest-ld.ttl     its RDF graph, as Turtle

Two structures are two resources, so no resource has representations that
disagree.  References stay relative in all three, as the YAML writes them.

In manifest-ld nothing types a test: a validation test is an entry with a
`status` (conformant or nonconformant); a schema that must be rejected says
how (`schemaError: syntax` or `structure`) and where (startRow ...
endColumn); a representation test names the schema's other serializations
(shexjURL, shexrURL).  An entry is named and its inputs are its own (no
mf:action node); `approval` is what mf:status was; a focus that is a blank
node or a literal (31 tests) is a ShapeMap `queryMap`, since a blank node's
label does not survive a JSON-LD reading; `entries` is one list of the
tests themselves, in the original mf:entries order.

Its terms are two W3C vocabularies, generated by vocab/mk_vocab.js (now
per-vocabulary, `--vocab shex | shex-manifest | shex-test`; the ShEx
vocabulary's outputs are unchanged) into a w3c/ns checkout with --nsdir:

- the ShEx manifest vocabulary, http://www.w3.org/ns/shex-manifest#
  (vocab/manifest-vocab.csv): entries, name, schema/data/queryMap with
  their ...URL and ...Label spellings, comment, and node, shape and status
  aliased to the ShEx vocabulary's -- what example manifests share;
- the ShEx test vocabulary, http://www.w3.org/ns/shex-test#
  (vocab/test-vocab.csv): what a test says beyond that -- trait (plain
  names), approval, schemaError and where, shexj/shexr, sameSemanticsAs,
  result, semActs, shapeExterns, extensionResults -- with seeAlso and
  wasDerivedFrom aliased to rdfs: and prov:.

negativeStructure's seven mf:comment keys, carried from the Turtle as they
were, are terms of neither; that manifest binds mf: in its own @context.

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

- bin/ttl2yamlld.js wrote manifest-ld.yaml from manifest.ttl, from the
  Turtle's token stream rather than its graph, so every comment came
  across where it was;
- bin/yaml2ttl.js and bin/yaml2jsonld.js write the original structure from
  the YAML: the Turtle is the graph of manifest.ttl, and manifest.jsonld is
  the committed file byte for byte, for all five manifests;
- bin/manifest-ld.js (`npm run manifest-ld`) writes manifest-ld.jsonld and
  manifest-ld.ttl from the YAML, having checked that the Turtle is the
  graph a JSON-LD processor reads from it; `npm run manifest-ld-check` is
  in `npm test` and CI.

shex.js's packages/shex-manifest/test/TestSuiteManifest-test.js checks all
of this, and that shex.js reads manifest-ld as it reads its own examples;
its validation and parser suites read manifest-ld where a corpus has it.
js-yaml joins the devDependencies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pe, the suite's own checks, the scripts named for it, skills

The ShEx test vocabulary (vocab/test-vocab.csv) gains shexc/shexcURL, so a
schema test names each of its representations outright -- shexcURL,
shexjURL, shexrURL -- in schemas, negativeSyntax and negativeStructure.  A
validation test's schemaURL names the schema without its representation's
extension (`../schemas/0`, where the Turtle has `<../schemas/0.shex>`), so
that a server can negotiate the representation and a reader can ask for
the one it wants; shex.js tries .shex, .json and .ttl, in that order.  The
suite's schemas have always been ShExC files, so the legacy writers put the
.shex back (kind `negotiable`; withoutExtension / withShExC).

What the Test extension's actions must print was the test vocabulary's
extensionResults, a list of ExtensionResult nodes.  It is the extension's
to define, so it is now its manifest scope,
https://shexspec.github.io/extensions/Test/manifest-context.jsonld
(shexSpec/extensions, branch test-prints), which the validation manifest
binds the way implementations' example manifests bind an extension's:
`tst: http://shex.io/extensions/Test/#` and `tst:parms: {"@context": ...}`
in its @context, `tst:parms: {prints: [...]}` in an entry -- each line a
string, or {extension, line} for an action dispatched on another IRI in the
extension's namespace (1dotNoCode3_pass's #a, #b, #c).  ExtensionResult,
extensionResults, extension and prints leave the vocabulary.
bin/manifest-ld.js resolves such a property-scoped context from a sibling
shexSpec/extensions checkout, or fetches it from where it is published.

The suite checks its own manifests.  Whether each manifest-ld.yaml says
what its manifest.ttl says, and whether the legacy files are derivable from
it, was checked only by shex.js, and there only when the shexTest checkout
beside it was on this branch.  bin/manifest-ld-legacy-check.js (`npm run
manifest-ld-legacy-check`, in npm test and CI) checks it here: the YAML
says what it says without the legacy expression; it is what the migration
writes from the Turtle and carries every comment line; the legacy Turtle's
graph and manifest.jsonld, byte for byte, follow from it; read as RDF it
says nothing in the suite's old namespace, every predicate in a vocabulary
a manifest stacks.  Six seconds for the five.

The scripts of the manifest-ld format are named for it, and the ones that
cross to the legacy structure say so: bin/manifest-ld-from-legacy.js
(the migration, was ttl2yamlld.js), bin/manifest-ld-to-legacy-ttl.js
(was yaml2ttl.js), bin/manifest-ld-to-legacy-jsonld.js (was yaml2jsonld.js;
shex.js's suites project through it), bin/manifest-ld-terms.js (the table
they share, was manifest-terms.js), bin/manifest-ld-legacy-check.js;
bin/manifest-ld.js and bin/genJSON.js keep their names.

Two skills, .claude/skills/shextest-manifest-ld and
.claude/skills/shextest-vocabularies, hold what a session needs to know
to change a test or a vocabulary: which manifest is the source, the scripts
and checks, what an entry says, the CSVs and mk_vocab.js, owl:versionInfo,
what belongs where, publishing to w3c/ns.

The five manifest-ld.yaml are regenerated from their Turtle, and their
.jsonld and .ttl from them; manifest.ttl's graph and manifest.jsonld are
what they were, the JSON byte for byte, for all five.  shex.js's examples
runner now runs 1258 of validation's 1309 as examples, the semantic-action
tests among them, with the Test extension registered as an example's plugin
would be and its output checked against tst:parms (README).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ericprud ericprud changed the title SPIKE: YAML-LD manifests in place of the authoritative Turtle YAML-LD manifests in place of the authoritative Turtle Oct 9, 2026
@ericprud
ericprud marked this pull request as ready for review October 10, 2026 04:45
@ericprud
ericprud merged commit b54592b into main Oct 10, 2026
2 of 3 checks passed
ericprud pushed a commit that referenced this pull request Oct 10, 2026
Conflicts in package.json and .github/workflows/ci.yml: main had appended
manifest-ld-check and manifest-ld-legacy-check to `test` (before test-ts) and
added them as workflow steps; this branch had removed test-ts and made the
workflow call `npm test`. Resolved by keeping both checks in `test` and
listing them in the comment above the single `npm test` step; their separate
steps go, as the other checks' did, since `npm test` runs them.
ericprud pushed a commit that referenced this pull request Oct 10, 2026
Renamed to match the two skills #91 added (shextest-manifest-ld,
shextest-vocabularies): the maintainer's skills from sibling repos are
collected in one place, where bare names would collide.

  ci-red -> shextest-ci-red          manifests -> shextest-manifests
  changing-the-grammar -> shextest-grammar
  shexj-types -> shextest-shexj-types
  adding-a-check -> shextest-checks  repo-history -> shextest-history

And brought up to date with manifest-ld: a test is now named in
manifest-ld.yaml too, and an "@id" there is the id/name mismatch carried
over; editing manifest.ttl means regenerating the jsonld, the YAML and its
two renderings, in that order; manifest-ld-check and manifest-ld-legacy-check
have rows in the red-CI table; the three vocab CSVs are told apart.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant