Skip to content

Commit 851b3c1

Browse files
author
Peter Amstutz
committed
Split minimal base types used in CWL into metaschema_base.yml
1 parent 8823aaa commit 851b3c1

File tree

3 files changed

+163
-151
lines changed

3 files changed

+163
-151
lines changed

schema_salad/metaschema/metaschema.yml

Lines changed: 1 addition & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -46,36 +46,7 @@ $graph:
4646
# How to generate the json-ld context...
4747

4848

49-
- name: PrimitiveType
50-
type: enum
51-
symbols:
52-
- "sld:null"
53-
- "xsd:boolean"
54-
- "xsd:int"
55-
- "xsd:long"
56-
- "xsd:float"
57-
- "xsd:double"
58-
- "xsd:string"
59-
doc:
60-
- |
61-
Salad data types are based on Avro schema declarations. Refer to the
62-
[Avro schema declaration documentation](https://avro.apache.org/docs/current/spec.html#schemas) for
63-
detailed information.
64-
- "null: no value"
65-
- "boolean: a binary value"
66-
- "int: 32-bit signed integer"
67-
- "long: 64-bit signed integer"
68-
- "float: single precision (32-bit) IEEE 754 floating-point number"
69-
- "double: double precision (64-bit) IEEE 754 floating-point number"
70-
- "string: Unicode character sequence"
71-
72-
73-
- name: Any
74-
type: enum
75-
symbols: ["#Any"]
76-
doc: |
77-
The **Any** type validates for any non-null value.
78-
49+
- $import: metaschema_base.yml
7950

8051
- name: JsonldPredicate
8152
type: record
@@ -252,45 +223,6 @@ $graph:
252223
least one type in a schema must be tagged with `documentRoot: true`.
253224
254225
255-
- name: RecordField
256-
type: record
257-
doc: A field of a record.
258-
fields:
259-
- name: name
260-
type: string
261-
jsonldPredicate: "@id"
262-
doc: |
263-
The name of the field
264-
265-
- name: doc
266-
type: string?
267-
doc: |
268-
A documentation string for this field
269-
jsonldPredicate: "sld:doc"
270-
271-
- name: type
272-
type:
273-
- PrimitiveType
274-
- RecordSchema
275-
- EnumSchema
276-
- ArraySchema
277-
- string
278-
- type: array
279-
items:
280-
- PrimitiveType
281-
- RecordSchema
282-
- EnumSchema
283-
- ArraySchema
284-
- string
285-
jsonldPredicate:
286-
_id: sld:type
287-
_type: "@vocab"
288-
typeDSL: true
289-
refScope: 2
290-
doc: |
291-
The field type
292-
293-
294226
- name: SaladRecordField
295227
type: record
296228
extends: RecordField
@@ -304,26 +236,6 @@ $graph:
304236
Annotate this type with linked data context.
305237
jsonldPredicate: "sld:jsonldPredicate"
306238

307-
- name: RecordSchema
308-
type: record
309-
fields:
310-
- name: type
311-
doc: "Must be `record`"
312-
type:
313-
name: Record_symbol
314-
type: enum
315-
symbols:
316-
- "sld:record"
317-
jsonldPredicate:
318-
_id: "sld:type"
319-
_type: "@vocab"
320-
typeDSL: true
321-
refScope: 2
322-
- name: "fields"
323-
type: RecordField[]?
324-
jsonldPredicate: "sld:fields"
325-
doc: "Defines the fields of the record."
326-
327239

328240
- name: SaladRecordSchema
329241
type: record
@@ -361,32 +273,6 @@ $graph:
361273
`specializeTo`.
362274
363275
364-
- name: EnumSchema
365-
type: record
366-
doc: |
367-
Define an enumerated type.
368-
fields:
369-
- name: type
370-
doc: "Must be `enum`"
371-
type:
372-
name: Enum_symbol
373-
type: enum
374-
symbols:
375-
- "sld:enum"
376-
jsonldPredicate:
377-
_id: "sld:type"
378-
_type: "@vocab"
379-
typeDSL: true
380-
refScope: 2
381-
- name: "symbols"
382-
type: string[]
383-
jsonldPredicate:
384-
_id: "sld:symbols"
385-
_type: "@id"
386-
identity: true
387-
doc: "Defines the set of valid symbols."
388-
389-
390276
- name: SaladEnumSchema
391277
type: record
392278
extends: [EnumSchema, SchemaDefinedType]
@@ -406,42 +292,6 @@ $graph:
406292
Indicates that this enum inherits symbols from a base enum.
407293
408294
409-
- name: ArraySchema
410-
type: record
411-
fields:
412-
- name: type
413-
doc: "Must be `array`"
414-
type:
415-
name: Array_symbol
416-
type: enum
417-
symbols:
418-
- "sld:array"
419-
jsonldPredicate:
420-
_id: "sld:type"
421-
_type: "@vocab"
422-
typeDSL: true
423-
refScope: 2
424-
- name: items
425-
type:
426-
- PrimitiveType
427-
- RecordSchema
428-
- EnumSchema
429-
- ArraySchema
430-
- string
431-
- type: array
432-
items:
433-
- PrimitiveType
434-
- RecordSchema
435-
- EnumSchema
436-
- ArraySchema
437-
- string
438-
jsonldPredicate:
439-
_id: "sld:items"
440-
_type: "@vocab"
441-
refScope: 2
442-
doc: "Defines the type of the array elements."
443-
444-
445295
- name: Documentation
446296
type: record
447297
extends: [NamedType, DocType]
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
$base: "https://w3id.org/cwl/salad#"
2+
3+
$namespaces:
4+
sld: "https://w3id.org/cwl/salad#"
5+
dct: "http://purl.org/dc/terms/"
6+
rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7+
rdfs: "http://www.w3.org/2000/01/rdf-schema#"
8+
xsd: "http://www.w3.org/2001/XMLSchema#"
9+
10+
$graph:
11+
- name: PrimitiveType
12+
type: enum
13+
symbols:
14+
- "sld:null"
15+
- "xsd:boolean"
16+
- "xsd:int"
17+
- "xsd:long"
18+
- "xsd:float"
19+
- "xsd:double"
20+
- "xsd:string"
21+
doc:
22+
- |
23+
Salad data types are based on Avro schema declarations. Refer to the
24+
[Avro schema declaration documentation](https://avro.apache.org/docs/current/spec.html#schemas) for
25+
detailed information.
26+
- "null: no value"
27+
- "boolean: a binary value"
28+
- "int: 32-bit signed integer"
29+
- "long: 64-bit signed integer"
30+
- "float: single precision (32-bit) IEEE 754 floating-point number"
31+
- "double: double precision (64-bit) IEEE 754 floating-point number"
32+
- "string: Unicode character sequence"
33+
34+
35+
- name: Any
36+
type: enum
37+
symbols: ["#Any"]
38+
doc: |
39+
The **Any** type validates for any non-null value.
40+
41+
42+
- name: RecordField
43+
type: record
44+
doc: A field of a record.
45+
fields:
46+
- name: name
47+
type: string
48+
jsonldPredicate: "@id"
49+
doc: |
50+
The name of the field
51+
52+
- name: doc
53+
type: string?
54+
doc: |
55+
A documentation string for this field
56+
jsonldPredicate: "sld:doc"
57+
58+
- name: type
59+
type:
60+
- PrimitiveType
61+
- RecordSchema
62+
- EnumSchema
63+
- ArraySchema
64+
- string
65+
- type: array
66+
items:
67+
- PrimitiveType
68+
- RecordSchema
69+
- EnumSchema
70+
- ArraySchema
71+
- string
72+
jsonldPredicate:
73+
_id: sld:type
74+
_type: "@vocab"
75+
typeDSL: true
76+
refScope: 2
77+
doc: |
78+
The field type
79+
80+
81+
- name: RecordSchema
82+
type: record
83+
fields:
84+
- name: type
85+
doc: "Must be `record`"
86+
type:
87+
name: Record_symbol
88+
type: enum
89+
symbols:
90+
- "sld:record"
91+
jsonldPredicate:
92+
_id: "sld:type"
93+
_type: "@vocab"
94+
typeDSL: true
95+
refScope: 2
96+
- name: "fields"
97+
type: RecordField[]?
98+
jsonldPredicate: "sld:fields"
99+
doc: "Defines the fields of the record."
100+
101+
102+
- name: EnumSchema
103+
type: record
104+
doc: |
105+
Define an enumerated type.
106+
fields:
107+
- name: type
108+
doc: "Must be `enum`"
109+
type:
110+
name: Enum_symbol
111+
type: enum
112+
symbols:
113+
- "sld:enum"
114+
jsonldPredicate:
115+
_id: "sld:type"
116+
_type: "@vocab"
117+
typeDSL: true
118+
refScope: 2
119+
- name: "symbols"
120+
type: string[]
121+
jsonldPredicate:
122+
_id: "sld:symbols"
123+
_type: "@id"
124+
identity: true
125+
doc: "Defines the set of valid symbols."
126+
127+
128+
- name: ArraySchema
129+
type: record
130+
fields:
131+
- name: type
132+
doc: "Must be `array`"
133+
type:
134+
name: Array_symbol
135+
type: enum
136+
symbols:
137+
- "sld:array"
138+
jsonldPredicate:
139+
_id: "sld:type"
140+
_type: "@vocab"
141+
typeDSL: true
142+
refScope: 2
143+
- name: items
144+
type:
145+
- PrimitiveType
146+
- RecordSchema
147+
- EnumSchema
148+
- ArraySchema
149+
- string
150+
- type: array
151+
items:
152+
- PrimitiveType
153+
- RecordSchema
154+
- EnumSchema
155+
- ArraySchema
156+
- string
157+
jsonldPredicate:
158+
_id: "sld:items"
159+
_type: "@vocab"
160+
refScope: 2
161+
doc: "Defines the type of the array elements."

schema_salad/schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
_logger = logging.getLogger("salad")
2626

2727
salad_files = ('metaschema.yml',
28+
'metaschema_base.yml',
2829
'salad.md',
2930
'field_name.yml',
3031
'import_include.md',

0 commit comments

Comments
 (0)