Skip to content

Commit

Permalink
Add SHACL files for tasks, profiles, categories
Browse files Browse the repository at this point in the history
  • Loading branch information
Ostrzyciel committed Dec 14, 2023
1 parent 2bdfa2c commit 472251a
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/shacl/category.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@prefix : <https://w3id.org/riverbench/schema/dataset-shacl#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rb: <https://w3id.org/riverbench/schema/metadata#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix stax: <https://w3id.org/stax/ontology#> .
@prefix spdx: <http://spdx.org/rdf/terms#> .
@prefix void: <http://rdfs.org/ns/void#> .

# Exactly one category per file
:CategoryGraphShape
a sh:NodeShape ;
sh:targetNode rb:Category ;
sh:property [
sh:path [ sh:inversePath rdf:type ] ;
sh:minCount 1 ;
sh:maxCount 1 ;
]
.

:CategoryShape
a sh:NodeShape ;
sh:targetNode <https://w3id.org/riverbench/temp#category> ;
sh:property [
sh:path rdf:type ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:hasValue rb:Category ;
] , [
sh:path dcterms:conformsTo ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:hasValue <https://w3id.org/riverbench/schema/metadata> ;
] , [
sh:path dcterms:identifier ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:datatype xsd:string ;
] , [
sh:path dcterms:title ;
sh:minCount 1 ;
sh:datatype rdf:langString ;
sh:uniqueLang true ;
] , [
sh:path dcterms:description ;
sh:minCount 1 ;
sh:datatype rdf:langString ;
sh:uniqueLang true ;
]
.
45 changes: 45 additions & 0 deletions src/shacl/profile-collection.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@prefix : <https://w3id.org/riverbench/schema/dataset-shacl#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rb: <https://w3id.org/riverbench/schema/metadata#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix stax: <https://w3id.org/stax/ontology#> .
@prefix spdx: <http://spdx.org/rdf/terms#> .
@prefix void: <http://rdfs.org/ns/void#> .

# Shape file to validate entire profile collections.

# At least one profile per collection
:ProfileGraphShape
a sh:NodeShape ;
sh:targetNode rb:Profile ;
sh:property [
sh:path [ sh:inversePath rdf:type ] ;
sh:minCount 1 ;
]
.

# Profile shape
:ProfileShape
a sh:NodeShape ;
sh:targetClass rb:Profile ;
# Check if the children profiles exist
sh:property [
sh:path rb:isSupersetOfProfile ;
sh:nodeKind sh:IRI ;
sh:node [
sh:property [
sh:path rdf:type ;
sh:hasValue rb:Profile ;
]
]
]
.
79 changes: 79 additions & 0 deletions src/shacl/profile.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
@prefix : <https://w3id.org/riverbench/schema/dataset-shacl#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rb: <https://w3id.org/riverbench/schema/metadata#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix stax: <https://w3id.org/stax/ontology#> .
@prefix spdx: <http://spdx.org/rdf/terms#> .
@prefix void: <http://rdfs.org/ns/void#> .

# Shape file to validate single profile files.
# See also profile-collection.ttl for shapes to validate profile collections,
# i.e., all profiles in a benchmark category.

# Exactly one profile per file
:ProfileGraphShape
a sh:NodeShape ;
sh:targetNode rb:Profile ;
sh:property [
sh:path [ sh:inversePath rdf:type ] ;
sh:minCount 1 ;
sh:maxCount 1 ;
]
.

# We can't easily validate this in SHACL... but the ID should match the filename
# and URI.
:ProfileShape
a sh:NodeShape ;
sh:targetClass rb:Profile ;
sh:property [
sh:path rdf:type ;
sh:minCount 1 ;
sh:hasValue dcat:DatasetSeries ;
] , [
sh:path dcterms:identifier ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:datatype xsd:string ;
] , [
sh:path dcterms:title ;
sh:minCount 1 ;
sh:datatype rdf:langString ;
sh:uniqueLang true ;
] , [
sh:path dcterms:description ;
sh:minCount 1 ;
sh:datatype rdf:langString ;
sh:uniqueLang true ;
] , [
sh:path rb:hasDatasetShape ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:node [
sh:property [
sh:path sh:targetClass ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:hasValue rb:Dataset ;
] , [
sh:path sh:property ;
sh:minCount 1 ;
sh:nodeKind sh:BlankNodeOrIRI ;
]
]
] , [
sh:path rb:hasDistributionShape ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:nodeKind sh:BlankNodeOrIRI ;
]
.
62 changes: 62 additions & 0 deletions src/shacl/task.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@prefix : <https://w3id.org/riverbench/schema/dataset-shacl#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rb: <https://w3id.org/riverbench/schema/metadata#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix stax: <https://w3id.org/stax/ontology#> .
@prefix spdx: <http://spdx.org/rdf/terms#> .
@prefix void: <http://rdfs.org/ns/void#> .

# Exactly one task per file
:TaskGraphShape
a sh:NodeShape ;
sh:targetNode rb:Task ;
sh:property [
sh:path [ sh:inversePath rdf:type ] ;
sh:minCount 1 ;
sh:maxCount 1 ;
]
.

:TaskShape
a sh:NodeShape ;
sh:targetNode <https://w3id.org/riverbench/temp#task> ;
sh:property [
sh:path rdf:type ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:hasValue rb:Task ;
] , [
sh:path dcterms:conformsTo ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:hasValue <https://w3id.org/riverbench/schema/metadata> ;
] , [
sh:path dcterms:identifier ;
sh:minCount 1 ;
sh:maxCount 1 ;
sh:datatype xsd:string ;
] , [
sh:path dcterms:title ;
sh:minCount 1 ;
sh:datatype rdf:langString ;
sh:uniqueLang true ;
] , [
sh:path dcterms:description ;
sh:minCount 1 ;
sh:datatype rdf:langString ;
sh:uniqueLang true ;
] , [
sh:path dcterms:creator ;
sh:minCount 1 ;
sh:nodeKind sh:BlankNodeOrIRI ;
]
.

0 comments on commit 472251a

Please sign in to comment.