Skip to content

Conversation

@jgeluk
Copy link
Member

@jgeluk jgeluk commented Aug 27, 2025

Summary

  • Fix: dist/dprod.jsonld is now a proper JSON-LD context document (single top-level @context), not an ontology dump. Resolves issue #93.
  • Ontology: The ontology JSON-LD is emitted separately as dist/dprod-ontology.jsonld (contains @graph).
  • Backward compatibility: Other generated artifacts (dprod-all.jsonld, *.ttl, *.rdf, shapes) remain unchanged.

What changed

  • Generator (spec-generator/main.py):
    • Generates a compact JSON-LD context mapping all DPROD terms and prefixes.
    • Writes the context to dist/dprod.jsonld.
    • Writes the ontology dump to dist/dprod-ontology.jsonld.
  • Tests (tests/test_context.py):
    • Assert dist/dprod.jsonld is a pure context (only @context at the top level).
    • Assert dist/dprod-ontology.jsonld contains @graph.
    • Validate that a minimal JSON-LD instance using the context expands to expected triples (DataProduct type and dataProductOwner).
    • Use PyLD to convert JSON-LD → N-Quads → rdflib Dataset (clean, warning-free parsing).
  • Dependencies (requirements.txt):
    • rdflib>=7.1.4,<9
    • pyld>=2,<3

Rationale

  • Previously, dist/dprod.jsonld was an ontology dump, which is not usable as a JSON-LD context and caused failures when consumed as such.
  • Splitting context and ontology aligns with best practices and avoids term resolution issues.

How to consume

  • Reference the context once at the top level of JSON-LD instance documents:
    • "@context": "https://ekgf.github.io/dprod/dprod.jsonld"
  • Avoid redefining or nesting @context in the same document.

Verification

  • Local build: Python 3.13, .venv.
  • Test run: 3 tests passed, 0 warnings.

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.

the @context is not a context but an ontology

2 participants