Skip to content

Adapt GenerateOntologyViews to LDH ldh:view vocabulary#19

Merged
namedgraph merged 2 commits into
mainfrom
feat-ldh-view-vocabulary
Jun 16, 2026
Merged

Adapt GenerateOntologyViews to LDH ldh:view vocabulary#19
namedgraph merged 2 commits into
mainfrom
feat-ldh-view-vocabulary

Conversation

@namedgraph

Copy link
Copy Markdown
Member

Summary

LinkedDataHub deprecated ldh:template (attached to classes) in favor of ldh:view and ldh:inverseView attached to properties. See LDH commits b54d8c8b6 (#267, "Ontology-based blocks are attached to properties, not classes") and 1ec5da016 ("Renamed ldh:block to ldh:view"). ldh:template is fully removed from the LDH ontology.

This makes ldh-GenerateOntologyViews incompatible with current LDH. This PR adapts it.

Changes

  • Iterate distinct properties instead of (class, property) tuples — views now hang off properties, so a per-class loop produced duplicate triples.
  • Attach views via (property, ldh:view, view) instead of (class, ldh:template, view).
  • Replace the class-scoped owl:maxQualifiedCardinality 1 filter with a property-level ?property a owl:FunctionalProperty filter — cleaner fit for the property-level vocabulary; preserves the UX intent (no redundant 1-row tables).
  • View URIs drop the class component: {base}#{property_local}_View (with a sha1 suffix on local-name collisions).
  • Trim _generate_sparql_query to take only property_uri (the body was already class- and range-agnostic).
  • Docstrings and description() text updated.

Inverse views (ldh:inverseView) intentionally deferred — most properties (especially datatype) are not useful in inverse direction; adding them blindly would double portal noise. A TODO comment marks the spot.

Test plan

  • uv run pytest tests/ -q — 106 passed, 44 skipped (same baseline; no regressions)
  • Direct-call smoke test confirms ldh:view triples emitted on properties, no ldh:template triples remain, owl:FunctionalProperty correctly skipped
  • End-to-end against a local LDH v5.5.3+: run examples/generate-portal.json, then curl the posted ontology graph and verify ldh:view appears and ldh:template does not; confirm property views render in the LDH UI

Notes

  • No version bump in this PR to avoid conflicting with Prefix Generate* LDH ops with ldh- #18 (which bumps to 1.4.0 for the ldh- prefix rename). Whichever lands second should bump.
  • GenerateOntologyViews is not in formal-semantics.md, so per the project's spec-driven-tests convention no unit test was added. A follow-up will add spec entries + tests for the four portal-related operations (ExtractOntology, GenerateOntologyViews, GenerateClassContainers, GeneratePortal).

LinkedDataHub deprecated `ldh:template` (attached to classes) in favor
of `ldh:view` / `ldh:inverseView` attached to properties — see LDH
commits b54d8c8b6 (#267) and 1ec5da016.

- Iterate distinct properties instead of (class, property) tuples
- Attach views via `ldh:view` on the property (forward direction)
- Skip `owl:FunctionalProperty` (clean property-level replacement for
  the old class-scoped `owl:maxQualifiedCardinality 1` check)
- Drop class/range from view URI naming; sha1-suffix on local-name collisions

Inverse views (`ldh:inverseView`) intentionally deferred.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@namedgraph namedgraph merged commit c714b79 into main Jun 16, 2026
6 checks passed
@namedgraph namedgraph deleted the feat-ldh-view-vocabulary branch June 16, 2026 11:24
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