This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
DPROD (Data Product Ontology) is an OMG standard that extends the W3C DCAT vocabulary to describe data products in data mesh architectures. The repository contains the OWL ontology, SHACL validation shapes, a Python spec generator, and worked examples.
bash build.shThis sets up a .venv with Python 3.12+, installs dependencies, and runs the spec generator. Output goes to dist/. The build fetches https://www.w3.org/ns/dcat2.ttl remotely, so it requires internet access.
To run just the generator (after initial setup):
source .venv/bin/activate
python spec-generator/main.pyThere are no tests or linters configured.
The spec generator (spec-generator/main.py) produces the specification HTML and serialized ontology files:
- Load — Three RDF sources are parsed into a single graph:
dprod-ontology.ttl(OWL classes/properties),dprod-shapes.ttl(SHACL shapes), and the remote W3C DCAT vocabulary. - Discover — The graph is scanned for SHACL NodeShapes. Each NodeShape is linked to its OWL target class via
sh:targetClass. Properties come fromsh:propertyon each NodeShape. - Two-pass property loading — For both NodeShapes and PropertyShapes, OWL properties are loaded first, then SHACL properties override them. Predicates in
IGNORED_NODE_SHAPE_PREDICATES/IGNORED_PROPERTY_SHAPE_PREDICATES(inglobals.py) are skipped during the SHACL pass to prevent shape metadata from leaking into the spec. - Examples — Each subdirectory in
examples/with aREADME.mdis loaded; the markdown is converted to HTML. - Render — Jinja2 renders
respec/template.htmlwith the discovered classes and examples, producingdist/index.html. - Serialize — The ontology is serialized to Turtle, JSON-LD, and RDF/XML in multiple combinations (ontology-only, shapes-only, combined). A standalone
dprod-context.jsonldis also generated for use as a remote@contextin JSON-LD documents.
dprod-ontology.ttldefines OWL classes and properties (the "what").dprod-shapes.ttldefines SHACL shapes that constrain those classes (the "how to validate"). Each NodeShape targets an OWL class; each PropertyShape constrains an OWL property viash:path.respec/template.htmlis both a W3C ReSpec document and a Jinja2 template. Static sections (preamble, scope, namespaces) are plain HTML. Dynamic sections use{% for cls in classes %}loops to render class and property tables.- Class ordering in the spec is hardcoded in
main.py(thereorder_listcall), not derived from the ontology. - Examples referenced in
@contextusedprod-context.jsonld(standalone context), notdprod.jsonld(full ontology dump).
The canonical namespace is https://www.omg.org/spec/DPROD/. The shapes namespace is https://www.omg.org/spec/DPROD/shapes/. These are defined in globals.py.
main— The officially accepted OMG standard. Deploys to GitHub Pages.develop— Working branch where the EKGF evolves the standard.- Issue branches — Created from
develop, named after the OMG JIRA issue number (e.g.,DPROD-16). Commit messages should reference both the JIRA issue and the GitHub issue (e.g.,Resolves: DPROD-16, #29). - Ballot branches — Named
ballot/N(e.g.,ballot/3), created by the ballot administrator to group issue branches for a formal OMG vote. Merged intodevelopwith a merge commit (not squash/rebase) to preserve individual issue history.
See CONTRIBUTING.md for the full process.
- Add/modify an ontology class or property: Edit both
ontology/dprod/dprod-ontology.ttl(OWL definition) andontology/dprod/dprod-shapes.ttl(SHACL shape). Keep descriptions in sync. - Change spec rendering or layout: Edit
respec/template.html. Static content is plain HTML; dynamic content uses Jinja2 syntax. - Change class ordering in the spec: Edit the
reorder_listcall inspec-generator/main.py. - Add an example: Create a subdirectory in
examples/with aREADME.md(and optionally anexample.jsonld). Updateexamples/README.md. - Add a namespace to the spec: Add a
<tr>to the namespace table inrespec/template.htmland ensure the prefix is declared in the relevant.ttlfiles.