feat(validation): unified catalog-based validation with local context resolution#7
Open
feat(validation): unified catalog-based validation with local context resolution#7
Conversation
- 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>
``` 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR enhances the validation infrastructure with local JSON-LD context resolution, external artifact support, and improved CLI options.
CLI Changes
--path--data-paths--folder--no-catalog--artifacts--inference-moderdfs,owlrl,none,bothNew Module:
context_resolver.pyLocal 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 resolverdiscover_context_files()- Scan artifact directories for*.context.jsonldfilesresolve_contexts()- Resolve and inline all@contextURLs in a JSON-LD documentCore Utility Enhancements
file_collector.py
New functions:
normalize_paths_to_list()- Normalize path inputs to listextract_jsonld_iris()- Extract root @id and referenced IRIs from JSON-LDdiscover_data_hierarchy()- Auto-discover top-level files vs fixturesregistry_resolver.py
New methods:
get_all_cataloged_files()- Get all cataloged files with optional domain filterget_artifact_domains()- List domains from registered artifactsregister_artifact_directory()- Register external artifact directoryregister_fixture_mappings()- Register fixture IRI → path mappingsshacl/validator.py
New methods:
_build_context_url_map()- Build context URL mappings for local resolutionvalidate_from_catalog()- Validate using catalog-based discoverygraph_loader.py
context_resolverfor local JSON-LD context resolutionDocumentation Updates
CLAUDE.md,AGENTS.md,.github/copilot-instructions.mddocs/validation/suite.mdwith new CLI options.github/instructions/files for consistencyGit Commit Policy (New)
Added strict policy to agent instruction files:
-s -SflagsFiles 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.pysrc/tools/validators/conformance_validator.pyNew 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
Tooling change only - no ontology structure changes.
🏗️ Type of change
CLI breaking changes:
--path→--data-paths,--folderand--no-catalogremoved.🧪 How Has This Been Tested?
pytest tests/unit/)make lint)✅ Checklist