Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Enhanced Targeting Features. #249

Merged
merged 14 commits into from
Oct 1, 2024
Merged

Add Enhanced Targeting Features. #249

merged 14 commits into from
Oct 1, 2024

Conversation

ashleysommer
Copy link
Collaborator

@ashleysommer ashleysommer commented Sep 25, 2024

  • Focus Node Filtering.
    • You can now pass in a list of focus nodes to the validator, and it will only validate those focus nodes.
    • Note, you still need to pass in a SHACL Shapes Graph, and the shapes still need to target the focus nodes.
    • This feature will filter the Shapes' targeted focus nodes to include only those that are in the list of specified focus nodes.

Update: See comment further down for big additional update to this PR.

@ashleysommer
Copy link
Collaborator Author

ashleysommer commented Sep 25, 2024

I'll leave this PR open for comment for a couple of days, and I want to add the second half of the "targeting" feature-branch to this PR too.
That next feature is the ability to select a specific Shape (Node shape or Property shape) to use, instead of selecting all shapes from the Shapes file.

Then the combination of Focus Node select mode, and Shape select mode will allow powerful targeting that is otherwise not available in PySHACL.

pyshacl/validate.py Outdated Show resolved Hide resolved
@ashleysommer ashleysommer changed the title Add Focus Nodes mode. Add Enhanced Targeting Features. Sep 28, 2024
@ashleysommer
Copy link
Collaborator Author

The rest of the Enhanced Targeting features are landed in this PR.

Focus Node Filtering, and Shape Selection

  • Focus Node Filtering
    • You can pass in a list of focus nodes to the validator, and it will only validate those focus nodes.
    • Note, you still need to use a SHACL ShapesGraph, and the Shapes still need to target the focus nodes.
    • This feature will filter the Shapes' targeted focus nodes to include only those that are in the list of specified focus nodes.
  • SHACL Shape selection
    • You can pass in a list of SHACL Shapes to the validator, and it will use only those Shapes for validation.
    • This is useful for testing new shapes in your shapes graph, or for many other procedure-driven use cases.
  • Combined Shape Selection with Focus Node selection.
    • The combination of the above two new features is especially powerful.
    • If you give the validator a list of Shapes to use, and a list of focus nodes, the validator will operate in
      a highly-targeted mode, it feeds those focus nodes directly into those given Shapes for validation.
    • In this mode, the selected SHACL Shape does not need to specify any focus-targeting mechanisms of its own.

@nicholascar
Copy link
Member

Looks good @ashleysommer.

Perhaps we need to see the test suite results in GitHub though? I trust you have them all passing locally but as a PR reviewer, I would like to see them here too, rather than having to run them myself locally too to test.

@nicholascar nicholascar self-requested a review September 30, 2024 00:56
@ashleysommer
Copy link
Collaborator Author

Perhaps we need to see the test suite results in GitHub though?

Yeah, I need to make a change in the PySHACL CI configuration, the Drone VM I used to have set up is no longer running. I'm not a fan of github-actions, but it seems like its the easiest way forward.
And @ajnelson-nist recently created a PR to enable type-checking in Continuous Integration, so that needs to be absorbed in too. #250

@ashleysommer
Copy link
Collaborator Author

Got whole test suite including linting, type-checking, and tox test matrix working in Github-actions, and merged the upstream changes into this PR, so you will now see the tests run against this PR.

@ashleysommer
Copy link
Collaborator Author

I'm merging this now, but I screenshotted the green ticks for reference:
image

@ashleysommer ashleysommer reopened this Oct 1, 2024
@ashleysommer ashleysommer merged commit 842232c into master Oct 1, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants