1111# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212# See the License for the specific language governing permissions and
1313# limitations under the License.
14-
1514@prefix ro: <./> .
1615@prefix ro-crate: <https://github.com/crs4/rocrate-validator/profiles/ro-crate/> .
1716@prefix dct: <http://purl.org/dc/terms/> .
2019@prefix sh: <http://www.w3.org/ns/shacl#> .
2120@prefix validator: <https://github.com/crs4/rocrate-validator/> .
2221
22+ ro-crate:ROCrateMetadataFileDescriptorExistence a sh:NodeShape ;
23+ sh:targetNode sh:Graph ;
24+ sh:name " RO-Crate Metadata File Descriptor entity existence" ;
25+ sh:description """ The RO-Crate JSON-LD MUST contain a Metadata File Descriptor entity named `ro-crate-metadata.json` and typed as `schema:CreativeWork`""" ;
26+ sh:sparql [
27+ a sh:SPARQLConstraint ;
28+ sh:name " RO-Crate Metadata File Descriptor entity existence" ;
29+ sh:description """ Check if the RO-Crate Metadata File Descriptor entity exists,
30+ i.e., if there exists an entity with @id `ro-crate-metadata.json` and type `schema:CreativeWork`""" ;
31+ sh:message """ The root of the document MUST have an entity with @id `ro-crate-metadata.json`, typed as `schema:CreativeWork` and with an `about` property referencing the Root Data Entity""" ;
32+ sh:prefixes ro-crate:sparqlPrefixes ;
33+ sh:select """
34+ SELECT ?this
35+ WHERE {
36+ FILTER NOT EXISTS {
37+ ?crate a schema:Dataset .
38+ ?md schema:about ?crate .
39+ ?md a schema:CreativeWork .
40+ FILTER( STRENDS(STR(?md), "ro-crate-metadata.json") )
41+ }
42+ }
43+ """ ;
44+ ] .
2345
24- ro-crate:FindROCrateMetadataFileDescriptorEntity a sh:NodeShape, validator:HiddenShape;
46+ ro-crate:FindROCrateMetadataFileDescriptorEntity a sh:NodeShape, validator:HiddenShape ;
2547 sh:name " Identify the RO-Crate Metadata File Descriptor" ;
2648 sh:description """ The RO-Crate Metadata File Descriptor entity describes the RO-Crate itself, and it is named as `ro-crate-metadata.json`.
2749 It can be identified by name according to the RO-Crate specification
@@ -32,7 +54,8 @@ ro-crate:FindROCrateMetadataFileDescriptorEntity a sh:NodeShape, validator:Hidde
3254 sh:select """
3355 SELECT ?this
3456 WHERE {
35- ?this a schema:CreativeWork ;
57+ ?crate a schema:Dataset .
58+ ?this schema:about ?crate .
3659 FILTER(contains(str(?this), "ro-crate-metadata.json"))
3760 }
3861 """
@@ -46,29 +69,12 @@ ro-crate:FindROCrateMetadataFileDescriptorEntity a sh:NodeShape, validator:Hidde
4669 sh:object ro-crate:ROCrateMetadataFileDescriptor ;
4770 ] .
4871
49- ro-crate:ROCrateMetadataFileDescriptorExistence
50- a sh:NodeShape ;
51- sh:name " RO-Crate Metadata File Descriptor entity existence" ;
52- sh:description " The RO-Crate JSON-LD MUST contain a Metadata File Descriptor entity named `ro-crate-metadata.json` and typed as `schema:CreativeWork`" ;
53- sh:targetNode ro:ro-crate-metadata.json ;
54- sh:property [
55- a sh:PropertyShape ;
56- sh:name " RO-Crate Metadata File Descriptor entity existence" ;
57- sh:description """ Check if the RO-Crate Metadata File Descriptor entity exists,
58- i.e., if there exists an entity with @id `ro-crate-metadata.json` and type `schema:CreativeWork`""" ;
59- sh:path rdf:type ;
60- sh:hasValue ro-crate:ROCrateMetadataFileDescriptor ;
61- sh:minCount 1 ;
62- sh:message " The root of the document MUST have an entity with @id `ro-crate-metadata.json`" ;
63- ] .
64-
6572ro-crate:ROCrateMetadataFileDescriptorRecommendedProperties a sh:NodeShape ;
6673 sh:name " RO-Crate Metadata File Descriptor REQUIRED properties" ;
6774 sh:description """ RO-Crate Metadata Descriptor MUST be defined
68- according with the requirements details defined in
69- [RO-Crate Metadata File Descriptor](https://www.researchobject.org/ro-crate/1.1/root-data-entity.html#ro-crate-metadata-file-descriptor)""" ;
70- sh:targetNode ro:ro-crate-metadata.json ;
71- sh:property [
75+ according with the requirements details defined in [RO-Crate Metadata File Descriptor](https://www.researchobject.org/ro-crate/1.1/root-data-entity.html#ro-crate-metadata-file-descriptor)""" ;
76+ sh:targetClass ro-crate:ROCrateMetadataFileDescriptor ;
77+ sh:property [
7278 a sh:PropertyShape ;
7379 sh:name " Metadata File Descriptor entity type" ;
7480 sh:description " Check if the RO-Crate Metadata File Descriptor has `@type` CreativeWork, as per schema.org" ;
@@ -78,11 +84,11 @@ ro-crate:ROCrateMetadataFileDescriptorRecommendedProperties a sh:NodeShape ;
7884 sh:hasValue schema_org:CreativeWork ;
7985 sh:message " The RO-Crate metadata file MUST be a CreativeWork, as per schema.org" ;
8086 ] ;
81- sh:property [
87+ sh:property [
8288 a sh:PropertyShape ;
8389 sh:name " Metadata File Descriptor entity: `about` property" ;
8490 sh:description """ Check if the RO-Crate Metadata File Descriptor has an `about` property referencing the Root Data Entity""" ;
85- sh:maxCount 1 ;
91+ sh:maxCount 1 ;
8692 sh:minCount 1 ;
8793 sh:nodeKind sh:IRI ;
8894 sh:path schema_org:about ;
0 commit comments