@quickpipeaiab/domain 0.0.0-stage → 0.9.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,958 @@
1
+ @prefix core: <https://id.quickpipe.ai/domain/core#> .
2
+ @prefix core-vocab: <https://id.quickpipe.ai/domain/vocab/core#> .
3
+ @prefix identity: <https://id.quickpipe.ai/domain/identity#> .
4
+ @prefix events: <https://id.quickpipe.ai/domain/events#> .
5
+ @prefix desk: <https://id.quickpipe.ai/domain/desk#> .
6
+ @prefix events-vocab: <https://id.quickpipe.ai/domain/vocab/events#> .
7
+ @prefix scoring: <https://id.quickpipe.ai/domain/scoring#> .
8
+ @prefix campaigns: <https://id.quickpipe.ai/domain/campaigns#> .
9
+ @prefix campaigns-vocab: <https://id.quickpipe.ai/domain/vocab/campaigns#> .
10
+ @prefix campaigns-shapes: <https://id.quickpipe.ai/domain/shapes/campaigns#> .
11
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
12
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
13
+ @prefix sh: <http://www.w3.org/ns/shacl#> .
14
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
15
+
16
+ <https://id.quickpipe.ai/domain/shapes/campaigns>
17
+ a owl:Ontology ;
18
+ owl:versionIRI <https://id.quickpipe.ai/domain/0.9.0/shapes/campaigns> ;
19
+ owl:versionInfo "0.9.0" ;
20
+ core:title "QuickPipe domain model: shapes of campaigns"@en ;
21
+ sh:declare
22
+ [ sh:prefix "core" ; sh:namespace "https://id.quickpipe.ai/domain/core#"^^xsd:anyURI ] ,
23
+ [ sh:prefix "identity" ; sh:namespace "https://id.quickpipe.ai/domain/identity#"^^xsd:anyURI ] ,
24
+ [ sh:prefix "events" ; sh:namespace "https://id.quickpipe.ai/domain/events#"^^xsd:anyURI ] ,
25
+ [ sh:prefix "campaigns" ; sh:namespace "https://id.quickpipe.ai/domain/campaigns#"^^xsd:anyURI ] ,
26
+ [ sh:prefix "campaigns-vocab" ; sh:namespace "https://id.quickpipe.ai/domain/vocab/campaigns#"^^xsd:anyURI ] ,
27
+ [ sh:prefix "xsd" ; sh:namespace "http://www.w3.org/2001/XMLSchema#"^^xsd:anyURI ] .
28
+
29
+ # Values of open schemes (docs/decisions/0003-modelling-patterns.md, Q15).
30
+
31
+ campaigns-shapes:channel-value-shape a sh:NodeShape ;
32
+ sh:class core:concept ;
33
+ sh:property [
34
+ sh:path core:in-scheme ;
35
+ sh:hasValue campaigns-vocab:channel ;
36
+ sh:message "A channel must be a concept of the scheme of channels." ] .
37
+
38
+ campaigns-shapes:event-name-value-shape a sh:NodeShape ;
39
+ sh:class core:concept ;
40
+ sh:property [
41
+ sh:path core:in-scheme ;
42
+ sh:hasValue events-vocab:event-name ;
43
+ sh:message "A selected event must be a concept of the scheme of event names." ] .
44
+
45
+ campaigns-shapes:channel-of-workspace a sh:SPARQLConstraint ;
46
+ sh:message "A channel that a workspace added can only be used in that workspace." ;
47
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
48
+ sh:select """
49
+ SELECT $this ?value WHERE {
50
+ $this campaigns:through-channel ?value .
51
+ ?value core:in-workspace ?workspace .
52
+ FILTER NOT EXISTS { $this core:in-workspace ?workspace }
53
+ }""" .
54
+
55
+ # Campaign, cadence, step and step map.
56
+
57
+ campaigns-shapes:campaign-shape a sh:NodeShape ;
58
+ sh:targetClass campaigns:campaign ;
59
+ sh:closed true ;
60
+ sh:ignoredProperties ( rdf:type ) ;
61
+ sh:property [
62
+ sh:path core:has-name ; sh:datatype xsd:string ; sh:maxCount 1 ;
63
+ sh:message "A campaign has at most one name." ] ;
64
+ sh:property [
65
+ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
66
+ sh:message "A campaign must have exactly one campaignId." ] ;
67
+ sh:property [
68
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
69
+ sh:message "A campaign must belong to exactly one workspace." ] ;
70
+ sh:property [
71
+ sh:path core:has-status ; sh:class core:concept ; sh:minCount 1 ; sh:maxCount 1 ;
72
+ sh:in ( campaigns-vocab:status-draft campaigns-vocab:status-active campaigns-vocab:status-paused campaigns-vocab:status-archived ) ;
73
+ sh:message "A campaign must have exactly one status: draft, active, paused or archived. A deleted campaign arrives as archived." ] ;
74
+ sh:property [
75
+ sh:path campaigns:has-decision ; sh:class scoring:decision ; sh:minCount 1 ; sh:maxCount 1 ;
76
+ sh:message "A campaign must have exactly one campaign decision." ] ;
77
+ sh:property [
78
+ sh:path campaigns:for-offer ; sh:maxCount 1 ;
79
+ sh:message "A campaign has at most one offer." ] ;
80
+ sh:property [
81
+ sh:path campaigns:selects-event ; sh:node campaigns-shapes:event-name-value-shape ;
82
+ sh:message "A selected event of a campaign must be an event name." ] ;
83
+ sh:property [
84
+ sh:path campaigns:has-goal ; sh:datatype xsd:string ; sh:minLength 1 ; sh:maxLength 500 ; sh:maxCount 1 ;
85
+ sh:message "A campaign can have at most one goal, as a text of 1 to 500 characters." ] ;
86
+ sh:property [
87
+ sh:path campaigns:has-review-mode ; sh:class core:concept ; sh:maxCount 1 ;
88
+ sh:in ( campaigns-vocab:review-mode-review campaigns-vocab:review-mode-auto ) ;
89
+ sh:message "A campaign can have at most one review mode: review or auto." ] ;
90
+ sh:property [
91
+ sh:path campaigns:has-window-days ; sh:datatype xsd:positiveInteger ; sh:maxCount 1 ;
92
+ sh:message "A campaign can have at most one attribution window, as a positive number of days." ] ;
93
+ sh:property [
94
+ sh:path campaigns:archived-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
95
+ sh:message "A campaign can have at most one archive time." ] ;
96
+ sh:sparql [
97
+ a sh:SPARQLConstraint ;
98
+ sh:message "A campaign has an archive time only when its status is archived." ;
99
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
100
+ sh:select """
101
+ SELECT $this WHERE {
102
+ $this campaigns:archived-at ?at ; core:has-status ?status .
103
+ FILTER (?status != campaigns-vocab:status-archived)
104
+ }""" ] ;
105
+ sh:sparql [
106
+ a sh:SPARQLConstraint ;
107
+ sh:message "A campaign must have one or more cadences." ;
108
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
109
+ sh:select """
110
+ SELECT $this WHERE {
111
+ FILTER NOT EXISTS { ?cadence a campaigns:cadence ; campaigns:of-campaign $this }
112
+ }""" ] .
113
+
114
+ campaigns-shapes:cadence-shape a sh:NodeShape ;
115
+ sh:targetClass campaigns:cadence ;
116
+ sh:closed true ;
117
+ sh:ignoredProperties ( rdf:type ) ;
118
+ sh:property [
119
+ sh:path campaigns:has-send-window ; sh:class campaigns:send-window ; sh:maxCount 1 ;
120
+ sh:message "A cadence has at most one send window." ] ;
121
+ sh:property [
122
+ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
123
+ sh:message "A cadence must have exactly one id." ] ;
124
+ sh:property [
125
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
126
+ sh:message "A cadence must belong to exactly one workspace." ] ;
127
+ sh:property [
128
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
129
+ sh:message "A cadence must belong to exactly one campaign." ] ;
130
+ sh:property [
131
+ sh:path core:has-name ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
132
+ sh:message "A cadence must have exactly one name." ] ;
133
+ sh:property [
134
+ sh:path core:has-status ; sh:class core:concept ; sh:minCount 1 ; sh:maxCount 1 ;
135
+ sh:in ( campaigns-vocab:status-draft campaigns-vocab:status-active campaigns-vocab:status-paused campaigns-vocab:status-archived ) ;
136
+ sh:message "A cadence must have exactly one status: draft, active, paused or archived." ] ;
137
+ sh:property [
138
+ sh:path campaigns:has-effective-status ; sh:class core:concept ; sh:minCount 1 ; sh:maxCount 1 ;
139
+ sh:in ( campaigns-vocab:status-draft campaigns-vocab:status-active campaigns-vocab:status-paused campaigns-vocab:status-archived ) ;
140
+ sh:message "A cadence must have exactly one effective status: draft, active, paused or archived." ] ;
141
+ sh:sparql [
142
+ a sh:SPARQLConstraint ;
143
+ sh:message "The effective status of a cadence must be the stricter of its status and the status of its campaign, in the order active, paused, draft, archived." ;
144
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
145
+ sh:select """
146
+ SELECT $this WHERE {
147
+ $this core:has-status ?own ; campaigns:has-effective-status ?effective ; campaigns:of-campaign ?campaign .
148
+ ?campaign core:has-status ?parent .
149
+ ?own campaigns:has-strictness ?a .
150
+ ?parent campaigns:has-strictness ?b .
151
+ ?effective campaigns:has-strictness ?e .
152
+ FILTER (?e != IF(?a > ?b, ?a, ?b))
153
+ }""" ] .
154
+
155
+ campaigns-shapes:step-shape a sh:NodeShape ;
156
+ sh:targetClass campaigns:step ;
157
+ sh:closed true ;
158
+ sh:ignoredProperties ( rdf:type ) ;
159
+ sh:property [
160
+ sh:path campaigns:on-channel ; sh:class core:concept ; sh:maxCount 1 ;
161
+ sh:message "A step has at most one channel." ] ;
162
+ sh:property [
163
+ sh:path campaigns:uses-template ; sh:class campaigns:template-of-outreach ; sh:maxCount 1 ;
164
+ sh:message "A step has at most one template." ] ;
165
+ sh:property [
166
+ sh:path campaigns:waits-seconds ; sh:datatype xsd:nonNegativeInteger ; sh:maxCount 1 ;
167
+ sh:message "A step has at most one wait." ] ;
168
+ sh:property [
169
+ sh:path campaigns:has-writer ; sh:class core:concept ; sh:maxCount 1 ;
170
+ sh:in ( campaigns-vocab:writer-template campaigns-vocab:writer-kai ) ;
171
+ sh:message "A step can have at most one writer: template or kai." ] ;
172
+ sh:property [
173
+ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
174
+ sh:message "A step must have exactly one stepId, the value of utm_content." ] ;
175
+ sh:property [
176
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
177
+ sh:message "A step must belong to exactly one workspace." ] ;
178
+ sh:property [
179
+ sh:path campaigns:of-cadence ; sh:class campaigns:cadence ; sh:minCount 1 ; sh:maxCount 1 ;
180
+ sh:message "A step must belong to exactly one cadence." ] ;
181
+ sh:property [
182
+ sh:path campaigns:has-position ; sh:datatype xsd:positiveInteger ; sh:minInclusive 1 ; sh:minCount 1 ; sh:maxCount 1 ;
183
+ sh:message "A step must have exactly one position in its cadence, from 1." ] .
184
+
185
+ campaigns-shapes:step-map-shape a sh:NodeShape ;
186
+ sh:targetClass campaigns:step-map ;
187
+ sh:closed true ;
188
+ sh:ignoredProperties ( rdf:type ) ;
189
+ sh:property [
190
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
191
+ sh:message "A version of the step map must belong to exactly one workspace." ] ;
192
+ sh:property [
193
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
194
+ sh:message "A version of the step map must belong to exactly one campaign." ] ;
195
+ sh:property [
196
+ sh:path core:started-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ;
197
+ sh:message "A version of the step map must have exactly one start time." ] ;
198
+ sh:property [
199
+ sh:path core:ended-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
200
+ sh:message "A version of the step map can have at most one end time. The current version has none." ] ;
201
+ sh:property [
202
+ sh:path core:was-revision-of ; sh:class campaigns:step-map ; sh:maxCount 1 ;
203
+ sh:message "A version of the step map can follow at most one earlier version." ] ;
204
+ sh:property [
205
+ sh:path campaigns:includes-cadence ; sh:class campaigns:cadence ; sh:minCount 1 ;
206
+ sh:message "A version of the step map must include one or more cadences." ] ;
207
+ sh:property [
208
+ sh:path campaigns:includes-step ; sh:class campaigns:step ; sh:minCount 1 ;
209
+ sh:message "A version of the step map must include one or more steps." ] ;
210
+ sh:sparql [
211
+ a sh:SPARQLConstraint ;
212
+ sh:message "Each step of a version of the step map must belong to a cadence of the same version." ;
213
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
214
+ sh:select """
215
+ SELECT $this ?value WHERE {
216
+ $this campaigns:includes-step ?value .
217
+ ?value campaigns:of-cadence ?cadence .
218
+ FILTER NOT EXISTS { $this campaigns:includes-cadence ?cadence }
219
+ }""" ] .
220
+
221
+ # Attribution.
222
+
223
+ campaigns-shapes:claim-shape a sh:NodeShape ;
224
+ sh:targetClass campaigns:claim ;
225
+ sh:closed true ;
226
+ sh:ignoredProperties ( rdf:type ) ;
227
+ sh:property [
228
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
229
+ sh:message "A claim must belong to exactly one workspace." ] ;
230
+ sh:property [
231
+ sh:path campaigns:of-person ; sh:class identity:person ; sh:minCount 1 ; sh:maxCount 1 ;
232
+ sh:message "A claim must be for exactly one person." ] ;
233
+ sh:property [
234
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
235
+ sh:message "A claim must belong to exactly one campaign, the owner campaign." ] ;
236
+ sh:property [
237
+ sh:path campaigns:for-field ; sh:minCount 1 ; sh:maxCount 1 ;
238
+ sh:hasValue campaigns-vocab:attribution-field-owner ;
239
+ sh:message "A claim gives the field attribution.owner." ] ;
240
+ sh:property [
241
+ sh:path core:started-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ;
242
+ sh:message "A claim must have exactly one start time, the occurredAt of the touch that claimed the person." ] ;
243
+ sh:property [
244
+ sh:path core:ended-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
245
+ sh:message "A claim can have at most one end time. The current claim has none." ] ;
246
+ sh:property [
247
+ sh:path core:was-generated-by ; sh:class campaigns:touch ; sh:minCount 1 ; sh:maxCount 1 ;
248
+ sh:message "A claim must come from exactly one touch, the first touch of its campaign." ] ;
249
+ sh:property [
250
+ sh:path campaigns:kept-by ; sh:class campaigns:touch ;
251
+ sh:message "Only a touch can keep a claim." ] ;
252
+ sh:property [
253
+ sh:path campaigns:last-touch-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ;
254
+ sh:message "A claim must have exactly one time of the latest touch of its campaign." ] ;
255
+ sh:property [
256
+ sh:path campaigns:has-window-days ; sh:datatype xsd:positiveInteger ; sh:maxCount 1 ;
257
+ sh:message "A claim can have at most one window, as a positive number of days. With no window, the window is 30 days." ] ;
258
+ sh:property [
259
+ sh:path campaigns:window-ends-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
260
+ sh:message "A claim can have at most one end of its window." ] ;
261
+ sh:rule [
262
+ a sh:SPARQLRule ;
263
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
264
+ sh:construct """
265
+ CONSTRUCT { $this campaigns:window-ends-at ?end }
266
+ WHERE {
267
+ $this campaigns:last-touch-at ?last .
268
+ FILTER NOT EXISTS { $this campaigns:window-ends-at ?any }
269
+ OPTIONAL { $this campaigns:has-window-days ?set }
270
+ BIND (COALESCE(?set, 30) AS ?days)
271
+ BIND (?last + STRDT(CONCAT("P", STR(?days), "D"), xsd:dayTimeDuration) AS ?end)
272
+ }""" ] ;
273
+ sh:sparql [
274
+ a sh:SPARQLConstraint ;
275
+ sh:message "The window of a claim ends 30 days after the latest touch of its campaign, or after the number of days of the window that the workspace or the campaign sets. Each touch of that campaign starts the window again." ;
276
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
277
+ sh:select """
278
+ SELECT $this ?value WHERE {
279
+ $this campaigns:last-touch-at ?last ; campaigns:window-ends-at ?value .
280
+ OPTIONAL { $this campaigns:has-window-days ?set }
281
+ BIND (COALESCE(?set, 30) AS ?days)
282
+ FILTER (?value != ?last + STRDT(CONCAT("P", STR(?days), "D"), xsd:dayTimeDuration))
283
+ }""" ] ;
284
+ sh:sparql [
285
+ a sh:SPARQLConstraint ;
286
+ sh:message "A claim cannot end after its window ends." ;
287
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
288
+ sh:select """
289
+ SELECT $this ?value WHERE {
290
+ $this core:ended-at ?value ; campaigns:window-ends-at ?window .
291
+ FILTER (?value > ?window)
292
+ }""" ] ;
293
+ sh:sparql [
294
+ a sh:SPARQLConstraint ;
295
+ sh:message "The latest touch of a claim cannot come before the start of the claim." ;
296
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
297
+ sh:select """
298
+ SELECT $this ?value WHERE {
299
+ $this campaigns:last-touch-at ?value ; core:started-at ?start .
300
+ FILTER (?value < ?start)
301
+ }""" ] ;
302
+ sh:sparql [
303
+ a sh:SPARQLConstraint ;
304
+ sh:message "A draft or archived campaign cannot claim a person or keep a claim. A current claim must belong to an active or a paused campaign." ;
305
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
306
+ sh:select """
307
+ SELECT $this WHERE {
308
+ $this campaigns:of-campaign ?campaign .
309
+ ?campaign core:has-status ?status .
310
+ FILTER NOT EXISTS { $this core:ended-at ?end }
311
+ FILTER (?status IN (campaigns-vocab:status-draft, campaigns-vocab:status-archived))
312
+ }""" ] .
313
+
314
+ # First and last attribution.
315
+
316
+ campaigns-shapes:attribution-campaign-of-touch a sh:SPARQLConstraint ;
317
+ sh:message "The campaign of an attribution must be the campaign of its touch." ;
318
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
319
+ sh:select """
320
+ SELECT $this ?value WHERE {
321
+ $this campaigns:of-campaign ?value ; core:was-generated-by ?touch .
322
+ ?touch campaigns:of-campaign ?other .
323
+ FILTER (?value != ?other)
324
+ }""" .
325
+
326
+ campaigns-shapes:attribution-start-at-touch a sh:SPARQLConstraint ;
327
+ sh:message "An attribution starts at the occurredAt of its touch." ;
328
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
329
+ sh:select """
330
+ SELECT $this ?value WHERE {
331
+ $this core:started-at ?value ; core:was-generated-by ?touch .
332
+ ?touch events:occurred-at ?at .
333
+ FILTER (?value != ?at)
334
+ }""" .
335
+
336
+ campaigns-shapes:attribution-person-of-touch a sh:SPARQLConstraint ;
337
+ sh:message "The person of an attribution must be the subject of its touch." ;
338
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
339
+ sh:select """
340
+ SELECT $this ?value WHERE {
341
+ $this campaigns:of-person ?value ; core:was-generated-by ?touch .
342
+ ?touch identity:of-subject ?other .
343
+ FILTER (?value != ?other)
344
+ }""" .
345
+
346
+ campaigns-shapes:attribution-ends-after-start a sh:SPARQLConstraint ;
347
+ sh:message "An attribution cannot end before it starts." ;
348
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
349
+ sh:select """
350
+ SELECT $this ?value WHERE {
351
+ $this core:ended-at ?value ; core:started-at ?start .
352
+ FILTER (?value < ?start)
353
+ }""" .
354
+
355
+ campaigns-shapes:first-attribution-shape a sh:NodeShape ;
356
+ sh:targetClass campaigns:first-attribution ;
357
+ sh:closed true ;
358
+ sh:ignoredProperties ( rdf:type ) ;
359
+ sh:property [
360
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
361
+ sh:message "An attribution must belong to exactly one workspace." ] ;
362
+ sh:property [
363
+ sh:path campaigns:of-person ; sh:class identity:person ; sh:minCount 1 ; sh:maxCount 1 ;
364
+ sh:message "An attribution must be for exactly one person." ] ;
365
+ sh:property [
366
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
367
+ sh:message "The first attribution must name exactly one campaign." ] ;
368
+ sh:property [
369
+ sh:path campaigns:for-field ; sh:minCount 1 ; sh:maxCount 1 ;
370
+ sh:hasValue campaigns-vocab:attribution-field-first ;
371
+ sh:message "The first attribution gives the field attribution.first." ] ;
372
+ sh:property [
373
+ sh:path core:started-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ;
374
+ sh:message "The first attribution must have exactly one start time, the occurredAt of its touch." ] ;
375
+ sh:property [
376
+ sh:path core:ended-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
377
+ sh:message "The first attribution can have at most one end time. The current value has none." ] ;
378
+ sh:property [
379
+ sh:path core:was-generated-by ; sh:class campaigns:touch ; sh:minCount 1 ; sh:maxCount 1 ;
380
+ sh:message "The first attribution must come from exactly one touch." ] ;
381
+ sh:sparql campaigns-shapes:attribution-campaign-of-touch ;
382
+ sh:sparql campaigns-shapes:attribution-start-at-touch ;
383
+ sh:sparql campaigns-shapes:attribution-person-of-touch ;
384
+ sh:sparql campaigns-shapes:attribution-ends-after-start .
385
+
386
+ campaigns-shapes:last-attribution-shape a sh:NodeShape ;
387
+ sh:targetClass campaigns:last-attribution ;
388
+ sh:closed true ;
389
+ sh:ignoredProperties ( rdf:type ) ;
390
+ sh:property [
391
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
392
+ sh:message "An attribution must belong to exactly one workspace." ] ;
393
+ sh:property [
394
+ sh:path campaigns:of-person ; sh:class identity:person ; sh:minCount 1 ; sh:maxCount 1 ;
395
+ sh:message "An attribution must be for exactly one person." ] ;
396
+ sh:property [
397
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
398
+ sh:message "The last attribution must name exactly one campaign." ] ;
399
+ sh:property [
400
+ sh:path campaigns:for-field ; sh:minCount 1 ; sh:maxCount 1 ;
401
+ sh:hasValue campaigns-vocab:attribution-field-last ;
402
+ sh:message "The last attribution gives the field attribution.last." ] ;
403
+ sh:property [
404
+ sh:path core:started-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ;
405
+ sh:message "The last attribution must have exactly one start time, the occurredAt of its touch." ] ;
406
+ sh:property [
407
+ sh:path core:ended-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
408
+ sh:message "The last attribution can have at most one end time. The current value has none." ] ;
409
+ sh:property [
410
+ sh:path core:was-generated-by ; sh:class campaigns:touch ; sh:minCount 1 ; sh:maxCount 1 ;
411
+ sh:message "The last attribution must come from exactly one touch." ] ;
412
+ sh:sparql campaigns-shapes:attribution-campaign-of-touch ;
413
+ sh:sparql campaigns-shapes:attribution-start-at-touch ;
414
+ sh:sparql campaigns-shapes:attribution-person-of-touch ;
415
+ sh:sparql campaigns-shapes:attribution-ends-after-start .
416
+
417
+ # Campaign score.
418
+
419
+ campaigns-shapes:score-shape a sh:NodeShape ;
420
+ sh:targetClass campaigns:score ;
421
+ sh:closed true ;
422
+ sh:ignoredProperties ( rdf:type ) ;
423
+ sh:property [
424
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
425
+ sh:message "A campaign score must belong to exactly one workspace." ] ;
426
+ sh:property [
427
+ sh:path campaigns:of-person ; sh:class identity:person ; sh:minCount 1 ; sh:maxCount 1 ;
428
+ sh:message "A campaign score must be for exactly one person." ] ;
429
+ sh:property [
430
+ sh:path campaigns:of-lead-record ; sh:class core:entity ; sh:maxCount 1 ;
431
+ sh:message "The outreach copy of a campaign score names its subject with at most one lead record." ] ;
432
+ sh:property [
433
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
434
+ sh:message "A campaign score must be for exactly one campaign." ] ;
435
+ sh:property [
436
+ sh:path scoring:has-score ; sh:datatype xsd:decimal ; sh:minCount 1 ; sh:maxCount 1 ;
437
+ sh:minInclusive 0 ; sh:maxInclusive 1 ;
438
+ sh:message "A campaign score must have exactly one value from 0 to 1." ] ;
439
+ sh:property [
440
+ sh:path campaigns:is-enrolled ; sh:datatype xsd:boolean ; sh:minCount 1 ; sh:maxCount 1 ;
441
+ sh:message "A campaign score must tell if the person is enrolled: true or false." ] ;
442
+ sh:property [
443
+ sh:path campaigns:of-cadence ; sh:class campaigns:cadence ; sh:maxCount 1 ;
444
+ sh:message "A campaign score can have at most one cadence." ] ;
445
+ sh:property [
446
+ sh:path campaigns:has-output-sequence ; sh:datatype xsd:long ; sh:maxCount 1 ;
447
+ sh:message "A campaign score has at most one output sequence number." ] ;
448
+ sh:property [
449
+ sh:path core:was-generated-by ; sh:class scoring:evaluation ; sh:maxCount 1 ;
450
+ sh:message "A campaign score comes from at most one evaluation of the campaign decision." ] ;
451
+ sh:sparql [
452
+ a sh:SPARQLConstraint ;
453
+ sh:message "The cadence of a campaign score must belong to the campaign of the score." ;
454
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
455
+ sh:select """
456
+ SELECT $this ?value WHERE {
457
+ $this campaigns:of-cadence ?value ; campaigns:of-campaign ?campaign .
458
+ FILTER NOT EXISTS { ?value campaigns:of-campaign ?campaign }
459
+ }""" ] .
460
+
461
+ # Enrollment and step position.
462
+
463
+ campaigns-shapes:enrollment-shape a sh:NodeShape ;
464
+ sh:targetClass campaigns:enrollment ;
465
+ sh:closed true ;
466
+ sh:ignoredProperties ( rdf:type ) ;
467
+ sh:property [
468
+ sh:path core:id ; sh:datatype xsd:string ; sh:maxCount 1 ;
469
+ sh:message "An enrollment has at most one id." ] ;
470
+ sh:property [
471
+ sh:path core:has-status ; sh:class core:concept ; sh:maxCount 1 ;
472
+ sh:in ( campaigns-vocab:enrollment-status-active campaigns-vocab:enrollment-status-paused campaigns-vocab:enrollment-status-ended ) ;
473
+ sh:message "An enrollment has at most one status: active, paused or ended." ] ;
474
+ sh:property [
475
+ sh:path desk:of-teammate ; sh:class desk:teammate ; sh:maxCount 1 ;
476
+ sh:message "An enrollment has at most one teammate." ] ;
477
+ sh:property [
478
+ sh:path campaigns:has-enrollment-pause-reason ; sh:class core:concept ; sh:maxCount 1 ;
479
+ sh:message "An enrollment has at most one pause reason." ] ;
480
+ sh:property [
481
+ sh:path campaigns:has-end-reason ; sh:class core:concept ; sh:maxCount 1 ;
482
+ sh:message "An enrollment has at most one end reason." ] ;
483
+ sh:property [
484
+ sh:path core:started-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
485
+ sh:message "An enrollment has at most one start time." ] ;
486
+ sh:property [
487
+ sh:path campaigns:next-step ; sh:class campaigns:step ; sh:maxCount 1 ;
488
+ sh:message "An enrollment has at most one next step." ] ;
489
+ sh:property [
490
+ sh:path campaigns:has-mailbox-id ; sh:datatype xsd:string ; sh:maxCount 1 ;
491
+ sh:message "An enrollment has at most one mailbox id." ] ;
492
+ sh:property [
493
+ sh:path campaigns:has-sender-id ; sh:datatype xsd:string ; sh:maxCount 1 ;
494
+ sh:message "An enrollment has at most one sender id." ] ;
495
+ sh:property [
496
+ sh:path campaigns:has-flag ; sh:class core:concept ;
497
+ sh:message "An enrollment flag is a concept." ] ;
498
+ sh:property [
499
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
500
+ sh:message "An enrollment must belong to exactly one workspace." ] ;
501
+ sh:property [
502
+ sh:path campaigns:of-lead-record ; sh:class core:entity ; sh:minCount 1 ; sh:maxCount 1 ;
503
+ sh:message "An enrollment must be for exactly one lead record." ] ;
504
+ sh:property [
505
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
506
+ sh:message "An enrollment must be for exactly one campaign." ] ;
507
+ sh:property [
508
+ sh:path campaigns:of-cadence ; sh:class campaigns:cadence ; sh:minCount 1 ; sh:maxCount 1 ;
509
+ sh:message "An enrollment must have exactly one cadence, the properties.cadence of campaign.enrolled." ] ;
510
+ sh:property [
511
+ sh:path core:was-generated-by ; sh:class events:campaign-enrolled ; sh:maxCount 1 ;
512
+ sh:message "An enrollment comes from at most one campaign.enrolled event." ] ;
513
+ sh:property [
514
+ sh:path campaigns:ended-by ; sh:class events:campaign-unsubscribed ; sh:maxCount 1 ;
515
+ sh:message "An enrollment ends with at most one campaign.unsubscribed event." ] ;
516
+ sh:property [
517
+ sh:path campaigns:next-step-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
518
+ sh:message "An enrollment has at most one next step time." ] ;
519
+ sh:sparql [
520
+ a sh:SPARQLConstraint ;
521
+ sh:message "The cadence of an enrollment must belong to the campaign of the enrollment." ;
522
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
523
+ sh:select """
524
+ SELECT $this ?value WHERE {
525
+ $this campaigns:of-cadence ?value ; campaigns:of-campaign ?campaign .
526
+ FILTER NOT EXISTS { ?value campaigns:of-campaign ?campaign }
527
+ }""" ] .
528
+
529
+ campaigns-shapes:planned-enrollment-shape a sh:NodeShape ;
530
+ sh:targetClass campaigns:planned-enrollment ;
531
+ sh:closed true ;
532
+ sh:ignoredProperties ( rdf:type ) ;
533
+ sh:property [
534
+ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
535
+ sh:message "A planned enrollment must have exactly one id." ] ;
536
+ sh:property [
537
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
538
+ sh:message "A planned enrollment must belong to exactly one workspace." ] ;
539
+ sh:property [
540
+ sh:path campaigns:of-lead-record ; sh:class core:entity ; sh:minCount 1 ; sh:maxCount 1 ;
541
+ sh:message "A planned enrollment must be for exactly one lead record." ] ;
542
+ sh:property [
543
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
544
+ sh:message "A planned enrollment must be for exactly one campaign." ] ;
545
+ sh:property [
546
+ sh:path campaigns:of-cadence ; sh:class campaigns:cadence ; sh:minCount 1 ; sh:maxCount 1 ;
547
+ sh:message "A planned enrollment must have exactly one cadence." ] ;
548
+ sh:sparql [
549
+ a sh:SPARQLConstraint ;
550
+ sh:message "The cadence of a planned enrollment must belong to the campaign of the planned enrollment." ;
551
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
552
+ sh:select """
553
+ SELECT $this ?value WHERE {
554
+ $this campaigns:of-cadence ?value ; campaigns:of-campaign ?campaign .
555
+ FILTER NOT EXISTS { ?value campaigns:of-campaign ?campaign }
556
+ }""" ] ;
557
+ sh:sparql [
558
+ a sh:SPARQLConstraint ;
559
+ sh:message "A planned enrollment belongs to a campaign with the status draft." ;
560
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
561
+ sh:select """
562
+ SELECT $this WHERE {
563
+ $this campaigns:of-campaign ?campaign .
564
+ ?campaign core:has-status ?status .
565
+ FILTER (?status != campaigns-vocab:status-draft)
566
+ }""" ] .
567
+
568
+ campaigns-shapes:step-position-shape a sh:NodeShape ;
569
+ sh:targetClass campaigns:step-position ;
570
+ sh:closed true ;
571
+ sh:ignoredProperties ( rdf:type ) ;
572
+ sh:property [
573
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
574
+ sh:message "A step position must belong to exactly one workspace." ] ;
575
+ sh:property [
576
+ sh:path campaigns:of-person ; sh:class identity:person ; sh:minCount 1 ; sh:maxCount 1 ;
577
+ sh:message "A step position must be for exactly one person." ] ;
578
+ sh:property [
579
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
580
+ sh:message "A step position must be for exactly one campaign." ] ;
581
+ sh:property [
582
+ sh:path campaigns:of-cadence ; sh:class campaigns:cadence ; sh:minCount 1 ; sh:maxCount 1 ;
583
+ sh:message "A step position must have exactly one cadence." ] ;
584
+ sh:property [
585
+ sh:path campaigns:at-step ; sh:class campaigns:step ; sh:maxCount 1 ;
586
+ sh:message "A step position has at most one step. An enrollment event gives a cadence and no step." ] ;
587
+ sh:property [
588
+ sh:path campaigns:by-step-map ; sh:class campaigns:step-map ; sh:maxCount 1 ;
589
+ sh:message "A step position has at most one version of the step map." ] ;
590
+ sh:property [
591
+ sh:path core:started-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ;
592
+ sh:message "A step position must have exactly one start time, the occurredAt of its event." ] ;
593
+ sh:property [
594
+ sh:path core:ended-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
595
+ sh:message "A step position can have at most one end time. The current position has none." ] ;
596
+ sh:property [
597
+ sh:path core:was-generated-by ;
598
+ sh:or ( [ sh:class events:step-completed ] [ sh:class events:step-skipped ] [ sh:class events:campaign-enrolled ] ) ;
599
+ sh:minCount 1 ; sh:maxCount 1 ;
600
+ sh:message "A step position must come from exactly one step event or enrollment event." ] ;
601
+ sh:sparql [
602
+ a sh:SPARQLConstraint ;
603
+ sh:message "The start of a step position must be the occurredAt of its event." ;
604
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
605
+ sh:select """
606
+ SELECT $this ?value WHERE {
607
+ $this core:started-at ?value ; core:was-generated-by ?event .
608
+ ?event events:occurred-at ?at .
609
+ FILTER (?value != ?at)
610
+ }""" ] ;
611
+ sh:sparql [
612
+ a sh:SPARQLConstraint ;
613
+ sh:message "The person of a step position must be the subject of its event." ;
614
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
615
+ sh:select """
616
+ SELECT $this ?value WHERE {
617
+ $this campaigns:of-person ?value ; core:was-generated-by ?event .
618
+ ?event identity:of-subject ?other .
619
+ FILTER (?value != ?other)
620
+ }""" ] ;
621
+ sh:sparql [
622
+ a sh:SPARQLConstraint ;
623
+ sh:message "The cadence of a step position must belong to its campaign, and the step must belong to the cadence." ;
624
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
625
+ sh:select """
626
+ SELECT $this ?value WHERE {
627
+ {
628
+ $this campaigns:of-cadence ?value ; campaigns:of-campaign ?campaign .
629
+ FILTER NOT EXISTS { ?value campaigns:of-campaign ?campaign }
630
+ } UNION {
631
+ $this campaigns:of-cadence ?cadence ; campaigns:at-step ?value .
632
+ FILTER NOT EXISTS { ?value campaigns:of-cadence ?cadence }
633
+ }
634
+ }""" ] ;
635
+ sh:sparql [
636
+ a sh:SPARQLConstraint ;
637
+ sh:message "The version of the step map of a step position must be the version that applied at the start of the position." ;
638
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
639
+ sh:select """
640
+ SELECT $this ?value WHERE {
641
+ $this campaigns:by-step-map ?value ; core:started-at ?start .
642
+ ?value core:started-at ?mapStart .
643
+ OPTIONAL { ?value core:ended-at ?mapEnd }
644
+ FILTER (?mapStart > ?start || (BOUND(?mapEnd) && ?mapEnd <= ?start))
645
+ }""" ] ;
646
+ sh:sparql [
647
+ a sh:SPARQLConstraint ;
648
+ sh:message "The version of the step map of a step position must belong to the campaign of the position and include its cadence and its step." ;
649
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
650
+ sh:select """
651
+ SELECT $this ?value WHERE {
652
+ $this campaigns:by-step-map ?value ; campaigns:of-campaign ?campaign ; campaigns:of-cadence ?cadence .
653
+ OPTIONAL { $this campaigns:at-step ?step }
654
+ FILTER (
655
+ NOT EXISTS { ?value campaigns:of-campaign ?campaign ; campaigns:includes-cadence ?cadence }
656
+ || (BOUND(?step) && NOT EXISTS { ?value campaigns:includes-step ?step })
657
+ )
658
+ }""" ] .
659
+
660
+ # Link tokens and devices.
661
+
662
+ campaigns-shapes:link-token-shape a sh:NodeShape ;
663
+ sh:targetClass campaigns:link-token ;
664
+ sh:closed true ;
665
+ sh:ignoredProperties ( rdf:type ) ;
666
+ sh:property [
667
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
668
+ sh:message "A link token must name exactly one workspace (claim t)." ] ;
669
+ sh:property [
670
+ sh:path campaigns:for-lead ; sh:class identity:lead ; sh:minCount 1 ; sh:maxCount 1 ;
671
+ sh:message "A link token must name exactly one lead (claim l)." ] ;
672
+ sh:property [
673
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
674
+ sh:message "A link token must name exactly one campaign (claim c)." ] ;
675
+ sh:property [
676
+ sh:path campaigns:through-channel ; sh:node campaigns-shapes:channel-value-shape ; sh:minCount 1 ; sh:maxCount 1 ;
677
+ sh:message "A link token must name exactly one medium (claim m) from the scheme of channels." ] ;
678
+ sh:property [
679
+ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ;
680
+ sh:message "A link token must have exactly one time of the send." ] ;
681
+ sh:property [
682
+ sh:path campaigns:expires-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ;
683
+ sh:message "A link token must have exactly one expiry (claim e)." ] ;
684
+ sh:property [
685
+ sh:path campaigns:signed-with ; sh:class identity:issuer-key ; sh:minCount 1 ; sh:maxCount 1 ;
686
+ sh:message "A link token must be signed with exactly one issuer key, the kid of its header." ] ;
687
+ sh:sparql campaigns-shapes:channel-of-workspace ;
688
+ sh:sparql [
689
+ a sh:SPARQLConstraint ;
690
+ sh:message "A link token expires 90 days after the send." ;
691
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
692
+ sh:select """
693
+ SELECT $this ?value WHERE {
694
+ $this campaigns:expires-at ?value ; core:generated-at ?sent .
695
+ FILTER (?value != ?sent + "P90D"^^xsd:dayTimeDuration)
696
+ }""" ] .
697
+
698
+ campaigns-shapes:device-shape a sh:NodeShape ;
699
+ sh:targetClass campaigns:device ;
700
+ sh:closed true ;
701
+ sh:ignoredProperties ( rdf:type ) ;
702
+ sh:property [
703
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
704
+ sh:message "A device must belong to exactly one workspace." ] ;
705
+ sh:property [
706
+ sh:path campaigns:for-lead ; sh:class identity:lead ; sh:minCount 1 ; sh:maxCount 1 ;
707
+ sh:message "A device must be for exactly one lead." ] ;
708
+ sh:property [
709
+ sh:path campaigns:of-campaign ; sh:class campaigns:campaign ; sh:minCount 1 ; sh:maxCount 1 ;
710
+ sh:message "A device must be for exactly one campaign." ] ;
711
+ sh:property [
712
+ sh:path campaigns:through-channel ; sh:node campaigns-shapes:channel-value-shape ; sh:minCount 1 ; sh:maxCount 1 ;
713
+ sh:message "A device must be for exactly one medium from the scheme of channels." ] ;
714
+ sh:property [
715
+ sh:path campaigns:from-anonymous-subject ; sh:class identity:anonymous-subject ; sh:minCount 1 ; sh:maxCount 1 ;
716
+ sh:message "A device must have exactly one anonymous subject." ] ;
717
+ sh:property [
718
+ sh:path campaigns:with-token ; sh:class campaigns:link-token ; sh:minCount 1 ; sh:maxCount 1 ;
719
+ sh:message "A device must come from exactly one link token." ] ;
720
+ sh:property [
721
+ sh:path campaigns:has-ordinal ; sh:datatype xsd:positiveInteger ; sh:minCount 1 ; sh:maxCount 1 ;
722
+ sh:message "A device must have exactly one place among the devices of its lead, campaign and medium." ] ;
723
+ sh:property [
724
+ sh:path campaigns:led-to ; sh:minCount 1 ; sh:maxCount 1 ;
725
+ sh:or ( [ sh:class identity:merge ] [ sh:class identity:suggestion ] ) ;
726
+ sh:message "A device must give exactly one merge or one suggestion." ] ;
727
+ sh:property [
728
+ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
729
+ sh:message "A device can have at most one time of its first click." ] ;
730
+ sh:sparql campaigns-shapes:channel-of-workspace ;
731
+ sh:sparql [
732
+ a sh:SPARQLConstraint ;
733
+ sh:message "From the fourth device of a lead, a campaign and a medium, each click makes a suggestion and not a merge." ;
734
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
735
+ sh:select """
736
+ SELECT $this ?value WHERE {
737
+ $this campaigns:has-ordinal ?value ; campaigns:led-to ?result .
738
+ FILTER (?value > 3)
739
+ FILTER NOT EXISTS { ?result a identity:suggestion }
740
+ }""" ] ;
741
+ sh:sparql [
742
+ a sh:SPARQLConstraint ;
743
+ sh:message "The link token of a device must name the same lead, campaign and medium as the device." ;
744
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
745
+ sh:select """
746
+ SELECT $this WHERE {
747
+ $this campaigns:with-token ?token ; campaigns:for-lead ?lead ; campaigns:of-campaign ?campaign ; campaigns:through-channel ?channel .
748
+ FILTER NOT EXISTS { ?token campaigns:for-lead ?lead ; campaigns:of-campaign ?campaign ; campaigns:through-channel ?channel }
749
+ }""" ] .
750
+
751
+ # Notice of Art. 14 (docs/decisions/0004-privacy.md, Q46).
752
+
753
+ campaigns-shapes:notice-shape a sh:NodeShape ;
754
+ sh:targetClass campaigns:notice ;
755
+ sh:closed true ;
756
+ sh:ignoredProperties ( rdf:type ) ;
757
+ sh:property [
758
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
759
+ sh:message "A notice must belong to exactly one workspace." ] ;
760
+ sh:property [
761
+ sh:path campaigns:to-identifier ; sh:class identity:identifier ; sh:minCount 1 ; sh:maxCount 1 ;
762
+ sh:message "A notice must have exactly one identifier of the person." ] ;
763
+ sh:property [
764
+ sh:path campaigns:through-channel ; sh:node campaigns-shapes:channel-value-shape ; sh:minCount 1 ; sh:maxCount 1 ;
765
+ sh:message "A notice must have exactly one channel from the scheme of channels." ] ;
766
+ sh:property [
767
+ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:minCount 1 ; sh:maxCount 1 ;
768
+ sh:message "A notice must have exactly one time." ] ;
769
+ sh:property [
770
+ sh:path core:was-generated-by ; sh:class core:event ; sh:minCount 1 ; sh:maxCount 1 ;
771
+ sh:message "A notice must come from exactly one notice.given event." ] ;
772
+ sh:property [
773
+ sh:path core:was-attributed-to ; sh:class campaigns:channel-service ; sh:minCount 1 ; sh:maxCount 1 ;
774
+ sh:message "A notice must come from exactly one channel service." ] ;
775
+ sh:sparql campaigns-shapes:channel-of-workspace .
776
+
777
+ campaigns-shapes:template-of-outreach-shape a sh:NodeShape ;
778
+ sh:targetClass campaigns:template-of-outreach ;
779
+ sh:closed true ;
780
+ sh:ignoredProperties ( rdf:type ) ;
781
+ sh:property [
782
+ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
783
+ sh:message "A template of outreach must have exactly one id." ] ;
784
+ sh:property [
785
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
786
+ sh:message "A template of outreach must belong to exactly one workspace." ] ;
787
+ sh:property [
788
+ sh:path core:has-name ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
789
+ sh:message "A template of outreach must have exactly one name." ] ;
790
+ sh:property [
791
+ sh:path campaigns:has-body ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
792
+ sh:message "A template of outreach must have exactly one body." ] ;
793
+ sh:property [
794
+ sh:path campaigns:has-subject ; sh:datatype xsd:string ; sh:maxCount 1 ;
795
+ sh:message "A template of outreach can have at most one subject." ] .
796
+
797
+ campaigns-shapes:channel-account-shape a sh:NodeShape ;
798
+ sh:targetClass campaigns:channel-account ;
799
+ sh:property [
800
+ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
801
+ sh:message "A channel account has exactly one id."
802
+ ] ;
803
+ sh:property [
804
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
805
+ sh:message "A channel account belongs to exactly one workspace."
806
+ ] ;
807
+ sh:property [
808
+ sh:path core:has-status ; sh:class core:concept ; sh:minCount 1 ; sh:maxCount 1 ;
809
+ sh:message "A channel account has exactly one status."
810
+ ] ;
811
+ sh:property [
812
+ sh:path campaigns:has-account-pause-reason ; sh:class core:concept ; sh:maxCount 1 ;
813
+ sh:in ( campaigns-vocab:account-pause-reason-credits campaigns-vocab:account-pause-reason-teammate ) ;
814
+ sh:message "A channel account has at most one pause reason: credits or teammate."
815
+ ] ;
816
+ sh:property [
817
+ sh:path campaigns:bills-action ; sh:class core:concept ;
818
+ sh:in ( campaigns-vocab:billable-action-send campaigns-vocab:billable-action-invite campaigns-vocab:billable-action-message campaigns-vocab:billable-action-profile-view ) ;
819
+ sh:message "The billable actions of A channel account are send, invite, message or profile-view."
820
+ ] ;
821
+ sh:property [
822
+ sh:path campaigns:has-monthly-cost ; sh:datatype xsd:long ; sh:minInclusive 0 ; sh:maxCount 1 ;
823
+ sh:message "A channel account has at most one monthly cost, an integer of micro-USD from 0."
824
+ ] .
825
+
826
+ campaigns-shapes:send-window-shape a sh:NodeShape ;
827
+ sh:targetClass campaigns:send-window ;
828
+ sh:closed true ;
829
+ sh:ignoredProperties ( rdf:type ) ;
830
+ sh:property [
831
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
832
+ sh:message "A send window belongs to exactly one workspace."
833
+ ] ;
834
+ sh:property [
835
+ sh:path campaigns:on-weekday ; sh:datatype xsd:integer ; sh:minInclusive 1 ; sh:maxInclusive 7 ; sh:minCount 1 ; sh:maxCount 7 ;
836
+ sh:message "A send window has one to seven weekdays, each from 1 (Monday) to 7 (Sunday)."
837
+ ] ;
838
+ sh:property [
839
+ sh:path campaigns:starts-at-hour ; sh:datatype xsd:integer ; sh:minInclusive 0 ; sh:maxInclusive 23 ; sh:minCount 1 ; sh:maxCount 1 ;
840
+ sh:message "A send window has exactly one start hour, from 0 to 23."
841
+ ] ;
842
+ sh:property [
843
+ sh:path campaigns:ends-at-hour ; sh:datatype xsd:integer ; sh:minInclusive 1 ; sh:maxInclusive 24 ; sh:minCount 1 ; sh:maxCount 1 ;
844
+ sh:message "A send window has exactly one end hour, from 1 to 24."
845
+ ] ;
846
+ sh:property [
847
+ sh:path campaigns:in-time-zone ; sh:datatype xsd:string ; sh:maxCount 1 ;
848
+ sh:message "A send window has at most one time zone."
849
+ ] .
850
+
851
+ campaigns-shapes:variable-shape a sh:NodeShape ;
852
+ sh:targetClass campaigns:variable ;
853
+ sh:closed true ;
854
+ sh:ignoredProperties ( rdf:type core:hint ) ;
855
+ sh:property [
856
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
857
+ sh:message "A variable belongs to exactly one workspace."
858
+ ] ;
859
+ sh:property [
860
+ sh:path campaigns:has-key ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
861
+ sh:pattern "^[a-z][a-z0-9-]*\\.[a-z][a-z0-9-]*$" ;
862
+ sh:in ( "lead-record.first-name" "lead-record.job-title" "account-record.name" "sender.first-name" "sender.signature" ) ;
863
+ sh:message "A variable has exactly one key, in the form of a variable group, a dot and a kebab-case name. The key is one of the five keys of outreach 0008."
864
+ ] ;
865
+ sh:property [
866
+ sh:path campaigns:in-variable-group ; sh:class core:concept ; sh:minCount 1 ; sh:maxCount 1 ;
867
+ sh:in ( campaigns-vocab:variable-group-lead-record campaigns-vocab:variable-group-account-record campaigns-vocab:variable-group-sender campaigns-vocab:variable-group-buying-trigger ) ;
868
+ sh:message "A variable has exactly one variable group: lead-record, account-record, sender or buying-trigger."
869
+ ] ;
870
+ sh:property [
871
+ sh:path campaigns:reads-term ; sh:nodeKind sh:IRI ; sh:minCount 1 ;
872
+ sh:message "A variable reads one or more properties of the owner service."
873
+ ] ;
874
+ sh:sparql [
875
+ a sh:SPARQLConstraint ;
876
+ sh:message "The key of a variable starts with the notation of its variable group and a dot." ;
877
+ sh:prefixes <https://id.quickpipe.ai/domain/shapes/campaigns> ;
878
+ sh:select """
879
+ SELECT $this WHERE {
880
+ $this campaigns:has-key ?key ; campaigns:in-variable-group ?group .
881
+ ?group core:in-scheme campaigns-vocab:variable-group ; core:notation ?notation .
882
+ FILTER (!STRSTARTS(?key, CONCAT(?notation, ".")))
883
+ }""" ] .
884
+
885
+ campaigns-shapes:kai-draft-shape a sh:NodeShape ;
886
+ sh:targetClass campaigns:kai-draft ;
887
+ sh:closed true ;
888
+ sh:ignoredProperties ( rdf:type ) ;
889
+ sh:property [
890
+ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
891
+ sh:message "A Kai draft has exactly one id."
892
+ ] ;
893
+ sh:property [
894
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
895
+ sh:message "A Kai draft belongs to exactly one workspace."
896
+ ] ;
897
+ sh:property [
898
+ sh:path campaigns:has-draft-status ; sh:class core:concept ; sh:minCount 1 ; sh:maxCount 1 ;
899
+ sh:in ( campaigns-vocab:draft-status-waiting campaigns-vocab:draft-status-approved campaigns-vocab:draft-status-rejected ) ;
900
+ sh:message "A Kai draft has exactly one draft status: waiting, approved or rejected."
901
+ ] ;
902
+ sh:property [
903
+ sh:path campaigns:in-enrollment ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ;
904
+ sh:message "A Kai draft has exactly one enrollment."
905
+ ] ;
906
+ sh:property [
907
+ sh:path campaigns:for-step ; sh:nodeKind sh:IRI ; sh:minCount 1 ; sh:maxCount 1 ;
908
+ sh:message "A Kai draft has exactly one step."
909
+ ] ;
910
+ sh:property [
911
+ sh:path campaigns:has-draft-subject ; sh:datatype xsd:string ; sh:minLength 1 ; sh:maxCount 1 ;
912
+ sh:message "A Kai draft can have at most one subject."
913
+ ] ;
914
+ sh:property [
915
+ sh:path campaigns:has-draft-body ; sh:datatype xsd:string ; sh:minLength 1 ; sh:minCount 1 ; sh:maxCount 1 ;
916
+ sh:message "A Kai draft has exactly one body."
917
+ ] .
918
+
919
+ campaigns-shapes:step-call-shape a sh:NodeShape ;
920
+ sh:targetClass campaigns:step-call ;
921
+ sh:closed true ;
922
+ sh:ignoredProperties ( rdf:type ) ;
923
+ sh:property [
924
+ sh:path core:id ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ;
925
+ sh:message "A step call has exactly one id." ] ;
926
+ sh:property [
927
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
928
+ sh:message "A step call belongs to exactly one workspace." ] ;
929
+ sh:property [
930
+ sh:path campaigns:in-enrollment ; sh:class campaigns:enrollment ; sh:minCount 1 ; sh:maxCount 1 ;
931
+ sh:message "A step call has exactly one enrollment." ] ;
932
+ sh:property [
933
+ sh:path campaigns:for-step ; sh:class campaigns:step ; sh:minCount 1 ; sh:maxCount 1 ;
934
+ sh:message "A step call has exactly one step." ] ;
935
+ sh:property [
936
+ sh:path campaigns:has-attempt ; sh:datatype xsd:positiveInteger ; sh:minCount 1 ; sh:maxCount 1 ;
937
+ sh:message "A step call has exactly one attempt number, from 1." ] ;
938
+ sh:property [
939
+ sh:path core:generated-at ; sh:datatype xsd:dateTime ; sh:maxCount 1 ;
940
+ sh:message "A step call has at most one write time." ] ;
941
+ sh:property [
942
+ sh:path campaigns:from-sender ; sh:datatype xsd:string ; sh:maxCount 1 ;
943
+ sh:message "A step call has at most one sender id." ] ;
944
+ sh:property [
945
+ sh:path campaigns:has-answer ; sh:class core:concept ; sh:maxCount 1 ;
946
+ sh:in ( campaigns-vocab:step-call-answer-accepted campaigns-vocab:step-call-answer-daily-limit campaigns-vocab:step-call-answer-credits campaigns-vocab:step-call-answer-not-active campaigns-vocab:step-call-answer-handle ) ;
947
+ sh:message "A step call has at most one answer: accepted, daily-limit, credits, not-active or handle." ] .
948
+
949
+ campaigns-shapes:workspace-settings-shape a sh:NodeShape ;
950
+ sh:targetClass campaigns:workspace-settings ;
951
+ sh:closed true ;
952
+ sh:ignoredProperties ( rdf:type ) ;
953
+ sh:property [
954
+ sh:path core:in-workspace ; sh:class core:workspace ; sh:minCount 1 ; sh:maxCount 1 ;
955
+ sh:message "The settings belong to exactly one workspace." ] ;
956
+ sh:property [
957
+ sh:path campaigns:has-default-time-zone ; sh:datatype xsd:string ; sh:minLength 1 ; sh:maxLength 64 ; sh:minCount 1 ; sh:maxCount 1 ;
958
+ sh:message "The settings have exactly one default time zone, an IANA name of at most 64 characters." ] .