Skip to content

Commit

Permalink
Fix sh_inversePath when it wraps a different shacl Path selector. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleysommer committed Oct 1, 2024
1 parent d40480b commit f9560d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ and this project adheres to [Python PEP 440 Versioning](https://www.python.org/d
- A whole swathe of python typing fixes and new type annotations. Thanks @ajnelson-nist

### Fixed
- Fixed SHACL Path generation where sh:inversePath is wrapping a different kind of SHACL Path.
- This probably fixes lots of unreported sh:inversePath bugs
- Fixes #227
- Fix logic determining if a datagraph is ephemeral.


Expand Down
6 changes: 3 additions & 3 deletions pyshacl/helper/expression_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ def nodes_from_node_expression(
return inter_nodes
path_nodes = set(sg.objects(expr, SH_path))
if len(path_nodes) > 0:
path_results = []
path_results: Set[Union['RDFNode', None]] = set()
for p in path_nodes:
vals = value_nodes_from_path(sg, focus_node, p, data_graph)
path_results.extend(vals)
path_results.update(vals)
return path_results
filter_shapes = set(sg.objects(expr, SH_filterShape))
nodes_nodes = set(sg.objects(expr, SH_nodes))
if len(filter_shapes) > 0: # pragma: no cover
# Note: Theres no tests for this whole filterShapes feature!
# Note: There's no tests for this whole filterShapes feature!
if len(nodes_nodes) > 1:
warn(Warning("More than one sh:nodes found. Using the first one."))
elif len(nodes_nodes) < 1:
Expand Down

0 comments on commit f9560d9

Please sign in to comment.