Skip to content

Commit ad9a45b

Browse files
committed
Merge bblock-level shaclClosures into snippet context for transforms
When building the TransformContext snippet dict, append the building block's shaclClosures to the snippet's shacl-closure list (deduplicating), mirroring the merging that already happens during RDF validation.
1 parent ccc2722 commit ad9a45b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

ogc/bblocks/transform.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,12 @@ def apply_transforms(bblock: BuildingBlock,
518518
example_index=example_id,
519519
example={k: v for k, v in example.items() if k != 'snippets'},
520520
snippet_index=snippet_id,
521-
snippet={k: v for k, v in snippet.items() if k != 'code'},
521+
snippet={
522+
**{k: v for k, v in snippet.items() if k != 'code'},
523+
**({'shacl-closure': list(dict.fromkeys(
524+
(snippet.get('shacl-closure') or []) + (bblock.shaclClosures or [])
525+
))} if (bblock.shaclClosures or snippet.get('shacl-closure')) else {}),
526+
},
522527
output_file=_rel(output_fn, cwd),
523528
output_dir=_rel(output_dir, cwd),
524529
working_dir=str(cwd),

0 commit comments

Comments
 (0)