Repository navigation
Don't overwrite a profile's published shaclShapes when validating transform outputs - #103
Merged
Merged
Conversation
…nsform outputs RdfValidator writes the bblock's resolved inherited SHACL shapes, as working-directory-relative paths, back into bblock.metadata for postprocess to make absolute. validate_transform_output() also builds an RdfValidator for the transform's output profile, which may already have been processed, so its published shaclShapes were replaced with relative paths (e.g. _sources/properties/observation/shapes.shacl). Registers importing it then resolved those against their own bblocks and failed to load them. RdfValidator takes publish_shacl_shapes (default True); validate_transform_output() passes False. Fixes #100 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Record RdfValidator kwargs with a dedicated fake instead of indexing into the validator list, and assert the exact relative shapes path written when publish_shacl_shapes is true.
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.
Summary
Fixes #100: a register whose transforms validate their outputs against its own blocks (
outputs.profiles) published those blocks'shaclShapesas working-directory-relative paths. Every register that imported them then failed. In ogcapi-sosa's case the publishedregister.jsonhad entries like this:A downstream register then failed with:
That's because a relative entry is resolved against the importing bblock's own directory.
Cause:
RdfValidator.__init__writes the bblock's resolved inherited shapes back intobblock.metadata['shaclShapes'], as paths relative to the working directory, forpostprocessto turn into URLs.validate_transform_output()also builds anRdfValidatorfor the output profile. That profile has usually been processed already, with its publishedshaclShapesmade absolute, so the write-back replaced them with relative paths after the fact.Change:
RdfValidatortakespublish_shacl_shapes: bool = True.validate_transform_output()passesFalse.Testing
tests/test_validate.py. They check thatvalidate_transform_output()buildsRdfValidatorwithpublish_shacl_shapes=False, and thatRdfValidatorleavesshaclShapesuntouched when it'sFalseand writes them when it'sTrue. The new tests fail without the fix.bblocks-postprocess:latestimage venv, withpytestandpytest-mockinstalled: 181 passed.ogc/mounted over the image's/src/ogc.shaclShapesentry is relative.🤖 Generated with Claude Code