Skip to content

Commit 6a42e50

Browse files
committed
first commit for set 1 of rules
1 parent 2cc55b9 commit 6a42e50

5 files changed

Lines changed: 266 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright (c) 2024-2025 CRS4
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
@prefix ro: <./> .
16+
@prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> .
17+
@prefix five-safes-crate: <https://github.com/eScienceLab/rocrate-validator/profiles/five-safes-crate/> .
18+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
19+
@prefix schema: <http://schema.org/> .
20+
@prefix sh: <http://www.w3.org/ns/shacl#> .
21+
@prefix validator: <https://github.com/crs4/rocrate-validator/> .
22+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
23+
24+
25+
five-safes-crate:ResponsibleProject
26+
a sh:NodeShape ;
27+
sh:name "Responsible Project" ;
28+
sh:target [
29+
a sh:SPARQLTarget ;
30+
sh:prefixes ro-crate:sparqlPrefixes ;
31+
sh:select """
32+
SELECT DISTINCT ?this WHERE {
33+
?action a schema:CreateAction ;
34+
schema:agent ?agent .
35+
?agent schema:memberOf ?this .
36+
}
37+
"""
38+
] ;
39+
40+
sh:property [
41+
a sh:PropertyShape ;
42+
sh:name "funding" ;
43+
sh:path schema:funding;
44+
sh:minCount 1 ;
45+
sh:severity sh:Info ;
46+
sh:message """The Responsible Project MAY have a 'funding' property.""" ;
47+
] .
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Copyright (c) 2024-2025 CRS4
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
@prefix ro: <./> .
16+
@prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> .
17+
@prefix five-safes-crate: <https://github.com/eScienceLab/rocrate-validator/profiles/five-safes-crate/> .
18+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
19+
@prefix schema: <http://schema.org/> .
20+
@prefix sh: <http://www.w3.org/ns/shacl#> .
21+
@prefix validator: <https://github.com/crs4/rocrate-validator/> .
22+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
23+
24+
25+
five-safes-crate:AgentIsMemberOf
26+
a sh:NodeShape ;
27+
sh:name "Requesting Agent" ;
28+
sh:target [
29+
a sh:SPARQLTarget ;
30+
sh:prefixes ro-crate:sparqlPrefixes ;
31+
sh:select """
32+
SELECT DISTINCT ?this WHERE {
33+
?action a schema:CreateAction ;
34+
schema:agent ?this .
35+
}
36+
"""
37+
] ;
38+
39+
sh:property [
40+
a sh:PropertyShape ;
41+
sh:name "memberOf" ;
42+
sh:path schema:memberOf;
43+
sh:class schema:Project ;
44+
sh:severity sh:Violation ;
45+
sh:message """The 'memberOf' property of an agent MUST be of type Project.""" ;
46+
] .
47+
48+
49+
# Rule 5
50+
five-safes-crate:AgentProjectIntersection
51+
a sh:NodeShape ;
52+
sh:name "Agent" ;
53+
sh:description "At least one Project referenced by Agent -> memberOf MUST be included in the set of Projects referenced by RootDataEntity -> sourceOrganization." ;
54+
sh:target [
55+
a sh:SPARQLTarget ;
56+
sh:prefixes ro-crate:sparqlPrefixes ;
57+
sh:select """
58+
SELECT DISTINCT ?this WHERE {
59+
?action a schema:CreateAction ;
60+
schema:agent ?this .
61+
}
62+
"""
63+
] ;
64+
sh:sparql [
65+
a sh:SPARQLConstraint ;
66+
sh:name "MemberOf" ;
67+
sh:description """At least one Project referenced by Agent -> memberOf MUST be included in the set of Projects referenced by RootDataEntity -> sourceOrganization.""" ;
68+
sh:message """At least one Project referenced by Agent -> memberOf MUST be included in the set of Projects referenced by RootDataEntity -> sourceOrganization.""" ;
69+
sh:prefixes ro-crate:sparqlPrefixes ;
70+
sh:select """
71+
SELECT $this WHERE {
72+
FILTER NOT EXISTS {
73+
$this schema:memberOf ?commonProject .
74+
?metadata schema:about ?root .
75+
?root schema:sourceOrganization ?commonProject .
76+
}
77+
}
78+
""" ;
79+
sh:severity sh:Violation ;
80+
] .
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright (c) 2024-2025 CRS4
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
@prefix ro: <./> .
16+
@prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> .
17+
@prefix five-safes-crate: <https://github.com/eScienceLab/rocrate-validator/profiles/five-safes-crate/> .
18+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
19+
@prefix schema: <http://schema.org/> .
20+
@prefix sh: <http://www.w3.org/ns/shacl#> .
21+
@prefix validator: <https://github.com/crs4/rocrate-validator/> .
22+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
23+
24+
25+
five-safes-crate:ResponsibleProject
26+
a sh:NodeShape ;
27+
sh:name "Responsible Project" ;
28+
sh:target [
29+
a sh:SPARQLTarget ;
30+
sh:prefixes ro-crate:sparqlPrefixes ;
31+
sh:select """
32+
SELECT DISTINCT ?this WHERE {
33+
?action a schema:CreateAction ;
34+
schema:agent ?agent .
35+
?agent schema:memberOf ?this .
36+
}
37+
"""
38+
] ;
39+
40+
sh:property [
41+
a sh:PropertyShape ;
42+
sh:name "funding" ;
43+
sh:path schema:funding;
44+
sh:class schema:Grant ;
45+
sh:severity sh:Violation ;
46+
sh:message """The property 'funding' of the Responsible Project MUST be of type schema:Grant.""" ;
47+
] .
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (c) 2024-2025 CRS4
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
@prefix ro: <./> .
16+
@prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> .
17+
@prefix five-safes-crate: <https://github.com/eScienceLab/rocrate-validator/profiles/five-safes-crate/> .
18+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
19+
@prefix schema: <http://schema.org/> .
20+
@prefix sh: <http://www.w3.org/ns/shacl#> .
21+
@prefix validator: <https://github.com/crs4/rocrate-validator/> .
22+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
23+
24+
25+
five-safes-crate:RootDataEntityRequiredProperties
26+
a sh:NodeShape ;
27+
sh:name "Root Data Entity" ;
28+
sh:targetClass ro-crate:RootDataEntity ;
29+
30+
sh:property [
31+
a sh:PropertyShape ;
32+
sh:name "sourceOrganization" ;
33+
sh:path schema:sourceOrganization;
34+
sh:minCount 1 ;
35+
sh:severity sh:Violation ;
36+
sh:message """The Root Data Entity MUST have a `sourceOrganization` property.""" ;
37+
] ;
38+
39+
sh:property [
40+
a sh:PropertyShape ;
41+
sh:name "sourceOrganization" ;
42+
sh:path schema:sourceOrganization ;
43+
sh:class schema:Project ;
44+
sh:severity sh:Violation ;
45+
sh:message """The `sourceOrganization` property of the Root Data Entity MUST point to a Project entity.""" ;
46+
] .
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (c) 2024-2025 CRS4
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
@prefix ro: <./> .
16+
@prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> .
17+
@prefix five-safes-crate: <https://github.com/eScienceLab/rocrate-validator/profiles/five-safes-crate/> .
18+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
19+
@prefix schema: <http://schema.org/> .
20+
@prefix sh: <http://www.w3.org/ns/shacl#> .
21+
@prefix validator: <https://github.com/crs4/rocrate-validator/> .
22+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
23+
24+
25+
five-safes-crate:AgentIsMemberOf
26+
a sh:NodeShape ;
27+
sh:name "Requesting Agent" ;
28+
sh:target [
29+
a sh:SPARQLTarget ;
30+
sh:prefixes ro-crate:sparqlPrefixes ;
31+
sh:select """
32+
SELECT DISTINCT ?this WHERE {
33+
?action a schema:CreateAction ;
34+
schema:agent ?this .
35+
}
36+
"""
37+
] ;
38+
39+
sh:property [
40+
a sh:PropertyShape ;
41+
sh:name "memberOf" ;
42+
sh:path schema:memberOf;
43+
sh:minCount 1 ;
44+
sh:severity sh:Warning ;
45+
sh:message """The Requesting Agent SHOULD have a `memberOf` property.""" ;
46+
] .

0 commit comments

Comments
 (0)