Skip to content

Commit 5cea22e

Browse files
committed
Addresses Eli's comments
1 parent c184c6a commit 5cea22e

File tree

5 files changed

+62
-5
lines changed

5 files changed

+62
-5
lines changed

rocrate_validator/profiles/five-safes-crate/should/1_responsible_project.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ five-safes-crate:ResponsibleProjectMemberAndSourceOrganizationIntersection
5656
}
5757
""" ;
5858
sh:severity sh:Warning ;
59-
sh:message """At least one of the organisations that are members of the responsible project SHOULD be included in the Requesting Agent's affiliations.""" ;
59+
sh:message """Responsible Project --> member SHOULD intersect Requesting Agent --> affiliation.""" ;
6060
] .

tests/data/crates/valid/five-safes-crate-request/ro-crate-metadata.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@
101101
"@type": "Organization",
102102
"name": "The University of Manchester"
103103
},
104+
{
105+
"@id": "https://ror.org/01ee9ar58",
106+
"@type": "Organization",
107+
"name": "University of Nottingham"
108+
},
104109
{
105110
"@id": "#project-be6ffb55-4f5a-4c14-b60e-47e0951090c70",
106111
"@type": "Project",

tests/data/crates/valid/five-safes-crate-result/ro-crate-metadata.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,11 @@
366366
"@type": "Organization",
367367
"name": "The University of Manchester"
368368
},
369+
{
370+
"@id": "https://ror.org/01ee9ar58",
371+
"@type": "Organization",
372+
"name": "University of Nottingham"
373+
},
369374
{
370375
"@id": "https://gtr.ukri.org/projects?ref=10038961",
371376
"@type": "Grant",

tests/integration/profiles/five-safes-crate/test_5src_1_requesting_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def test_5src_agent_memberOf_project_not_in_root():
7575
}
7676
INSERT {
7777
# assign the agent to a new Project that is not referenced by the Root Data Entity
78-
?agent schema:memberOf <./missing-project> .
79-
<./missing-project> a schema:Project .
78+
?agent schema:memberOf <#missing-project> .
79+
<#missing-project> a schema:Project .
8080
}
8181
WHERE {
8282
# locate a CreateAction -> agent -> memberOf that currently points to a Project

tests/integration/profiles/five-safes-crate/test_5src_1_responsible_project.py

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,53 @@ def test_5src_responsible_project_member_not_organization():
101101
)
102102

103103

104+
# ---- SHOULD warns tests
105+
106+
107+
def test_5src_responsible_project_member_and_agent_affiliation_no_intersection():
108+
"""
109+
Test a Five Safes Crate where none of the organisations that are members of the
110+
Responsible Project appear in the Requesting Agent's affiliations (violates the
111+
'Intersection with agent affiliations' SHACL warning).
112+
"""
113+
sparql = (
114+
SPARQL_PREFIXES
115+
+ """
116+
DELETE {
117+
?agent schema:affiliation ?oldAff .
118+
}
119+
INSERT {
120+
?agent schema:affiliation <#missing-affiliation> .
121+
<#missing-affiliation> a schema:Organization .
122+
}
123+
WHERE {
124+
?action a schema:CreateAction ;
125+
schema:agent ?agent .
126+
?agent a schema:Person ;
127+
schema:memberOf ?project ;
128+
schema:affiliation ?oldAff .
129+
?project schema:member ?org2 .
130+
131+
FILTER NOT EXISTS { ?project schema:member <#missing-affiliation> }
132+
}
133+
"""
134+
)
135+
136+
do_entity_test(
137+
rocrate_path=ValidROC().five_safes_crate_request,
138+
requirement_severity=Severity.RECOMMENDED,
139+
expected_validation_result=False,
140+
expected_triggered_requirements=[
141+
"Organizations (members of Responsible Project)"
142+
],
143+
expected_triggered_issues=[
144+
"Responsible Project --> member SHOULD intersect Requesting Agent --> affiliation."
145+
],
146+
profile_identifier="five-safes-crate",
147+
rocrate_entity_mod_sparql=sparql,
148+
)
149+
150+
104151
# ---- MAY warns tests
105152

106153

@@ -127,7 +174,7 @@ def test_5src_responsible_project_missing_funding_property():
127174
do_entity_test(
128175
rocrate_path=ValidROC().five_safes_crate_request,
129176
requirement_severity=Severity.OPTIONAL,
130-
expected_validation_result=False, # or True if Info is not treated as failure
177+
expected_validation_result=False,
131178
expected_triggered_requirements=["Responsible Project"],
132179
expected_triggered_issues=[
133180
"The Responsible Project does not have the property `funding`."
@@ -160,7 +207,7 @@ def test_5src_responsible_project_missing_member_property():
160207
do_entity_test(
161208
rocrate_path=ValidROC().five_safes_crate_request,
162209
requirement_severity=Severity.OPTIONAL,
163-
expected_validation_result=False, # or True if Info is treated as failure
210+
expected_validation_result=False,
164211
expected_triggered_requirements=["Responsible Project"],
165212
expected_triggered_issues=[
166213
"The Responsible Project does not have the property `member`."

0 commit comments

Comments
 (0)