-
Notifications
You must be signed in to change notification settings - Fork 5
/
dosdp_schema.yaml
593 lines (533 loc) · 19.2 KB
/
dosdp_schema.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
$schema: "http://json-schema.org/draft-07/schema#"
#id: 'https://github.com/dosumis/dead_simple_owl_design_patterns/edit/master/spec/DOSDP_spec.json' # Use Purl?
title: DOSDP
type: object
additionalProperties: False
definitions:
multi_clause_printf:
required: [ 'clauses' ]
additionalProperties: False
properties:
sep:
type: string
description: >
A string used as clause separator while aggregating multiple clauses.
clauses:
type: array
description: >
List of optional clauses. Rules for optional clauses: list_vars may be passed,
but only one list_var per multi-clause printf is permitted. If an empty list_var is passed,
the clause, and any subclauses, are omitted. If list_var with length n is passed, the
clause is repeated n times, using the specified separtor to join clauses. There is no
effect on the number of subclauses in this case.
items: { $ref : '#/definitions/printf_clause' }
printf_clause:
required: [ 'text', 'vars' ]
additionalProperties: False
properties:
text:
description: A print format string.
type: string
vars:
description: >
An ordered list of variables for substitution into the accompanying
print format string. Each entry must correspond to the name of a variable
specified in either the 'vars', 'internal_vars' or the data_var field of the pattern.
Where an OWL entity is specified, the label for the OWL entity should be
used in the substitution.
SPECIAL RULES FOR multi_clause_printf context: In this context, list_vars are permitted.
If an list is empty, the clause and any subclauses must not be added. for lists of
length > 1, mutiple clauses should be added, using the specified separator
type: array
items: { type: string }
sub_clauses:
description: >
List of clauses that depends on this clause. If parent clause cannot be printed,
all sub_clauses are also discarded.
type: array
items: { $ref : '#/definitions/multi_clause_printf' }
function:
oneOf:
- { $ref : "#/definitions/join" }
- { $ref : "#/definitions/regex_sub" }
join:
properties:
sep:
type: string
description: >
A string used as value separator while joining list type (multi value) variables.
printf_annotation:
type: object
additionalProperties: False
oneOf:
- required: [ annotationProperty, text ]
- required: [ multi_clause ]
properties:
annotationProperty:
description: >
A string corresponding to the rdfs:label
of an owl annotation property. If the annotation property has no label,
the shortForm ID should be used. The annotation property must be listed
in the annotation property dictionary.'
type: string
annotations:
items: { $ref: "#/definitions/annotations" }
type: array
text:
description: A print format string.
type: string
vars:
description: >
An ordered list of variables for substitution into the accompanying
print format string. Each entry must correspond to the name of a variable
specified in either the 'vars' field or the data_var field of the pattern.
Where an OWL entity is specified, the label for the OWL entity should be
used in the substitution. An empty var list can be specified simply by
leaving this field out.
items: {type: string}
type: array
multi_clause:
items: { $ref: '#/definitions/multi_clause_printf' }
list_annotation:
type: object
additionalProperties: False
required: [annotationProperty, value]
properties:
annotationProperty:
description: >
A string corresponding to the rdfs:label
of an owl annotation property. If the annotation property has no label,
the shortForm ID should be used. The annotation property must be listed
in the annotation property dictionary.'
type: string
value:
description: >
A single list variable (list_var or data_list_var). Each item in this list
should be used to generate a separate annotation axiom.
type: string
iri_value_annotation:
type: object
additionalProperties: False
required: [annotationProperty, var]
properties:
annotationProperty:
description: A string corresponding to a key in the annotation property dictionary.
type: string
var:
description: The name of a variable specified in the 'vars' field. The IRI of the variable value will be the object of the annotation axiom.
type: string
annotations:
items: { $ref: "#/definitions/annotations" }
type: array
annotations:
oneOf:
- { $ref: "#/definitions/printf_annotation" }
- { $ref: "#/definitions/list_annotation" }
- { $ref: "#/definitions/iri_value_annotation" }
printf_owl:
type: object
additionalProperties: False
oneOf:
- required: [ axiom_type, text, vars ]
- required: [ multi_clause ]
properties:
annotations:
items: {$ref: '#/definitions/annotations'}
type: array
axiom_type:
description: >
OWL axiom type expressed as manchester syntax: equivalentTo,
subClassOf, disjointWith. GCI - for general class inclusion axioms, is
also valid (although missing from manchester syntax.) This specifies the
axiom type to be generated from the text following substitution.'
enum: [equivalentTo, subClassOf, disjointWith, GCI]
type: string
text:
type: string
description: >
A print format string in OWL Manchester syntax. Each entry
must correspond to an entry in o the name of a var in the var field of the
pattern. Entries in single quotes must correspond to the labels of entries
in owl_entity dictionaries (classes, relations, dataProperties)
vars:
description: >
An ordered list of variables for substitution into the accompanying
print format string. Each entry must correspond to the name of a variable
specified in either the 'vars' field or the data_var field of the pattern.
An empty var list can be specified simply by leaving this field out.
items: {type: string}
type: array
multi_clause:
items: { $ref: '#/definitions/multi_clause_printf' }
printf_owl_convenience:
type: object
additionalProperties: False
oneOf:
- required: [ text, vars ]
- required: [ multi_clause ]
properties:
annotations:
items: {$ref: '#/definitions/annotations'}
type: array
text:
type: string
description: >
A print format string in OWL Manchester syntax. Each entry
must correspond to an entry in o the name of a var in the var field of the
pattern. Entries in single quotes must correspond to the labels of entries
in owl_entity dictionaries (classes, relations, dataProperties)
vars:
description: >
An ordered list of variables for substitution into the accompanying
print format string. Each entry must correspond to the name of a variable
specified in either the 'vars' field or the data_var field of the pattern.
items: {type: string}
type: array
multi_clause:
items: { $ref: '#/definitions/multi_clause_printf' }
regex_sub:
additionalProperties: False
required: [in, out, match, sub]
type: object
properties:
in:
type: string
description: name of input var
out:
type: string
description: >
Name of output var. If input var specified an OWL entity then
readable identifier is used as input to substitution
match:
type: string
description: perl style regex match
sub:
type: string
description: perl style regex sub. May include backreferences.
opa:
type: object
additionalProperties: False
required: [edge]
properties:
edge:
description: >
A triple specified as an ordered array with 3 elements
[subject, rel, object]
* rel must be the quoted name of a relation from the relations
(object property) dictionary.
* subject and object must be the name of an individual
specified in the nodes field.
type: array
items: { type: string }
minItems: 3
maxItems: 3
annotations:
type: array
items: { $ref: '#/definitions/annotations' }
not:
description: "Optional field for negated OPAs"
type: boolean
# TODO - split into separate schema file
printf_annotation_obo:
type: object
additionalProperties: False
oneOf:
- required: [ text, vars ]
- required: [ multi_clause ]
properties:
annotations:
items: { $ref: "#/definitions/annotations" }
type: array
xrefs:
description: >
Takes the name of a single data_list_var specifying a list of database
cross references.
type: string
mapping: "oboInOwl:hasDbXref"
text:
description: A print format string.
type: string
vars:
description: >
An ordered list of variables for substitution into the accompanying
print format string. Each entry must correspond to the name of a variable
specified in either the 'vars' field or the data_var field of the pattern.
Where an OWL entity is specified, the label for the OWL entity should be
used in the substitution.
items: {type: string}
type: array
multi_clause:
items: { $ref: '#/definitions/multi_clause_printf' }
list_annotation_obo:
type: object
additionalProperties: False
required: [value]
properties:
value:
description: >
A single list variable (list_var or data_list_var). Each item in this list
should be used to generate a separate annotation axiom.
type: string
xrefs:
description: >
Takes the name of a single data_list_var specifying a list of database
cross references. Use of this field should add the same xref set to all
annotation axioms generated.
type: string
mapping: "oboInOwl:hasDbXref"
# Generic properties
properties:
pattern_name:
type: string # possible to specify ASCII?
description: >
The name of the pattern. This must be an ASCII string with
no spaces. The only special characters allowed are '_' and '-'.
By convention, this is used as the file name of the
pattern - with an appropriate extension.
doc_type: root
pattern_iri:
type: string
description: >
A global identifier for the pattern. This can be a full IRI or a CURIE, using
the same prefix mappings as other CURIEs in the pattern.
doc_type: root
base_IRI: # not rqd, give JSON-LD base.
type: string # how to spec IRI?
description: "Specifies the base IRI to be used to generate new classes."
doc_type: root
contributors:
type: array
items: { type: string }
description: >
A list of authors of a pattern.
Each author must be specified using a URL or Curie - we recommend ORCID.
We do not recommend that this list is instantiated in terms generated using a pattern,
but where it is it should be instantiated as a set of annotation axioms using dc:contributor.
doc_type: root
description:
type: string # specify UTF-8 string?
description: "A free text description of the pattern. Must be UTF-8 encoded."
doc_type: root
examples:
type: array
items: { type: string }
description: "A list of example terms implementing this pattern."
doc_type: root
status:
type: string
description: "Implementation status of pattern."
enum:
- development
- published
doc_type: root
tags:
type: array
items: { type: string }
description: >
A list of strings used to tag a pattern for the purposes of arbitrary,
cross-cutting grouping of patterns.
doc_type: root
readable_identifiers:
type: array
items: { type: string }
description: "A list of annotation properties used as naming fields, in order of preference."
doc_type: root
#### owl_entity Dictionaries
classes:
type: object
description: "A dictionary of OWL classes. key :label; value : short form id"
doc_type: owl_entity_dict
objectProperties:
type: object
description: "A dictionary of OWL object properties. key : label; value : short form id"
doc_type: owl_entity_dict
relations:
# Just an alternative name for the ObjectProperties dict
type: object
description: "A dictionary of OWL object properties. key : label; value : short form id"
doc_type: owl_entity_dict
dataProperties:
type: object
description: "A dictionary of OWL data properties key : label; value : short form id"
doc_type: owl_entity_dict
annotationProperties:
type: object
description: "A dictionary of OWL annotation properties key : label; value : short form id"
doc_type: owl_entity_dict
# Var types
vars:
type: object
propertyNames:
pattern: "^[A-Za-z_][A-Za-z0-9_]*$"
description: >
A dictionary of variables ranging over OWL classes.
Key = variable name, value = variable range as manchester syntax string.
doc_type: var_types
list_vars:
type: object
propertyNames:
pattern: "^[A-Za-z_][A-Za-z0-9_]*$"
description: >
A dictionary of variables refering to lists of owl classes.
Key = variable name, value = variable range of items in list specified as a valid OWL
data-type.
doc_type: var_types
data_vars:
type: object
propertyNames:
pattern: "^[A-Za-z_][A-Za-z0-9_]*$"
description: >
A dictionary of variables ranging over OWL data-types.
Key = variable name, value = variable range specified as a valid OWL
data-type.
doc_type: var_types
data_list_vars:
type: object
propertyNames:
pattern: "^[A-Za-z_][A-Za-z0-9_]*$"
description: >
A dictionary of variables rrefering to lists of some specified OWL data-types.
Key = variable name, value = variable range of all items in list,
specified as a valid OWL data-type.
doc_type: var_types
internal_vars:
type: array
properties:
var_name:
pattern: "^[A-Za-z_][A-Za-z0-9_]*$"
description: >
Name of the internal variable to be defined. Expected naming pattern is ^[A-Za-z_][A-Za-z0-9_]*$
type: string
input:
description: >
A list_vars or data_list_vars variable to which the given function applied.
type: string
apply: { $ref: "#/definitions/function" }
description: >
List of internal variable construction definitions. Given function is applied to the given multi value input
and the result is defined as a new internal variable.
doc_type: var_types
# Var munging
substitutions:
type: array
items: { $ref : '#/definitions/regex_sub' }
doc_type: var_munging
# Specifying axioms:
annotations:
items: { $ref: "#/definitions/annotations" }
type: array
doc_type: axioms
logical_axioms:
items: { $ref: '#/definitions/printf_owl'}
type: array
doc_type: axioms
# logical convenience fields.
# Where only one of any OWL axiom type is present, these convenience fields may be used.
equivalentTo:
$ref: '#/definitions/printf_owl_convenience'
doc_type: convenience
subClassOf:
$ref: '#/definitions/printf_owl_convenience'
doc_type: convenience
GCI:
$ref: '#/definitions/printf_owl_convenience'
doc_type: convenience
disjointWith:
$ref: '#/definitions/printf_owl_convenience'
doc_type: convenience
# OBO fields - TODO split to a separate file with import statement.
name:
$ref: '#/definitions/printf_annotation_obo'
mapping: "rdfs:label"
doc_type: obo
comment:
$ref: '#/definitions/printf_annotation_obo'
mapping: "rdfs:comment"
doc_type: obo
def:
$ref: '#/definitions/printf_annotation_obo'
mapping: "obo:IAO_0000115"
doc_type: obo
namespace:
$ref: '#/definitions/printf_annotation_obo'
mapping: "oboInOwl:hasOBONamespace"
doc_type: obo
# TODO: make all these into list_annotations
exact_synonym:
$ref: '#/definitions/list_annotation_obo'
mapping: "oboInOwl:hasExactSynonym"
doc_type: obo
narrow_synonym:
$ref: '#/definitions/list_annotation_obo'
mapping: "oboInOwl:hasNarrowSynonym"
doc_type: obo
related_synonym:
$ref: '#/definitions/list_annotation_obo'
mapping: "oboInOwl:hasRelatedSynonym"
doc_type: obo
broad_synonym:
$ref: '#/definitions/list_annotation_obo'
mapping: "oboInOwl:hasBroadSynonym"
doc_type: obo
xref:
$ref: '#/definitions/list_annotation_obo'
mapping: "oboInOwl:hasDbXref"
doc_type: obo
generated_synonyms:
description: >
An OBO convenience field to allow the specification of exact synonyms
generated by interpolation of OWL entity names into printf text.
Each entry may be annotated.
type: array
items:
$ref: '#/definitions/printf_annotation_obo'
mapping: "oboInOwl:hasExactSynonym"
doc_type: obo
generated_narrow_synonyms:
description: >
An OBO convenience field to allow the specification of narrow synonyms
generated by interpolation of OWL entity names into printf text.
Each entry may be annotated.
type: array
items:
$ref: '#/definitions/printf_annotation_obo'
mapping: "oboInOwl:hasNarrowSynonym"
doc_type: obo
generated_broad_synonyms:
description: >
An OBO convenience field to allow the specification of broad synonyms
generated by interpolation of OWL entity names into printf text.
Each entry may be annotated.
type: array
items:
$ref: '#/definitions/printf_annotation_obo'
mapping: "oboInOwl:hasBroadSynonym"
doc_type: obo
generated_related_synonyms:
description: >
An OBO convenience field to allow the specification of related synonyms
generated by interpolation of OWL entity names into printf text.
Each entry may be annotated.
type: array
items:
$ref: '#/definitions/printf_annotation_obo'
mapping: "oboInOwl:hasBroadSynonym"
doc_type: obo
# instance graph spec - TODO be split to a separate file
instance_graph:
type: object
additionalProperties: False
required: [nodes, edges]
properties:
nodes:
description: >
Key = name of individual within this pattern doc
Value = Type of individual specified using either
the quoted name of a class in the class dictionary of this pattern
or a var name. This field does not support typing via
anonymous class expressions
type: object
edges:
type: array
items: { $ref : '#/definitions/opa' }
doc_type: instance_graph