Debian Codegraph @

src/prov/tests/schemas/README.md

raw
1 # Vendored W3C PROV conformance schemas
2
3 These schema files are vendored so the `test_xml_schema.py` and
4 `test_json_schema.py` modules can validate `prov`'s serializer output against
5 the official PROV-XML schema and the PROV-JSON member submission's JSON
6 schema **offline** (no network access required in CI). They are unmodified
7 except for one XSD `schemaLocation` rewritten from an absolute `w3.org` URL
8 to a relative, in-tree path (noted below) so the XSD set forms a closed,
9 offline-resolvable set; `prov-json.schema.json` is byte-for-byte the
10 submission's schema (pretty-printed) with no rewrites needed (it has no
11 external `$ref`s).
12
13 ## Files and sources
14
15 | File | Source URL | Retrieved |
16 |-------------------------|----------------------------------------------------------------------|------------|
17 | `prov.xsd` | <https://www.w3.org/ns/prov.xsd> | 2026-07-10 |
18 | `prov-core.xsd` | <https://www.w3.org/ns/prov-core.xsd> | 2026-07-10 |
19 | `prov-dictionary.xsd` | <https://www.w3.org/ns/prov-dictionary.xsd> | 2026-07-10 |
20 | `prov-links.xsd` | <https://www.w3.org/ns/prov-links.xsd> | 2026-07-10 |
21 | `xml.xsd` | <https://www.w3.org/2001/xml.xsd> | 2026-07-10 |
22 | `prov-json.schema.json` | <https://www.w3.org/submissions/prov-json/schema> | 2026-07-10 |
23
24 `prov.xsd` is the entry point referenced by the PROV-XML specification
25 (<https://www.w3.org/TR/prov-xml/>); it `xs:include`s `prov-core.xsd`,
26 `prov-dictionary.xsd`, and `prov-links.xsd`. `prov-core.xsd` in turn
27 `xs:import`s the standard XML-attributes schema (`xml:lang`/`xml:base`/etc.),
28 which is vendored here as `xml.xsd`. That import's `schemaLocation` was
29 rewritten from `http://www.w3.org/2001/xml.xsd` to the relative `xml.xsd` so
30 `lxml.etree.XMLSchema` can compile the whole set without any network access.
31 No other `schemaLocation` values were changed — the `prov-core.xsd` /
32 `prov-dictionary.xsd` / `prov-links.xsd` includes were already relative
33 filenames in the upstream documents.
34
35 `prov-core.xsd` also declares (but never uses) an `xs:import` for the
36 `http://www.w3.org/1999/xhtml/datatypes/` namespace with no `schemaLocation`;
37 this is harmless (no element or type from that namespace is actually
38 referenced) and was left as-is.
39
40 Closure was verified by grepping every vendored file for `schemaLocation=`
41 and `xs:import`/`xs:include` elements and confirming each target is itself
42 vendored in this directory; see the roadmap step 30 audit notes
43 (`docs/superpowers/specs/2026-07-10-conformance-audit-findings.md`, §3.1)
44 for the verification transcript.
45
46 `prov-json.schema.json` is the schema linked from §2.3 ("Validating PROV-JSON
47 Documents") of *A JSON Representation for the PROV Data Model* (the PROV-JSON
48 member submission, <https://www.w3.org/submissions/prov-json/>), retrieved
49 from the URL that section links to
50 (<https://www.w3.org/submissions/prov-json/schema>). It declares
51 `"$schema": "http://json-schema.org/draft-04/schema#"` — `jsonschema>=4`
52 still ships a `Draft4Validator`, so it is used as-is (no upgrade/rewrite);
53 `test_json_schema.py` selects the validator dynamically via
54 `jsonschema.validators.validator_for(schema)` rather than hard-coding that
55 draft. Two authoring quirks in the schema itself were noted during the audit
56 (not fixed here — the file is vendored verbatim) and are recorded in
57 `docs/superpowers/specs/2026-07-10-conformance-audit-findings.md` §3.2: the
58 `wasEndedby` property key (both at the document root and inside
59 `definitions.bundle`) is misspelled — the submission's own prose (§3.2.5) and
60 `prov`'s serializer both use `wasEndedBy` — and the document-root object sets
61 `"additionalProperties": false` while `definitions.bundle` does not, so a
62 `mentionOf` relation (a PROV-Links extension postdating this submission, and
63 therefore absent from the schema entirely) is only accepted inside a named
64 bundle, not at the document root.
65
66 ## Licence
67
68 The XSD files are W3C Recommendation-track normative schemas; the PROV-JSON
69 schema is linked from a W3C Member Submission (not Recommendation-track, but
70 published under the same W3C document terms). All are redistributed here as
71 permitted under the **W3C Software and Document Licence**:
72 <https://www.w3.org/copyright/software-license-2023/> (formerly
73 <https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document>).
74 They are copyright © World Wide Web Consortium (MIT, ERCIM, Keio, Beihang)
75 and are included unmodified (aside from the single XSD relative-path rewrite
76 noted above) for the sole purpose of offline schema validation in this
77 project's test suite.