@quickpipeaiab/domain 0.0.0-stage → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,555 @@
1
+ @prefix core: <https://id.quickpipe.ai/domain/core#> .
2
+ @prefix scoring: <https://id.quickpipe.ai/domain/scoring#> .
3
+ @prefix scoring-vocab: <https://id.quickpipe.ai/domain/vocab/scoring#> .
4
+ @prefix scoring-shapes: <https://id.quickpipe.ai/domain/shapes/scoring#> .
5
+ @prefix identity: <https://id.quickpipe.ai/domain/identity#> .
6
+ @prefix identity-vocab: <https://id.quickpipe.ai/domain/vocab/identity#> .
7
+ @prefix events: <https://id.quickpipe.ai/domain/events#> .
8
+ @prefix events-vocab: <https://id.quickpipe.ai/domain/vocab/events#> .
9
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
10
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
11
+ @prefix sh: <http://www.w3.org/ns/shacl#> .
12
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
13
+
14
+ <https://id.quickpipe.ai/domain/shapes/scoring>
15
+ a owl:Ontology ;
16
+ owl:versionIRI <https://id.quickpipe.ai/domain/0.10.0/shapes/scoring> ;
17
+ owl:versionInfo "0.10.0" ;
18
+ core:title "QuickPipe domain model: shapes of scoring"@en ;
19
+ sh:declare
20
+ [ sh:prefix "core" ; sh:namespace "https://id.quickpipe.ai/domain/core#"^^xsd:anyURI ] ,
21
+ [ sh:prefix "identity" ; sh:namespace "https://id.quickpipe.ai/domain/identity#"^^xsd:anyURI ] ,
22
+ [ sh:prefix "events" ; sh:namespace "https://id.quickpipe.ai/domain/events#"^^xsd:anyURI ] ,
23
+ [ sh:prefix "scoring" ; sh:namespace "https://id.quickpipe.ai/domain/scoring#"^^xsd:anyURI ] ,
24
+ [ sh:prefix "scoring-vocab" ; sh:namespace "https://id.quickpipe.ai/domain/vocab/scoring#"^^xsd:anyURI ] ,
25
+ [ sh:prefix "xsd" ; sh:namespace "http://www.w3.org/2001/XMLSchema#"^^xsd:anyURI ] .
26
+
27
+ # Values of open schemes (docs/decisions/0003-modelling-patterns.md, Value sets): the value is a concept of the scheme.
28
+
29
+ scoring-shapes:tier-concept-shape a sh:NodeShape ;
30
+ sh:class core:concept ;
31
+ sh:property [ sh:path core:in-scheme ; sh:hasValue scoring-vocab:tier ; sh:message "The value must be a tier of the scheme of tiers." ] .
32
+
33
+ scoring-shapes:stage-concept-shape a sh:NodeShape ;
34
+ sh:class core:concept ;
35
+ sh:property [ sh:path core:in-scheme ; sh:hasValue scoring-vocab:stage ; sh:message "The value must be a stage: a tier key or none." ] .
36
+
37
+ scoring-shapes:band-concept-shape a sh:NodeShape ;
38
+ sh:class core:concept ;
39
+ sh:property [ sh:path core:in-scheme ; sh:hasValue scoring-vocab:band ; sh:message "The value must be a band of the scheme of bands." ] .
40
+
41
+ scoring-shapes:persona-concept-shape a sh:NodeShape ;
42
+ sh:class core:concept ;
43
+ sh:property [ sh:path core:in-scheme ; sh:hasValue scoring-vocab:persona ; sh:message "The value must be a persona of the scheme of personas." ] .
44
+
45
+ scoring-shapes:dimension-concept-shape a sh:NodeShape ;
46
+ sh:class core:concept ;
47
+ sh:property [ sh:path core:in-scheme ; sh:hasValue scoring-vocab:dimension ; sh:message "The value must be a dimension of the scheme of dimensions." ] .
48
+
49
+ scoring-shapes:assertion-concept-shape a sh:NodeShape ;
50
+ sh:class core:concept ;
51
+ sh:property [ sh:path core:in-scheme ; sh:hasValue scoring-vocab:assertion ; sh:message "The value must be an assertion operator of the scheme of assertions." ] .
52
+
53
+ scoring-shapes:event-name-concept-shape a sh:NodeShape ;
54
+ sh:class core:concept ;
55
+ sh:property [ sh:path core:in-scheme ; sh:hasValue events-vocab:event-name ; sh:message "The value must be an event name of the scheme of event names." ] .
56
+
57
+ scoring-shapes:identifier-name-concept-shape a sh:NodeShape ;
58
+ sh:class core:concept ;
59
+ sh:property [ sh:path core:in-scheme ; sh:hasValue identity-vocab:identifier-name ; sh:message "The value must be an identifier name of the scheme of identifier names." ] .
60
+
61
+ scoring-shapes:signal-shape a sh:NodeShape ;
62
+ sh:targetClass scoring:signal ;
63
+ sh:closed true ;
64
+ sh:ignoredProperties ( rdf:type ) ;
65
+ sh:property
66
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
67
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
68
+ [ sh:path core:has-name ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A signal must have exactly one name." ] ,
69
+ [ sh:path scoring:has-label ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A signal must have exactly one label." ] ,
70
+ [ sh:path identity:has-subject-kind ; sh:in ( identity-vocab:subject-kind-person identity-vocab:subject-kind-account ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A signal must have exactly one subject kind: person or account." ] ,
71
+ [ sh:path scoring:has-property-schema ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:message "A signal has at most one property schema." ] .
72
+
73
+ scoring-shapes:mapping-shape a sh:NodeShape ;
74
+ sh:targetClass scoring:mapping ;
75
+ sh:closed true ;
76
+ sh:ignoredProperties ( rdf:type ) ;
77
+ sh:property
78
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
79
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
80
+ [ sh:path scoring:for-campaign-id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one campaignId." ] .
81
+
82
+ scoring-shapes:workspace-mapping-shape a sh:NodeShape ;
83
+ sh:targetClass scoring:workspace-mapping ;
84
+ sh:closed true ;
85
+ sh:ignoredProperties ( rdf:type ) ;
86
+ sh:property
87
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
88
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] .
89
+
90
+ scoring-shapes:campaign-mapping-shape a sh:NodeShape ;
91
+ sh:targetClass scoring:campaign-mapping ;
92
+ sh:closed true ;
93
+ sh:ignoredProperties ( rdf:type ) ;
94
+ sh:property
95
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
96
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
97
+ [ sh:path scoring:for-campaign-id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A campaign mapping or decision must have exactly one campaignId." ] .
98
+
99
+ scoring-shapes:mapping-version-shape a sh:NodeShape ;
100
+ sh:targetClass scoring:mapping-version ;
101
+ sh:closed true ;
102
+ sh:ignoredProperties ( rdf:type ) ;
103
+ sh:property
104
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
105
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
106
+ [ sh:path scoring:of-mapping ; sh:class scoring:mapping ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A mapping version must belong to exactly one mapping." ] ,
107
+ [ sh:path scoring:has-number ; sh:datatype xsd:positiveInteger ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A mapping version must have exactly one number." ] ,
108
+ [ sh:path core:was-revision-of ; sh:class scoring:mapping-version ; sh:maxCount 1 ; sh:message "A mapping version revises at most one previous version." ] ,
109
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:message "A mapping version has at most one creation time." ] .
110
+
111
+ scoring-shapes:mapping-entry-shape a sh:NodeShape ;
112
+ sh:targetClass scoring:mapping-entry ;
113
+ sh:closed true ;
114
+ sh:ignoredProperties ( rdf:type ) ;
115
+ sh:xone ( [ sh:path scoring:to-signal ; sh:minCount 1 ] [ sh:path identity:has-identifier-name ; sh:minCount 1 ] ) ;
116
+ sh:message "A mapping entry gives either a signal or an identifier value." ;
117
+ sh:property
118
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
119
+ [ sh:path scoring:in-mapping-version ; sh:class scoring:mapping-version ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A mapping entry must belong to exactly one mapping version." ] ,
120
+ [ sh:path scoring:from-event-name ; sh:node scoring-shapes:event-name-concept-shape ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A mapping entry must read exactly one event name." ] ,
121
+ [ sh:path scoring:to-signal ; sh:class scoring:signal ; sh:maxCount 1 ; sh:message "A mapping entry gives at most one signal." ] ,
122
+ [ sh:path identity:has-identifier-name ; sh:node scoring-shapes:identifier-name-concept-shape ; sh:maxCount 1 ; sh:message "A mapping entry gives at most one identifier name." ] ,
123
+ [ sh:path scoring:has-when ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:message "A mapping entry has at most one when expression." ] ,
124
+ [ sh:path scoring:has-map ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:message "A mapping entry has at most one map expression." ] .
125
+
126
+ scoring-shapes:decision-shape a sh:NodeShape ;
127
+ sh:targetClass scoring:decision ;
128
+ sh:closed true ;
129
+ sh:ignoredProperties ( rdf:type ) ;
130
+ sh:property
131
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
132
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
133
+ [ sh:path scoring:has-decision-kind ; sh:in ( scoring-vocab:decision-kind-campaign scoring-vocab:decision-kind-person scoring-vocab:decision-kind-account ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A decision must have exactly one kind: campaign, person or account." ] ,
134
+ [ sh:path scoring:from-template ; sh:class scoring:template-version ; sh:maxCount 1 ; sh:message "A decision is a copy of at most one template version." ] ,
135
+ [ sh:path scoring:for-campaign-id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one campaignId." ] .
136
+
137
+ scoring-shapes:campaign-decision-shape a sh:NodeShape ;
138
+ sh:targetClass scoring:campaign-decision ;
139
+ sh:closed true ;
140
+ sh:ignoredProperties ( rdf:type ) ;
141
+ sh:property
142
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
143
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
144
+ [ sh:path scoring:has-decision-kind ; sh:in ( scoring-vocab:decision-kind-campaign scoring-vocab:decision-kind-person scoring-vocab:decision-kind-account ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A decision must have exactly one kind: campaign, person or account." ] ,
145
+ [ sh:path scoring:from-template ; sh:class scoring:template-version ; sh:maxCount 1 ; sh:message "A decision is a copy of at most one template version." ] ,
146
+ [ sh:path scoring:for-campaign-id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A campaign mapping or decision must have exactly one campaignId." ] .
147
+
148
+ scoring-shapes:person-decision-shape a sh:NodeShape ;
149
+ sh:targetClass scoring:person-decision ;
150
+ sh:closed true ;
151
+ sh:ignoredProperties ( rdf:type ) ;
152
+ sh:property
153
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
154
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
155
+ [ sh:path scoring:has-decision-kind ; sh:in ( scoring-vocab:decision-kind-campaign scoring-vocab:decision-kind-person scoring-vocab:decision-kind-account ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A decision must have exactly one kind: campaign, person or account." ] ,
156
+ [ sh:path scoring:from-template ; sh:class scoring:template-version ; sh:maxCount 1 ; sh:message "A decision is a copy of at most one template version." ] .
157
+
158
+ scoring-shapes:account-decision-shape a sh:NodeShape ;
159
+ sh:targetClass scoring:account-decision ;
160
+ sh:closed true ;
161
+ sh:ignoredProperties ( rdf:type ) ;
162
+ sh:property
163
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
164
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
165
+ [ sh:path scoring:has-decision-kind ; sh:in ( scoring-vocab:decision-kind-campaign scoring-vocab:decision-kind-person scoring-vocab:decision-kind-account ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A decision must have exactly one kind: campaign, person or account." ] ,
166
+ [ sh:path scoring:from-template ; sh:class scoring:template-version ; sh:maxCount 1 ; sh:message "A decision is a copy of at most one template version." ] .
167
+
168
+ scoring-shapes:decision-version-shape a sh:NodeShape ;
169
+ sh:targetClass scoring:decision-version ;
170
+ sh:closed true ;
171
+ sh:ignoredProperties ( rdf:type ) ;
172
+ sh:property
173
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
174
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
175
+ [ sh:path scoring:of-decision ; sh:class scoring:decision ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A decision version must belong to exactly one decision." ] ,
176
+ [ sh:path scoring:has-number ; sh:datatype xsd:positiveInteger ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A decision version must have exactly one number." ] ,
177
+ [ sh:path scoring:has-graph ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A decision version must have exactly one decision graph." ] ,
178
+ [ sh:path scoring:declares-uses ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:message "A decision version has at most one uses declaration." ] ,
179
+ [ sh:path scoring:has-mapping-version ; sh:class scoring:mapping-version ; sh:message "A mapping of a decision version must be a mapping version." ] ,
180
+ [ sh:path scoring:references-event-name ; sh:node scoring-shapes:event-name-concept-shape ; sh:message "A referenced event name must be in the scheme of event names." ] ,
181
+ [ sh:path scoring:references-signal ; sh:class scoring:signal ; sh:message "A referenced signal must be a signal." ] ,
182
+ [ sh:path core:was-revision-of ; sh:class scoring:decision-version ; sh:maxCount 1 ; sh:message "A decision version revises at most one previous version." ] ,
183
+ [ sh:path core:was-attributed-to ; sh:class core:agent ; sh:maxCount 1 ; sh:message "A decision version has at most one author." ] ,
184
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:message "A decision version has at most one creation time." ] .
185
+
186
+ scoring-shapes:decision-test-shape a sh:NodeShape ;
187
+ sh:targetClass scoring:decision-test ;
188
+ sh:closed true ;
189
+ sh:ignoredProperties ( rdf:type ) ;
190
+ sh:property
191
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
192
+ [ sh:path scoring:of-version ; sh:class scoring:decision-version ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A test must belong to exactly one decision version." ] ,
193
+ [ sh:path core:has-name ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A test must have exactly one name." ] ,
194
+ [ sh:path scoring:has-test-input ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A test must have exactly one partial input." ] ,
195
+ [ sh:path scoring:from-test-subject ; sh:class identity:subject ; sh:maxCount 1 ; sh:message "A test comes from at most one subject." ] ,
196
+ [ sh:path [ sh:inversePath scoring:in-test ] ; sh:class scoring:assertion ; sh:minCount 1 ; sh:message "A test must have one assertion or more." ] .
197
+
198
+ scoring-shapes:assertion-shape a sh:NodeShape ;
199
+ sh:targetClass scoring:assertion ;
200
+ sh:closed true ;
201
+ sh:ignoredProperties ( rdf:type ) ;
202
+ sh:property
203
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
204
+ [ sh:path scoring:in-test ; sh:class scoring:decision-test ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An assertion must belong to exactly one test." ] ,
205
+ [ sh:path scoring:has-path ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An assertion must have exactly one output path." ] ,
206
+ [ sh:path scoring:has-operator ; sh:node scoring-shapes:assertion-concept-shape ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An assertion must have exactly one operator." ] ,
207
+ [ sh:path scoring:has-expected ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An assertion must have exactly one expected value." ] .
208
+
209
+ scoring-shapes:output-shape a sh:NodeShape ;
210
+ sh:targetClass scoring:output ;
211
+ sh:closed true ;
212
+ sh:ignoredProperties ( rdf:type ) ;
213
+ sh:property
214
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
215
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
216
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one subject." ] ,
217
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one start time." ] ,
218
+ [ sh:path core:was-generated-by ; sh:class scoring:evaluation ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An output must come from exactly one evaluation." ] ,
219
+ [ sh:path scoring:has-score ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An output must have exactly one score from 0 to 1." ] ,
220
+ [ sh:path scoring:has-state ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:message "An output has at most one state." ] ,
221
+ [ sh:path scoring:has-emit ; sh:datatype xsd:string ; sh:pattern "^[a-z0-9][a-z0-9_.:-]{0,99}$" ; sh:maxCount 20 ; sh:message "emit has at most 20 values, and each value matches the event name pattern." ] ,
222
+ [ sh:path scoring:has-tier-level ; sh:class scoring:tier-level ; sh:message "A tier level of an output must be a tier level." ] ,
223
+ [ sh:path scoring:has-dimension-value ; sh:class scoring:dimension-value ; sh:message "A dimension of an output must be a dimension value." ] ,
224
+ [ sh:path scoring:has-persona ; sh:node scoring-shapes:persona-concept-shape ; sh:maxCount 1 ; sh:message "An output of a person has zero or one persona from the registry." ] ;
225
+ sh:sparql [
226
+ a sh:SPARQLConstraint ;
227
+ sh:message "The subject of an output must be the subject of the evaluation that generated it." ;
228
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/scoring> ;
229
+ sh:select """
230
+ SELECT $this ?value WHERE {
231
+ $this identity:of-subject ?value ; core:was-generated-by ?evaluation .
232
+ ?evaluation identity:of-subject ?other .
233
+ FILTER (?value != ?other)
234
+ }""" ] .
235
+
236
+ scoring-shapes:campaign-output-shape a sh:NodeShape ;
237
+ sh:targetClass scoring:campaign-output ;
238
+ sh:closed true ;
239
+ sh:ignoredProperties ( rdf:type ) ;
240
+ sh:property
241
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
242
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
243
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one subject." ] ,
244
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one start time." ] ,
245
+ [ sh:path core:was-generated-by ; sh:class scoring:evaluation ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An output must come from exactly one evaluation." ] ,
246
+ [ sh:path scoring:has-score ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An output must have exactly one score from 0 to 1." ] ,
247
+ [ sh:path scoring:has-state ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:message "An output has at most one state." ] ,
248
+ [ sh:path scoring:has-emit ; sh:datatype xsd:string ; sh:pattern "^[a-z0-9][a-z0-9_.:-]{0,99}$" ; sh:maxCount 20 ; sh:message "emit has at most 20 values, and each value matches the event name pattern." ] .
249
+
250
+ scoring-shapes:person-output-shape a sh:NodeShape ;
251
+ sh:targetClass scoring:person-output ;
252
+ sh:closed true ;
253
+ sh:ignoredProperties ( rdf:type ) ;
254
+ sh:property
255
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
256
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
257
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one subject." ] ,
258
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one start time." ] ,
259
+ [ sh:path core:was-generated-by ; sh:class scoring:evaluation ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An output must come from exactly one evaluation." ] ,
260
+ [ sh:path scoring:has-score ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An output must have exactly one score from 0 to 1." ] ,
261
+ [ sh:path scoring:has-state ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:message "An output has at most one state." ] ,
262
+ [ sh:path scoring:has-emit ; sh:datatype xsd:string ; sh:pattern "^[a-z0-9][a-z0-9_.:-]{0,99}$" ; sh:maxCount 20 ; sh:message "emit has at most 20 values, and each value matches the event name pattern." ] ,
263
+ [ sh:path scoring:has-tier-level ; sh:class scoring:tier-level ; sh:message "A tier level of an output must be a tier level." ] ,
264
+ [ sh:path scoring:has-dimension-value ; sh:class scoring:dimension-value ; sh:message "A dimension of an output must be a dimension value." ] ,
265
+ [ sh:path scoring:has-persona ; sh:node scoring-shapes:persona-concept-shape ; sh:maxCount 1 ; sh:message "An output of a person has zero or one persona from the registry." ] .
266
+
267
+ scoring-shapes:account-output-shape a sh:NodeShape ;
268
+ sh:targetClass scoring:account-output ;
269
+ sh:closed true ;
270
+ sh:ignoredProperties ( rdf:type ) ;
271
+ sh:property
272
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
273
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
274
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one subject." ] ,
275
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one start time." ] ,
276
+ [ sh:path core:was-generated-by ; sh:class scoring:evaluation ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An output must come from exactly one evaluation." ] ,
277
+ [ sh:path scoring:has-score ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An output must have exactly one score from 0 to 1." ] ,
278
+ [ sh:path scoring:has-state ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:message "An output has at most one state." ] ,
279
+ [ sh:path scoring:has-emit ; sh:datatype xsd:string ; sh:pattern "^[a-z0-9][a-z0-9_.:-]{0,99}$" ; sh:maxCount 20 ; sh:message "emit has at most 20 values, and each value matches the event name pattern." ] ,
280
+ [ sh:path scoring:has-tier-level ; sh:class scoring:tier-level ; sh:message "A tier level of an output must be a tier level." ] ,
281
+ [ sh:path scoring:has-dimension-value ; sh:class scoring:dimension-value ; sh:message "A dimension of an output must be a dimension value." ] .
282
+
283
+ scoring-shapes:tier-level-shape a sh:NodeShape ;
284
+ sh:targetClass scoring:tier-level ;
285
+ sh:closed true ;
286
+ sh:ignoredProperties ( rdf:type ) ;
287
+ sh:property
288
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
289
+ [ sh:path scoring:has-key ; sh:datatype xsd:string ; sh:pattern "^[a-z][a-z0-9_]{0,63}$" ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A level must have exactly one registry key." ] ,
290
+ [ sh:path scoring:has-level ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A level must have exactly one number from 0 to 1." ] .
291
+
292
+ scoring-shapes:dimension-value-shape a sh:NodeShape ;
293
+ sh:targetClass scoring:dimension-value ;
294
+ sh:closed true ;
295
+ sh:ignoredProperties ( rdf:type ) ;
296
+ sh:property
297
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
298
+ [ sh:path scoring:has-key ; sh:datatype xsd:string ; sh:pattern "^[a-z][a-z0-9_]{0,63}$" ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A level must have exactly one registry key." ] ,
299
+ [ sh:path scoring:has-level ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A level must have exactly one number from 0 to 1." ] .
300
+
301
+ scoring-shapes:tier-membership-shape a sh:NodeShape ;
302
+ sh:targetClass scoring:tier-membership ;
303
+ sh:closed true ;
304
+ sh:ignoredProperties ( rdf:type ) ;
305
+ sh:property
306
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
307
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
308
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one subject." ] ,
309
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one start time." ] ,
310
+ [ sh:path core:invalidated-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:message "The record has at most one end time." ] ,
311
+ [ sh:path events:of-tier ; sh:node scoring-shapes:tier-concept-shape ; sh:not [ sh:hasValue scoring-vocab:stage-none ] ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A tier membership must have exactly one tier of the registry." ] ,
312
+ [ sh:path core:was-generated-by ; sh:or ( [ sh:class scoring:evaluation ] [ sh:class scoring:registry-change ] ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A tier membership must come from exactly one evaluation or registry change." ] ,
313
+ [ sh:path scoring:is-late ; sh:datatype xsd:boolean ; sh:maxCount 1 ; sh:message "A tier membership has at most one late flag." ] ,
314
+ [ sh:path scoring:ended-by ; sh:or ( [ sh:class scoring:evaluation ] [ sh:class scoring:registry-change ] ) ; sh:maxCount 1 ; sh:message "A tier membership ends by at most one evaluation or registry change." ] ;
315
+ sh:sparql [
316
+ a sh:SPARQLConstraint ;
317
+ sh:message "A tier membership that has an evaluation or registry change as the cause of its exit must have an end time." ;
318
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/scoring> ;
319
+ sh:select """
320
+ SELECT $this WHERE {
321
+ $this scoring:ended-by ?cause .
322
+ FILTER NOT EXISTS { $this core:invalidated-at ?end }
323
+ }""" ] .
324
+
325
+ scoring-shapes:stage-assignment-shape a sh:NodeShape ;
326
+ sh:targetClass scoring:stage-assignment ;
327
+ sh:closed true ;
328
+ sh:ignoredProperties ( rdf:type ) ;
329
+ sh:property
330
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
331
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
332
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one subject." ] ,
333
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one start time." ] ,
334
+ [ sh:path core:invalidated-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:message "The record has at most one end time." ] ,
335
+ [ sh:path scoring:has-stage ; sh:node scoring-shapes:stage-concept-shape ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A stage assignment must have exactly one stage: a tier key or none." ] ,
336
+ [ sh:path core:was-derived-from ; sh:or ( [ sh:class scoring:tier-membership ] [ sh:class scoring:threshold ] ) ; sh:message "A stage comes from tier memberships and the precedence of the registry." ] ,
337
+ [ sh:path core:was-generated-by ; sh:or ( [ sh:class scoring:evaluation ] [ sh:class scoring:registry-change ] ) ; sh:maxCount 1 ; sh:message "A stage assignment comes from at most one evaluation or registry change." ] .
338
+
339
+ scoring-shapes:stale-entry-shape a sh:NodeShape ;
340
+ sh:targetClass scoring:stale-entry ;
341
+ sh:closed true ;
342
+ sh:ignoredProperties ( rdf:type ) ;
343
+ sh:property
344
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
345
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
346
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one subject." ] ,
347
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one start time." ] ,
348
+ [ sh:path core:invalidated-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:message "The record has at most one end time." ] ,
349
+ [ sh:path scoring:has-stale-reason ; sh:in ( scoring-vocab:stale-reason-decision-error scoring-vocab:stale-reason-quota ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A stale entry must have exactly one reason: decision_error or quota." ] ,
350
+ [ sh:path core:was-generated-by ; sh:class core:activity ; sh:maxCount 1 ; sh:message "A stale entry comes from at most one activity." ] ,
351
+ [ sh:path scoring:of-version ; sh:class scoring:decision-version ; sh:maxCount 1 ; sh:message "A decision_error entry must have exactly one decision version." ] ,
352
+ [ sh:path scoring:has-error ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:message "A decision_error entry must have exactly one error." ] .
353
+
354
+ scoring-shapes:decision-error-entry-shape a sh:NodeShape ;
355
+ sh:targetClass scoring:decision-error-entry ;
356
+ sh:closed true ;
357
+ sh:ignoredProperties ( rdf:type ) ;
358
+ sh:property
359
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
360
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
361
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one subject." ] ,
362
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one start time." ] ,
363
+ [ sh:path core:invalidated-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:message "The record has at most one end time." ] ,
364
+ [ sh:path scoring:has-stale-reason ; sh:in ( scoring-vocab:stale-reason-decision-error scoring-vocab:stale-reason-quota ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A stale entry must have exactly one reason: decision_error or quota." ] ,
365
+ [ sh:path core:was-generated-by ; sh:class core:activity ; sh:maxCount 1 ; sh:message "A stale entry comes from at most one activity." ] ,
366
+ [ sh:path scoring:of-version ; sh:class scoring:decision-version ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A decision_error entry must have exactly one decision version." ] ,
367
+ [ sh:path scoring:has-error ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A decision_error entry must have exactly one error." ] .
368
+
369
+ scoring-shapes:quota-entry-shape a sh:NodeShape ;
370
+ sh:targetClass scoring:quota-entry ;
371
+ sh:closed true ;
372
+ sh:ignoredProperties ( rdf:type ) ;
373
+ sh:property
374
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
375
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
376
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one subject." ] ,
377
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must have exactly one start time." ] ,
378
+ [ sh:path core:invalidated-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:message "The record has at most one end time." ] ,
379
+ [ sh:path scoring:has-stale-reason ; sh:in ( scoring-vocab:stale-reason-decision-error scoring-vocab:stale-reason-quota ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A stale entry must have exactly one reason: decision_error or quota." ] ,
380
+ [ sh:path core:was-generated-by ; sh:class core:activity ; sh:maxCount 1 ; sh:message "A stale entry comes from at most one activity." ] .
381
+
382
+ scoring-shapes:registry-shape a sh:NodeShape ;
383
+ sh:targetClass scoring:registry ;
384
+ sh:closed true ;
385
+ sh:ignoredProperties ( rdf:type ) ;
386
+ sh:property
387
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
388
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
389
+ [ sh:path scoring:has-threshold ; sh:class scoring:threshold ; sh:message "A tier of the registry must be a threshold." ] ,
390
+ [ sh:path scoring:has-band-range ; sh:class scoring:band-range ; sh:minCount 1 ; sh:message "The registry must have one band or more." ] ,
391
+ [ sh:path scoring:has-persona-requirement ; sh:class scoring:persona-requirement ; sh:message "A persona of the registry must be a persona requirement." ] ,
392
+ [ sh:path scoring:has-dimension ; sh:node scoring-shapes:dimension-concept-shape ; sh:message "A dimension of the registry must be in the scheme of dimensions." ] .
393
+
394
+ scoring-shapes:threshold-shape a sh:NodeShape ;
395
+ sh:targetClass scoring:threshold ;
396
+ sh:closed true ;
397
+ sh:ignoredProperties ( rdf:type ) ;
398
+ sh:property
399
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
400
+ [ sh:path events:of-tier ; sh:node scoring-shapes:tier-concept-shape ; sh:not [ sh:hasValue scoring-vocab:stage-none ] ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A threshold must have exactly one tier, and the tier key cannot be none." ] ,
401
+ [ sh:path scoring:has-enter ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A threshold must have exactly one enter value from 0 to 1." ] ,
402
+ [ sh:path scoring:has-exit ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:lessThan scoring:has-enter ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A threshold must have exactly one exit value from 0 to 1, lower than its enter value." ] ,
403
+ [ sh:path scoring:has-precedence-rank ; sh:datatype xsd:positiveInteger ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A threshold must have exactly one position in the precedence list." ] .
404
+
405
+ scoring-shapes:band-range-shape a sh:NodeShape ;
406
+ sh:targetClass scoring:band-range ;
407
+ sh:closed true ;
408
+ sh:ignoredProperties ( rdf:type ) ;
409
+ sh:property
410
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
411
+ [ sh:path scoring:of-band ; sh:node scoring-shapes:band-concept-shape ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A band range must have exactly one band." ] ,
412
+ [ sh:path scoring:has-lower-bound ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:lessThan scoring:has-upper-bound ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A band must have exactly one lower bound from 0 to 1, lower than its upper bound." ] ,
413
+ [ sh:path scoring:has-upper-bound ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A band must have exactly one upper bound from 0 to 1." ] .
414
+
415
+ scoring-shapes:persona-requirement-shape a sh:NodeShape ;
416
+ sh:targetClass scoring:persona-requirement ;
417
+ sh:closed true ;
418
+ sh:ignoredProperties ( rdf:type ) ;
419
+ sh:property
420
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 0 ; sh:maxCount 1 ; sh:message "A record has at most one id, a string." ] ,
421
+ [ sh:path scoring:of-persona ; sh:node scoring-shapes:persona-concept-shape ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A persona requirement must have exactly one persona." ] ,
422
+ [ sh:path scoring:is-required ; sh:datatype xsd:boolean ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A persona requirement must tell whether the buyer group requires the persona." ] .
423
+
424
+ # Evaluation, publish, status period, templates and buyer group.
425
+
426
+ scoring-shapes:evaluation-shape a sh:NodeShape ;
427
+ sh:targetClass scoring:evaluation ;
428
+ sh:closed true ;
429
+ sh:ignoredProperties ( rdf:type ) ;
430
+ sh:property
431
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
432
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An evaluation must be for exactly one subject." ] ,
433
+ [ sh:path scoring:with-decision-version ; sh:class scoring:decision-version ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An evaluation must run exactly one decision version." ] ,
434
+ [ sh:path scoring:with-mapping-version ; sh:class scoring:mapping-version ; sh:maxCount 1 ; sh:message "An evaluation uses at most one mapping version." ] ,
435
+ [ sh:path scoring:with-buyer-group ; sh:class scoring:buyer-group ; sh:maxCount 1 ; sh:message "An evaluation of an account decision receives at most one buyer group." ] ,
436
+ [ sh:path scoring:read-event ; sh:class events:ingested-event ; sh:message "An event that an evaluation read must be an event." ] ,
437
+ [ sh:path scoring:triggered-by ; sh:class core:activity ; sh:message "The trigger of an evaluation must be an activity." ] ,
438
+ [ sh:path scoring:at-now ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An evaluation must have exactly one now." ] ,
439
+ [ sh:path scoring:has-error ; sh:datatype xsd:string ; sh:maxCount 1 ; sh:message "An evaluation has at most one error." ] .
440
+
441
+ scoring-shapes:failed-evaluation-shape a sh:NodeShape ;
442
+ sh:targetClass scoring:failed-evaluation ;
443
+ sh:closed true ;
444
+ sh:ignoredProperties ( rdf:type ) ;
445
+ sh:property
446
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
447
+ [ sh:path identity:of-subject ; sh:class identity:subject ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An evaluation must be for exactly one subject." ] ,
448
+ [ sh:path scoring:with-decision-version ; sh:class scoring:decision-version ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An evaluation must run exactly one decision version." ] ,
449
+ [ sh:path scoring:with-mapping-version ; sh:class scoring:mapping-version ; sh:maxCount 1 ; sh:message "An evaluation uses at most one mapping version." ] ,
450
+ [ sh:path scoring:with-buyer-group ; sh:class scoring:buyer-group ; sh:maxCount 1 ; sh:message "An evaluation of an account decision receives at most one buyer group." ] ,
451
+ [ sh:path scoring:read-event ; sh:class events:ingested-event ; sh:message "An event that an evaluation read must be an event." ] ,
452
+ [ sh:path scoring:triggered-by ; sh:class core:activity ; sh:message "The trigger of an evaluation must be an activity." ] ,
453
+ [ sh:path scoring:at-now ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "An evaluation must have exactly one now." ] ,
454
+ [ sh:path scoring:has-error ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A failed evaluation must have exactly one error." ] .
455
+
456
+ scoring-shapes:publish-shape a sh:NodeShape ;
457
+ sh:targetClass scoring:publish ;
458
+ sh:closed true ;
459
+ sh:ignoredProperties ( rdf:type ) ;
460
+ sh:or ( [ sh:path scoring:with-decision-version ; sh:minCount 1 ] [ sh:path scoring:with-mapping-version ; sh:minCount 1 ] ) ;
461
+ sh:message "A publish makes a decision version or a mapping version live." ;
462
+ sh:property
463
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
464
+ [ sh:path scoring:with-decision-version ; sh:class scoring:decision-version ; sh:maxCount 1 ; sh:message "A publish acts on at most one decision version." ] ,
465
+ [ sh:path scoring:with-mapping-version ; sh:class scoring:mapping-version ; sh:maxCount 1 ; sh:message "A publish acts on at most one mapping version." ] ,
466
+ [ sh:path core:was-associated-with ; sh:class core:agent ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A person publishes a draft: a publish must have exactly one agent." ] ,
467
+ [ sh:path core:started-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A publish must have exactly one start time." ] ,
468
+ [ sh:path core:ended-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:message "A publish has at most one end time." ] .
469
+
470
+ scoring-shapes:status-period-shape a sh:NodeShape ;
471
+ sh:targetClass scoring:status-period ;
472
+ sh:closed true ;
473
+ sh:ignoredProperties ( rdf:type ) ;
474
+ sh:property
475
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
476
+ [ sh:path scoring:of-version ; sh:class scoring:decision-version ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A status period must belong to exactly one decision version." ] ,
477
+ [ sh:path core:has-status ; sh:in ( scoring-vocab:version-status-draft scoring-vocab:version-status-published scoring-vocab:version-status-rolled-back ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A status period must have exactly one status: draft, published or rolled_back." ] ,
478
+ [ sh:path core:started-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A status period must have exactly one start time." ] ,
479
+ [ sh:path core:ended-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:message "A status period has at most one end time. The current status has none." ] ,
480
+ [ sh:path core:was-generated-by ; sh:or ( [ sh:class scoring:publish ] [ sh:class scoring:rollback ] ) ; sh:maxCount 1 ; sh:message "A status period comes from at most one publish or rollback." ] ;
481
+ sh:sparql [
482
+ a sh:SPARQLConstraint ;
483
+ sh:message "A status period cannot end before it starts." ;
484
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/scoring> ;
485
+ sh:select """
486
+ SELECT $this ?value WHERE {
487
+ $this core:ended-at ?value ; core:started-at ?start .
488
+ FILTER (?value < ?start)
489
+ }""" ] ;
490
+ sh:sparql [
491
+ a sh:SPARQLConstraint ;
492
+ sh:message "A decision has one published version at a time: two published periods of the versions of one decision cannot overlap." ;
493
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/scoring> ;
494
+ sh:select """
495
+ SELECT $this ?other WHERE {
496
+ $this core:has-status scoring-vocab:version-status-published ; core:started-at ?s1 ; scoring:of-version/scoring:of-decision ?decision .
497
+ ?other core:has-status scoring-vocab:version-status-published ; core:started-at ?s2 ; scoring:of-version/scoring:of-decision ?decision .
498
+ FILTER (?other != $this)
499
+ OPTIONAL { $this core:ended-at ?e1 }
500
+ OPTIONAL { ?other core:ended-at ?e2 }
501
+ FILTER (?s1 < COALESCE(?e2, "9999-12-31T23:59:59Z"^^xsd:dateTime) && ?s2 < COALESCE(?e1, "9999-12-31T23:59:59Z"^^xsd:dateTime))
502
+ }""" ] .
503
+
504
+ scoring-shapes:template-shape a sh:NodeShape ;
505
+ sh:targetClass scoring:template ;
506
+ sh:closed true ;
507
+ sh:ignoredProperties ( rdf:type ) ;
508
+ sh:property
509
+ [ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A template must have exactly one id, the id of fromTemplate." ] ,
510
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace. A platform template belongs to the platform workspace." ] .
511
+
512
+ scoring-shapes:template-version-shape a sh:NodeShape ;
513
+ sh:targetClass scoring:template-version ;
514
+ sh:closed true ;
515
+ sh:ignoredProperties ( rdf:type ) ;
516
+ sh:property
517
+ [ sh:path scoring:of-template ; sh:class scoring:template ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A template version must belong to exactly one template." ] ,
518
+ [ sh:path scoring:has-version ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A template version must have exactly one version name." ] ,
519
+ [ sh:path scoring:has-hash ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A template version must have exactly one hash." ] ,
520
+ [ sh:path scoring:has-decision-kind ; sh:in ( scoring-vocab:decision-kind-campaign scoring-vocab:decision-kind-person scoring-vocab:decision-kind-account ) ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A template version must have exactly one kind: campaign, person or account." ] ,
521
+ [ sh:path scoring:is-deprecated ; sh:datatype xsd:boolean ; sh:maxCount 1 ; sh:message "A template version has at most one deprecated flag." ] ,
522
+ [ sh:path scoring:is-default-template ; sh:datatype xsd:boolean ; sh:maxCount 1 ; sh:message "A template version has at most one default flag." ] ;
523
+ sh:sparql [
524
+ a sh:SPARQLConstraint ;
525
+ sh:message "A template has one template version for each version name." ;
526
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/scoring> ;
527
+ sh:select """
528
+ SELECT $this ?value WHERE {
529
+ $this scoring:of-template ?template ; scoring:has-version ?value .
530
+ ?other scoring:of-template ?template ; scoring:has-version ?value .
531
+ FILTER (?other != $this)
532
+ }""" ] .
533
+
534
+ scoring-shapes:buyer-group-shape a sh:NodeShape ;
535
+ sh:targetClass scoring:buyer-group ;
536
+ sh:closed true ;
537
+ sh:ignoredProperties ( rdf:type ) ;
538
+ sh:property
539
+ [ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "The record must belong to exactly one workspace." ] ,
540
+ [ sh:path identity:of-subject ; sh:class identity:account ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A buyer group must be for exactly one account." ] ,
541
+ [ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ; sh:message "A buyer group must have exactly one calculation time." ] ,
542
+ [ sh:path scoring:covers-persona ; sh:node scoring-shapes:persona-concept-shape ; sh:message "A covered persona must be a persona of the scheme of personas." ] ,
543
+ [ sh:path scoring:misses-persona ; sh:node scoring-shapes:persona-concept-shape ; sh:message "A missing persona must be a persona of the scheme of personas." ] ,
544
+ [ sh:path scoring:has-engaged-members-30d ; sh:datatype xsd:nonNegativeInteger ; sh:maxCount 1 ; sh:message "A buyer group has at most one number of engaged members in 30 days." ] ,
545
+ [ sh:path scoring:has-required-coverage ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:maxCount 1 ; sh:message "The required coverage of a buyer group is one number from 0 to 1." ] ,
546
+ [ sh:path scoring:has-max-intent ; sh:datatype xsd:decimal ; sh:minInclusive 0 ; sh:maxInclusive 1 ; sh:maxCount 1 ; sh:message "The maximum intent of a buyer group is one number from 0 to 1." ] ,
547
+ [ sh:path scoring:has-product-users ; sh:datatype xsd:nonNegativeInteger ; sh:maxCount 1 ; sh:message "A buyer group has at most one number of product users." ] ;
548
+ sh:sparql [
549
+ a sh:SPARQLConstraint ;
550
+ sh:message "A persona is covered or missing in a buyer group, not both." ;
551
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/scoring> ;
552
+ sh:select """
553
+ SELECT $this ?value WHERE {
554
+ $this scoring:covers-persona ?value ; scoring:misses-persona ?value .
555
+ }""" ] .