forked from crs4/rocrate-validator
-
Notifications
You must be signed in to change notification settings - Fork 1
21 referencing a workflow crate #26
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
Open
EttoreM
wants to merge
17
commits into
develop
Choose a base branch
from
21-referencing-a-workflow-crate
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b87467c
5s-crate profile file
douglowe 7ab6b6d
5-safes crate first req
douglowe 5f45864
adding 5-safe ro-crate example json
douglowe cf2b808
tests for 5-safe crate request and result profiles
douglowe cab8579
five-safes request and result conform to rocrate-1.1
douglowe 599ffd0
5S-crate funder test added
douglowe 2cc55b9
renumber funder test for now
douglowe b24d854
fix linting
elichad e09dec5
introduce invalid crate tests
elichad fa52a02
resolve test failures
elichad b54c409
revert changes which will be superseded
elichad b1b235c
linting
elichad 8bdb692
more linting
elichad 21d02d7
Implemented SHACL rules for rule set 6 (referencing a workflow crate)
EttoreM 861e6a7
Merge branch 'develop' into 21-referencing-a-workflow-crate
EttoreM f15804f
Changed description of SHOULD rule
EttoreM d77c930
Added tests for rule-set 6 implemented in SHACL
EttoreM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
rocrate_validator/profiles/five-safes-crate/must/6_workflow_reference.ttl
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Copyright (c) 2025 eScience Lab, The University of Manchester | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| @prefix ro: <./> . | ||
| @prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> . | ||
| @prefix five-safes-crate: <https://github.com/eScienceLab/rocrate-validator/profiles/five-safes-crate/> . | ||
| @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
| @prefix schema: <http://schema.org/> . | ||
| @prefix purl: <http://purl.org/dc/terms/> . | ||
| @prefix sh: <http://www.w3.org/ns/shacl#> . | ||
| @prefix validator: <https://github.com/crs4/rocrate-validator/> . | ||
| @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
|
||
|
|
||
|
|
||
| five-safes-crate:ReferenceToWorkflowCrate | ||
| a sh:NodeShape ; | ||
| sh:name "RootDataEntity" ; | ||
| sh:targetClass ro-crate:RootDataEntity ; | ||
|
|
||
| # RootDataEntity MUST have an mainEntity property | ||
| sh:property [ | ||
| a sh:PropertyShape ; | ||
| sh:name "mainEntity" ; | ||
| sh:path schema:mainEntity ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| sh:nodeKind sh:IRI ; | ||
| sh:severity sh:Violation ; | ||
| sh:message "The RootDataEntity MUST have exactly one schema:mainEntity property that is an IRI." ; | ||
| ] ; | ||
|
|
||
| # The mainEntity of a RootDataEntity MUST be a Dataset | ||
| sh:property [ | ||
| a sh:PropertyShape ; | ||
| sh:name "mainEntity" ; | ||
| sh:path schema:mainEntity ; | ||
| sh:class schema:Dataset ; | ||
| sh:severity sh:Violation ; | ||
| sh:message "The mainEntity pointed to by the RootDataEntity MUST be of type schema:Dataset" ; | ||
| ] . | ||
|
|
||
| five-safes-crate:mainEntityHasProperConformsTo | ||
| a sh:NodeShape ; | ||
| sh:name "mainEntity" ; | ||
| sh:description "The mainEntity of the RootDataEntity MUST have a conformsTo property with an IRI starting with https://w3id.org/workflowhub/workflow-ro-crate" ; | ||
| sh:targetObjectsOf schema:mainEntity ; | ||
| sh:sparql [ | ||
| a sh:SPARQLConstraint ; | ||
| sh:name "conformsTo" ; | ||
| sh:message "conformsTo IRI must start with https://w3id.org/workflowhub/workflow-ro-crate" ; | ||
| sh:select """ | ||
| PREFIX schema: <http://schema.org/> | ||
| PREFIX purl: <http://purl.org/dc/terms/> | ||
| SELECT $this WHERE { | ||
| $this purl:conformsTo ?iri . | ||
| FILTER(!STRSTARTS(STR(?iri), "https://w3id.org/workflowhub/workflow-ro-crate")) | ||
| } | ||
| """ ; | ||
| ] . | ||
49 changes: 49 additions & 0 deletions
49
rocrate_validator/profiles/five-safes-crate/should/6_workflow_reference.ttl
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Copyright (c) 2025 eScience Lab, The University of Manchester | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| @prefix ro: <./> . | ||
| @prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> . | ||
| @prefix five-safes-crate: <https://github.com/eScienceLab/rocrate-validator/profiles/five-safes-crate/> . | ||
| @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
| @prefix schema: <http://schema.org/> . | ||
| @prefix purl: <http://purl.org/dc/terms/> . | ||
| @prefix sh: <http://www.w3.org/ns/shacl#> . | ||
| @prefix validator: <https://github.com/crs4/rocrate-validator/> . | ||
| @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
|
||
|
|
||
| five-safes-crate::DatasetMustHaveDistributionIfURI | ||
douglowe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| a sh:NodeShape ; | ||
| sh:name "mainEntity" ; | ||
| sh:targetObjectsOf schema:mainEntity ; | ||
| sh:description "If mainEntity has an HTTP(S) @id, it SHOULD have a distribution that is an HTTP(S) URL." ; | ||
|
|
||
| sh:sparql [ | ||
| a sh:SPARQLConstraint ; | ||
| sh:name "distribution" ; | ||
| sh:description "If mainEntity has an HTTP(S) @id, it SHOULD have a distribution that is an HTTP(S) URL." ; | ||
| sh:prefixes ro-crate:sparqlPrefixes ; | ||
| sh:select """ | ||
| SELECT $this | ||
| WHERE { | ||
| FILTER (STRSTARTS(STR($this), "http://") || STRSTARTS(STR($this), "https://")) . | ||
| FILTER NOT EXISTS { | ||
| $this schema:distribution ?dist . | ||
| FILTER (STRSTARTS(STR(?dist), "http://") || STRSTARTS(STR(?dist), "https://")) . | ||
| } | ||
| } | ||
| """ ; | ||
| sh:severity sh:Warning ; | ||
| sh:message "If mainEntity has an HTTP(S) @id SHOULD have at least one distribution with an HTTP(S) URL." ; | ||
| ] . | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure, but I think this may only validate the prefix when
conformsToexists. In other words if conformsTo is missing, the violation might not report (?)sh:minCount 1 ;might be required. Worth a test to see.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Added a constraint for that and a corresponding test.