Skip to content

feat(validation): unified catalog-based validation with local context resolution#7

Open
jdsika wants to merge 5 commits intomainfrom
feat/unified-catalog-validation
Open

feat(validation): unified catalog-based validation with local context resolution#7
jdsika wants to merge 5 commits intomainfrom
feat/unified-catalog-validation

Conversation

@jdsika
Copy link

@jdsika jdsika commented Feb 19, 2026

Description

This PR enhances the validation infrastructure with local JSON-LD context resolution, external artifact support, and improved CLI options.

CLI Changes

Removed Added Description
--path --data-paths Renamed, accepts multiple paths
--folder (removed) Deprecated flag removed
--no-catalog (removed) Flag removed
(none) --artifacts Register external artifact directories
(none) --inference-mode Control inference: rdfs, owlrl, none, both

New Module: context_resolver.py

Local JSON-LD context resolver using catalog-based discovery. Solves TLS failures in WSL environments by inlining context content directly into JSON-LD data before parsing.

Key functions:

  • build_context_url_map() - Build URL → local file mapping from registry resolver
  • discover_context_files() - Scan artifact directories for *.context.jsonld files
  • resolve_contexts() - Resolve and inline all @context URLs in a JSON-LD document

Core Utility Enhancements

file_collector.py

New functions:

  • normalize_paths_to_list() - Normalize path inputs to list
  • extract_jsonld_iris() - Extract root @id and referenced IRIs from JSON-LD
  • discover_data_hierarchy() - Auto-discover top-level files vs fixtures

registry_resolver.py

New methods:

  • get_all_cataloged_files() - Get all cataloged files with optional domain filter
  • get_artifact_domains() - List domains from registered artifacts
  • register_artifact_directory() - Register external artifact directory
  • register_fixture_mappings() - Register fixture IRI → path mappings

shacl/validator.py

New methods:

  • _build_context_url_map() - Build context URL mappings for local resolution
  • validate_from_catalog() - Validate using catalog-based discovery

graph_loader.py

  • Integration with context_resolver for local JSON-LD context resolution

Documentation Updates

  • Updated CLI documentation in CLAUDE.md, AGENTS.md, .github/copilot-instructions.md
  • Updated docs/validation/suite.md with new CLI options
  • Updated .github/instructions/ files for consistency

Git Commit Policy (New)

Added strict policy to agent instruction files:

  • Always sign commits with -s -S flags
  • Never include AI attribution (Co-Authored-By, etc.)
  • Author must be human developer with official email

Files Changed

New files:

  • src/tools/utils/context_resolver.py (202 lines)

Modified utilities:

  • src/tools/utils/file_collector.py (+213 lines)
  • src/tools/utils/registry_resolver.py (+220 lines)
  • src/tools/utils/graph_loader.py (+118 lines)
  • src/tools/utils/registry_updater.py (+25 lines)

Modified validators:

  • src/tools/validators/validation_suite.py (refactored)
  • src/tools/validators/shacl/validator.py (+100 lines)
  • src/tools/validators/syntax_validator.py (refactored)
  • src/tools/validators/coherence_validator.py
  • src/tools/validators/conformance_validator.py

New tests:

  • tests/unit/validators/test_validation_suite.py (369 lines)
  • tests/unit/utils/test_file_collector.py (+186 lines)
  • tests/unit/utils/test_registry_resolver.py (+60 lines)
  • tests/unit/validators/test_syntax_validator.py (+40 lines)

Total: 24 files changed, +2035/-558 lines

🏷️ Versioning & Compatibility

  • Patch (Bug fix or non-breaking change that does not add new types)

Tooling change only - no ontology structure changes.

🏗️ Type of change

  • Change (non-breaking change or fix on an existing type)

CLI breaking changes: --path--data-paths, --folder and --no-catalog removed.

🧪 How Has This Been Tested?

  • All unit tests pass (pytest tests/unit/)
  • Pre-commit hooks pass (make lint)
  • Manual testing with new CLI options
pytest tests/unit/ -v
python3 -m src.tools.validators.validation_suite --domain hdmap --inference-mode owlrl
python3 -m src.tools.validators.validation_suite --data-paths tests/data/hdmap/valid/
python3 -m src.tools.validators.validation_suite --data-paths ./data.json --artifacts ../other-repo/artifacts

✅ Checklist

  • My code follows the modelling guidelines of this project
  • I have performed a self-review of my own changes
  • I have updated the version number in the ontology file (if applicable) - N/A (tooling only)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

- Add context_resolver.py for local JSON-LD context resolution
  (avoids TLS failures in WSL environments)
- Add --artifacts flag for loading external artifact directories
- Add register_artifact_directory() to registry_resolver.py
- Integrate context resolver in graph_loader.py for JSON-LD parsing

Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
- Rename --path to --data-paths for multiple file support
- Remove deprecated --folder and --no-catalog flags
- Add --inference-mode CLI argument (rdfs|owlrl|none|both)
- Add extract_jsonld_iris() and discover_data_hierarchy() to file_collector
- Add get_all_cataloged_files() and get_artifact_domains() to registry_resolver
- Add validate_from_catalog() to ShaclValidator
- Add comprehensive test suite for validation_suite.py
- Update all documentation to reflect new CLI options

BREAKING CHANGE: --path renamed to --data-paths, --folder and --no-catalog removed

Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
- Always sign commits with -s -S flags
- Never include Co-Authored-By or AI tool mentions
- Author must be human developer with official email

Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
@jdsika jdsika self-assigned this Feb 19, 2026
@jdsika jdsika added the enhancement New feature or request label Feb 19, 2026
```
docs: add .playground/ workflow and update agent instructions

- Update AGENTS.md: add .playground/ commit/PR workflow
- Update CLAUDE.md: standardize .playground/ file names
- Update copilot-instructions.md: add .playground/ workflow section
- Ensure .playground/ in .gitignore

This standardizes the commit/PR preparation workflow across all
repositories in the credentials ecosystem.
```

Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments