Skip to content

Feat/shacl first class integration#17

Merged
ThHanke merged 13 commits into
mainfrom
feat/shacl-first-class-integration
Jun 15, 2026
Merged

Feat/shacl first class integration#17
ThHanke merged 13 commits into
mainfrom
feat/shacl-first-class-integration

Conversation

@ThHanke

@ThHanke ThHanke commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • SHACL validation as a first-class feature: sidebar panel showing loaded shapes, validation results grouped by shape, severity badges (warning/info), and click-to-navigate from violations to canvas nodes
  • Spec-compliant blank-node exclusion: migrated from rdf-validate-shacl (Core only) to shacl-engine with SPARQL target support — shapes use sh:SPARQLTarget with FILTER(isIRI(?this)) instead of a custom sh:nodeKind pre-filter hack
  • Reasoning integration: SHACL validation runs automatically after reasoning, results appear in reasoning report summary (conforms/violation count) and per-node badges on the canvas
  • Settings UI: SHACL tab in settings for managing shape sources
  • Navigation fixes: blank-node view switching, highlight follows clicked message
  • UI refactor: replaced Radix dialog with Tailwind overlay for reasoning report
  • ISWC 2026 demo: paper scaffold, demo screenplay, scripted recording spec, and comprehensive demo video

Test plan

  • 4 smoke tests verify shacl-engine SPARQL targets work (named class, blank node exclusion, skolemized blank node)
  • 8 integration tests cover conforming data, violations, blank-node exclusion, severity mapping, result field population, duplicate-free counts
  • 6 MCP tool tests (loadShacl, validateGraph) with proper mocks
  • Full suite: 344 passed, 0 failed
  • Manual: load pizza ontology → run reasoning → SHACL "Conforms" with 6 shapes loaded
  • Build passes

Key technical decisions

  • shacl-engine over rdf-validate-shacl — enables SPARQL targets for declarative blank-node filtering per SHACL-AF spec
  • @rdfjs/data-model + @rdfjs/dataset as factory/dataset — avoids coupling to N3 internals
  • Result mapping handles shacl-engine quirks: r.path is array (extract via path[0].predicates[0]), r.shape is Shape object (access via shape.ptr.term), r.message is Term array (not string)

Thomas Hanke added 13 commits June 15, 2026 11:52
Video element links to GitHub Pages hosted mp4. Falls back to
download link when offline. Keeps ZIP small — video is external.
…soning integration, and settings UI

- Isolate urn:vg:shapes graph from OWL reasoning pipelines (Konclude + N3)
- Add runShaclValidation() in worker with rdf-validate-shacl, graceful error handling for unsupported SPARQL constraints
- Wire SHACL results into reasoning pipeline (errors/warnings alongside OWL)
- Create shaclShapeLoader utility supporting direct .ttl URLs and GitHub folder discovery
- Auto-load shapes on startup from settings URL or ?shaclShapes= param
- Add ShaclShapesPanel sidebar widget showing shapes grouped by source with standalone Validate button
- Add SHACL summary card and SHACL/OWL source badges in ReasoningReportModal
- Add SHACL tab in Settings with URL input, reload, and bundled presets
- Bundle ontology-quality and skos-quality starter shape files
- Expose loadShaclFromUrl MCP tool for agent-driven shape loading
…and README docs

- Report dialog error/warning cards now link to affected node (closes dialog, navigates canvas)
- Warnings no longer mark data as invalid — only errors affect validity status
- Validation provider feeds both errors (red) and warnings (amber) to canvas node badges
- SHACL sidebar panel shows constraint messages and severity icons per shape
- Remove standalone Validate button from sidebar (validation runs via reasoning pipeline)
- Add reasoning-demo.shacl.ttl: purpose-built shapes producing 2 errors + 12 warnings
- Add SHACL validation section to README with demo link, URL params, and preset docs
Validation badges were missing on TBox class nodes because
revalidateEntities() only ran after reasoning, not after view switches.
Now badges refresh whenever the user switches views.
…king

SHACL sidebar now shows validation findings grouped under each shape
with click-to-navigate. Clicking SHACL messages in the reasoning dialog
closes it and opens the sidebar with the message highlighted. Added
zustand store for cross-component SHACL state coordination. Carried
sourceShape through from worker violations for shape-grouped display.
…cator

Resolve property shape blank nodes to parent NodeShape in worker so
findings group under the correct shape. Add message-text fallback for
matching. Remove "Other Findings" section. Make findings clickable
buttons instead of links. Offset reasoning dialog right to avoid sidebar
overlap. Top bar shows: green checkmark + "Consistent · N warnings",
red for errors or inconsistency.
…count

Badge now shows the actual number of warnings/errors per node instead
of always showing 1. Tooltip displays all messages combined. Reactodia
uses validation.items.length for count and maps items for tooltip text.
…nvas container

Dialog is now an absolute-positioned overlay inside the canvas shifting
container, so it moves naturally with sidebar expansion. Uses pure
Tailwind classes instead of Radix Dialog/Portal. Closes on Escape key
or clicking backdrop. No more viewport-centered positioning that
overlaps the sidebar.
Blank node IRIs (urn:vg:bnode:*) are not returned by dataProvider
lookupAll, so they're missing from iriViewMap. When navigating to an
unknown IRI that isn't on the current canvas, try the other view as
fallback instead of silently failing.
Clicking a sidebar message now sets it as active (un-highlighting the
previous). Removed auto-clear timer that caused race conditions.
Highlight persists until another message is clicked.
…apes

Add sh:nodeKind sh:IRI to ClassLabel and ClassComment shapes so they
declaratively exclude anonymous OWL classes (restrictions, unions).

Implement SHACL-aware pre-filtering in runShaclValidation: shapes with
sh:nodeKind sh:IRI or sh:filterShape referencing sh:IRI have their
sh:targetClass blank-node instances removed from the data dataset before
validation, preventing noise from documentation shapes on blank nodes.
Replace rdf-validate-shacl (SHACL Core only) with shacl-engine which
supports SPARQL targets. This enables spec-compliant blank-node exclusion
via sh:SPARQLTarget with FILTER(isIRI(?this)) in shapes, removing the
custom sh:nodeKind pre-filter hack from the worker.

- Swap deps: rdf-validate-shacl → shacl-engine + @rdfjs/data-model + @rdfjs/dataset
- Update runShaclValidation() for shacl-engine API (path array, shape.ptr,
  message array, targetResolvers)
- Replace sh:targetClass + sh:nodeKind sh:IRI with sh:SPARQLTarget on
  class shapes in ontology-quality.shacl.ttl
- Remove ~40-line blank-node pre-filter from worker
- Add smoke tests verifying SPARQL targets work (including skolemized bnodes)
- Add 8 integration tests covering conforming data, violations, blank-node
  exclusion, severity mapping, and result field population
- Fix MCP SHACL tests: add runShaclValidation mock, use vi.hoisted() for
  proper mock sharing with tool module
@ThHanke ThHanke merged commit 64cc93c into main Jun 15, 2026
2 checks passed
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