Skip to content

Commit 6399536

Browse files
committed
(1) Changed to , (2) Replaced with , and (3) added a test to account for the new potential failing situation introduced by point 2.
1 parent 95ecd30 commit 6399536

2 files changed

Lines changed: 37 additions & 6 deletions

File tree

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,13 @@ five-safes-crate:RootDatasetDatePublishedWhenPublished
4545
sh:description "If the root dataset is published (has schema:publisher), it SHOULD have schema:datePublished." ;
4646
sh:targetClass ro-crate:RootDataEntity ;
4747
sh:severity sh:Warning ;
48-
sh:message "Published crates SHOULD include schema:datePublished." ;
49-
sh:or (
50-
# datePublished not required if no publisher:
48+
sh:message "A crate SHOULD have a publishedDate if and only if it has a publisher." ;
49+
sh:xone (
50+
# datePublished SHOULD be present if and only if the publisher is specified:
5151
[ sh:not [ sh:property [
5252
sh:path schema:publisher ;
5353
sh:minCount 1 ;
5454
]]]
55-
# datePublished required if publisher present:
5655
[ sh:property [
5756
sh:path schema:datePublished ;
5857
sh:minCount 1 ;
@@ -63,7 +62,7 @@ five-safes-crate:RootDatasetLicenseWhenPublished
6362
a sh:NodeShape ;
6463
sh:name "License present on published crates" ;
6564
sh:description "If the root dataset is published (has schema:publisher), it SHOULD declare a license." ;
66-
sh:targetNode ro: ;
65+
sh:targetClass ro-crate:RootDataEntity ;
6766
sh:severity sh:Warning ;
6867
sh:message "Profile Conformance: Published crates SHOULD include a license." ;
6968
sh:or (

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
@@ -119,7 +119,39 @@ def test_5src_root_data_entity_has_publisher_but_not_date_published():
119119
expected_validation_result=False,
120120
expected_triggered_requirements=["datePublished present on published crates"],
121121
expected_triggered_issues=[
122-
"Published crates SHOULD include schema:datePublished."
122+
"A crate SHOULD have a publishedDate if and only if it has a publisher."
123+
],
124+
profile_identifier="five-safes-crate",
125+
rocrate_entity_mod_sparql=sparql,
126+
)
127+
128+
129+
def test_5src_root_data_entity_has_date_published_but_not_publisher():
130+
"""
131+
Test a Five Safes Crate where the RootDataEntity has published but not date published.
132+
"""
133+
sparql = (
134+
SPARQL_PREFIXES
135+
+ """
136+
DELETE {
137+
?rootdataentity schema:datePublished ?datePublished .
138+
}
139+
WHERE {
140+
?metadatafile a schema:CreativeWork ;
141+
schema:about ?rootdataentity .
142+
?rootdataentity schema:publisher ?publisher ;
143+
schema:datePublished ?datePublished .
144+
}
145+
"""
146+
)
147+
148+
do_entity_test(
149+
rocrate_path=ValidROC().five_safes_crate_result,
150+
requirement_severity=Severity.RECOMMENDED,
151+
expected_validation_result=False,
152+
expected_triggered_requirements=["datePublished present on published crates"],
153+
expected_triggered_issues=[
154+
"A crate SHOULD have a publishedDate if and only if it has a publisher."
123155
],
124156
profile_identifier="five-safes-crate",
125157
rocrate_entity_mod_sparql=sparql,

0 commit comments

Comments
 (0)