Skip to content

Commit a5c2b34

Browse files
committed
changed sh:or to sh:xone
1 parent 38243b3 commit a5c2b34

2 files changed

Lines changed: 36 additions & 5 deletions

File tree

rocrate_validator/profiles/five-safes-crate/should/5_profile_conformance.ttl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,13 @@ five-safes-crate:RootDatasetLicenseWhenPublished
6464
sh:description "If the root dataset is published (has schema:publisher), it SHOULD declare a license." ;
6565
sh:targetClass ro-crate:RootDataEntity ;
6666
sh:severity sh:Warning ;
67-
sh:message "Profile Conformance: Published crates SHOULD include a license." ;
68-
sh:or (
69-
# license not required if no publisher:
67+
sh:message "A crate SHOULD include a license if and only if it has a publisher." ;
68+
sh:xone (
69+
# license SHOULD be present if and only if the publisher is specified:
7070
[ sh:not [ sh:property [
7171
sh:path schema:publisher ;
7272
sh:minCount 1 ;
7373
]]]
74-
# license required if publisher present:
7574
[ sh:property [
7675
sh:path schema:license ;
7776
sh:minCount 1 ;

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

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,39 @@ def test_5src_root_data_entity_has_publisher_but_not_license():
183183
expected_validation_result=False,
184184
expected_triggered_requirements=["License present on published crates"],
185185
expected_triggered_issues=[
186-
"Profile Conformance: Published crates SHOULD include a license."
186+
"A crate SHOULD include a license if and only if it has a publisher."
187+
],
188+
profile_identifier="five-safes-crate",
189+
rocrate_entity_mod_sparql=sparql,
190+
)
191+
192+
193+
def test_5src_root_data_entity_has_license_but_not_publisher():
194+
"""
195+
Test a Five Safes Crate where the RootDataEntity has publisher but not license.
196+
"""
197+
sparql = (
198+
SPARQL_PREFIXES
199+
+ """
200+
DELETE {
201+
?rootdataentity schema:publisher ?publisher .
202+
}
203+
WHERE {
204+
?metadatafile a schema:CreativeWork ;
205+
schema:about ?rootdataentity .
206+
?rootdataentity schema:publisher ?publisher ;
207+
schema:license ?license .
208+
}
209+
"""
210+
)
211+
212+
do_entity_test(
213+
rocrate_path=ValidROC().five_safes_crate_result,
214+
requirement_severity=Severity.RECOMMENDED,
215+
expected_validation_result=False,
216+
expected_triggered_requirements=["License present on published crates"],
217+
expected_triggered_issues=[
218+
"A crate SHOULD include a license if and only if it has a publisher."
187219
],
188220
profile_identifier="five-safes-crate",
189221
rocrate_entity_mod_sparql=sparql,

0 commit comments

Comments
 (0)