Skip to content

Infer WorkflowRun from CreateAction in five-safes SHACL profiles - NEW#109

Open
EttoreM wants to merge 12 commits intodevelopfrom
107-run-createaction-checks-only-against-the-createactions-that-the-profile-cares-about
Open

Infer WorkflowRun from CreateAction in five-safes SHACL profiles - NEW#109
EttoreM wants to merge 12 commits intodevelopfrom
107-run-createaction-checks-only-against-the-createactions-that-the-profile-cares-about

Conversation

@EttoreM
Copy link
Copy Markdown

@EttoreM EttoreM commented Apr 30, 2026

Closes #43.

NOTE: This PR supersedes #104. The current commit on this branch addresses all the comments made on #104.


This PR implements a solution for treating the workflow-execution CreateAction as a dedicated ro-crate:WorkflowRun entity across the Five Safes SHACL profiles.

At a high level:

  • A hidden SHACL rule was added to the relevant TTL files to infer the triple CreateAction -> rdf:type -> ro-crate:WorkflowRun for the CreateAction whose instrument matches RootDataEntity -> mainEntity.

  • All SHACL constraints that are really about the actual workflow run were then retargeted from generic CreateAction to WorkflowRun, with corresponding updates on shapes' names and messages.

  • Tests were updated accordingly.

One important testing detail:

  • In the Python tests, the graph mutations still target entities of type CreateAction, not WorkflowRun.

  • This is intentional: WorkflowRun is inferred by SHACL during validation, so it is safer for the tests to alter the source CreateAction nodes in the RO-Crate metadata graph.

  • This remains correct as long as the tests are understood to target the specific CreateAction that is effectively the workflow run, and not any other CreateAction that may also be present in the crate.

A separate consistency note:

  • In prefixes.ttl, the RO-Crate namespace is exposed in SPARQL via rocrate (without the dash), while elsewhere in the codebase we also use ro-crate.
    This did not originate in this PR, but it is something we may want to clean up in future to align prefix syntax across the codebase.

@EttoreM EttoreM requested a review from douglowe April 30, 2026 10:26
Copy link
Copy Markdown

@douglowe douglowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally good - a couple of items to pick up from the other PR.

Could you check out Eli's question on the order statements - run some tests and see if anything breaks without them?

""" ;
sh:message "`CreateAction` --> `instrument` MUST reference the same entity as `Root Data Entity` --> `mainEntity`" ;
] ;
sh:message "The `CreateAction` entity corresponding to the workflow run MUST reference through its property `instrument` the same entity as `RootData Entity` --> `mainEntity`" ;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we word this more clearly?

Perhaps 'The CreateAction entity corresponding to the workflow MUST reference, as an instrument, the entity that is referenced as mainEntity by the RO-Crate'.



five-safes-crate:RootDataEntityMentionsCreateAction
five-safes-crate:RootDataEntityMentionsWorkflowRunAction
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test (five-safes-crate:RootDataEntityMentionsWorkflowRunAction) replicated by the test five-safes-crate:RootDataEntityShouldMentionWorkflow in the file should/11_workflow_execution_phase.ttl?

Can you check, and see if they are the same test, and if so then decide if we should keep the MUST or the SHOULD version?

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.

Run CreateAction checks only against the CreateAction(s) that the profile cares about

2 participants