Consume the ontology
The practical guide for a machine consumer of the schema-derived ontology: which prefixes and namespaces to bind, how to query the graph, how the IRIs dereference, how to validate your own data against the shapes, and where to download the Turtle. Everything here is against the committed corpus — the same TTLs the published reference is generated from.
Prefix & namespace map
Bind these prefixes to read or query the ontology. The OPDA terms split across four
kind-keyed namespaces (ADR-0006, as-built): terms, schemes, shapes, and
the named graphs each live under their own path beneath opda.org.uk/pdtf/.
The remaining prefixes are the standard external vocabularies the model reuses
(referenced, not imported — see Decision
provenance).
| Prefix | Namespace IRI | What it holds |
|---|---|---|
opda: | https://opda.org.uk/pdtf/ | OWL classes & properties (the term namespace). |
opda-v: | https://opda.org.uk/pdtf/scheme/ | SKOS concept schemes & coded values (the vocabulary namespace). |
| (shapes) | https://opda.org.uk/pdtf/shape/ | SHACL node / property shapes & overlay profiles. |
| (graphs) | https://opda.org.uk/pdtf/graph/ | The named graphs — class, shapes, annotation, and the derived inferred/entailment graph. |
| (harness) | https://opda.org.uk/pdtf/harness/ | Governance / decision records (ODR & ADR IRIs). |
sh: | http://www.w3.org/ns/shacl# | SHACL constraint vocabulary. |
dash: | http://datashapes.org/dash# | DASH SHACL extensions (UI / suggestion hints). |
dct: | http://purl.org/dc/terms/ | Dublin Core — the dct:source provenance contract. |
prov: | http://www.w3.org/ns/prov# | PROV-O — claims / evidence / derivation backing. |
skos: | http://www.w3.org/2004/02/skos/core# | SKOS — concept schemes & labels. |
dpv: | https://w3id.org/dpv# | Data Privacy Vocabulary — class-level co-annotation (referenced, not imported). |
dpv-pd: | https://w3id.org/dpv/pd# | DPV personal-data taxonomy — PII category annotations. |
The kind-split (separate /, /scheme/, /shape/,
/graph/, /harness/ paths) is the ADR-0006 as-built decision; it
is what keeps a class IRI, the SKOS scheme that types its values, and the SHACL shape that
constrains it from colliding in one flat namespace.
Runnable SPARQL
Run these against a triplestore loaded with opda-merged.ttl (the GRLC API
over Fuseki via make serve-data exposes the same graph at
http://localhost:3031/opda/sparql). Both queries use real terms from the
corpus.
1 — list every OWL class with its label and source provenance:
PREFIX opda: <https://opda.org.uk/pdtf/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dct: <http://purl.org/dc/terms/>
SELECT ?class ?label ?source WHERE {
?class a owl:Class .
OPTIONAL { ?class rdfs:label ?label }
OPTIONAL { ?class dct:source ?source }
}
ORDER BY ?class 2 — find the substantive (Category-G) leaves a form's overlay profile binds — here the BASPI5 profile, walking from each property shape to its constrained path:
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?shape ?targetClass ?path ?datatype WHERE {
?shape a sh:NodeShape ;
sh:targetClass ?targetClass ;
sh:property ?p .
?p sh:path ?path .
OPTIONAL { ?p sh:datatype ?datatype }
}
ORDER BY ?targetClass ?path
The second query reads the shapes graph (opda-shapes-merged.ttl);
SHACL Play! renders the same constraints as readable tables on the
bake-off page.
Dereferenceability & content negotiation
OPDA term IRIs are HTTPS, under a single registered authority
(opda.org.uk/pdtf/…), so they are designed to be dereferenceable: a term IRI
is a real, resolvable web address rather than an opaque identifier. The intended contract
is standard linked-data content negotiation —
Accept: text/turtle(orapplication/rdf+xml,application/ld+json) returns the machine description of the term;Accept: text/htmlreturns the human-readable reference page.
The LeaseTerm class and leaseTerm property keep their exact source-model identifiers but use distinct lowercase, type-scoped static representation paths.
Until the production endpoint serves negotiated representations, the authoritative
machine artefacts are the committed Turtle bundles linked under
TTL downloads below — load those into your own store and the
IRIs resolve locally. Note the one open caveat: the ODR-0004 prose still cites
the old w3id.org/opda/# namespace, but the emitted TTL uses
opda.org.uk/pdtf/ (the as-built namespace in the map above) — see
Known issues.
SHACL-validation recipe
To validate your own PDTF instance data against the OPDA shapes, load three graphs into
the validator and run pyshacl with advanced=True:
- the class graph (
opda-merged.ttl— the OWL + SKOS TBox, so shape→class labels resolve); - the shapes graph (
opda-shapes-merged.ttl— the node / property shapes); - the relevant overlay-profile graph (e.g.
profiles/baspi5.ttl— the per-form Category-G bindings).
pip install pyshacl
pyshacl \
--shacl opda-shapes-merged.ttl \
--ont-graph opda-merged.ttl \
--advanced \
--format human \
my-instance-data.ttl
Or in Python — note advanced=True is required, not optional:
from pyshacl import validate
conforms, report_graph, report_text = validate(
data_graph="my-instance-data.ttl",
shacl_graph="opda-shapes-merged.ttl",
ont_graph="opda-merged.ttl",
advanced=True, # REQUIRED — see below
inference="none",
)
print(conforms)
print(report_text) # read the sh:ValidationReport advanced=True is mandatory
Some OPDA constraints (notably the sh:xone "exactly one of" rules and the
SHACL-AF data-quality rules, ODR-0017) rely on
SHACL Advanced Features. Under plain SHACL-Core a known-bad exemplar
can vacuously report conforms: true — the constraint simply is not
evaluated. With advanced=True the validator evaluates those rules and the
report is correct. Always read the returned sh:ValidationReport (its
sh:conforms flag and each sh:result) rather than trusting a
bare boolean. This is tracked in Known
issues.
TTL downloads
The authoritative machine artefacts, generated from the committed corpus:
- opda-merged.ttl — the merged TBox
(OWL classes & properties + SKOS concept schemes). Load this as the
--ont-graphfor validation and as the data graph for the class queries above. - opda-shapes-merged.ttl — the
merged SHACL shapes graph (node / property shapes + overlay profiles). This is the
--shaclgraph. - source/ — the per-module TTLs — the 25 source files (classes, properties, shapes, annotations, vocabularies, contexts, the foundation graph) before merge, for consumers who want a single layer rather than the bundle.
Related: Decision provenance (why the namespaces split the way they do), Known issues (the validation and namespace caveats), and the Tool bake-off (SHACL Play! renders the shapes graph as tables).
Comments
Loading comments…
Sign in to post a comment