-
Notifications
You must be signed in to change notification settings - Fork 8
/
basic-cube-constraint-ml.ttl
72 lines (67 loc) · 2.37 KB
/
basic-cube-constraint-ml.ttl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@prefix : <https://cube.link/shape/basic-cube-constraint-ml#> .
@prefix dash: <http://datashapes.org/dash#> .
@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 sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix cube: <https://cube.link/> .
#
# This is the bare minimal SHACL shape for validating a cube.
# All cubes should pass this validation.
#
:CubeShape
a sh:NodeShape ;
sh:targetClass cube:Cube ;
sh:property [
sh:path cube:observationSet ;
sh:minCount 1 ;
sh:node :ObservationSetShape ;
sh:message "cube:Cube needs at least one cube:ObservationSet"
];
sh:property [
# optional, but recommended
sh:path cube:observationConstraint ;
sh:node :ObservationConstraintShape ;
sh:message "cube:Cube must point to a valid cube:Constraint"
] .
:ObservationSetShape
a sh:NodeShape ;
sh:targetClass cube:ObservationSet ;
sh:property [
sh:path cube:observation ;
sh:minCount 1 ;
sh:message "cube:ObservationSet needs at least one cube:observation"
] .
:ObservationConstraintShape
a sh:NodeShape ;
sh:targetClass cube:Constraint ;
sh:property [
# we assume at least 3 dimensions, otherwise we would have an empty list of dimensions
# one for cube:observedBy, one for rdf:type and at least one cube dimension
sh:path sh:property ;
sh:minCount 3 ;
sh:message "cube:Constraint needs at least a certain amount of sh:properties"
] ,
[
# we assume at least 3 dimensions, otherwise we would have an empty list of dimensions
# one for cube:observedBy, one for rdf:type and at least one cube dimension
sh:path sh:property ;
sh:node :SchemaNameML ;
sh:message "When Schema:name is provided it should have all 3 languages"
] .
:SchemaNameML a sh:NodeShape ;
sh:property [
sh:or(
[
sh:path schema:name;
sh:minCount 3;
sh:languageIn ( "en" "fr" "de" );
sh:message "When Schema:name is provided it should have all required languages"
]
[
sh:path sh:path;
sh:in (rdf:type cube:observedBy);
]
)
] .