Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/schema_salad/metaschema/metaschema.yml @ 2:6af9afd405e9 draft
"planemo upload commit 0a63dd5f4d38a1f6944587f52a8cd79874177fc1"
author | shellac |
---|---|
date | Thu, 14 May 2020 14:56:58 -0400 |
parents | 26e78fe6e8c4 |
children |
comparison
equal
deleted
inserted
replaced
1:75ca89e9b81c | 2:6af9afd405e9 |
---|---|
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 | |
12 - name: "Semantic_Annotations_for_Linked_Avro_Data" | |
13 type: documentation | |
14 doc: | |
15 - $include: salad.md | |
16 - $import: field_name.yml | |
17 - $import: ident_res.yml | |
18 - $import: link_res.yml | |
19 - $import: vocab_res.yml | |
20 - $include: import_include.md | |
21 - $import: map_res.yml | |
22 - $import: typedsl_res.yml | |
23 - $import: sfdsl_res.yml | |
24 | |
25 - name: "Link_Validation" | |
26 type: documentation | |
27 doc: | | |
28 # Link validation | |
29 | |
30 Once a document has been preprocessed, an implementation may validate | |
31 links. The link validation traversal may visit fields which the schema | |
32 designates as link fields and check that each URI references an existing | |
33 object in the current document, an imported document, file system, or | |
34 network resource. Failure to validate links may be a fatal error. Link | |
35 validation behavior for individual fields may be modified by `identity` and | |
36 `noLinkCheck` in the `jsonldPredicate` section of the field schema. | |
37 | |
38 | |
39 - name: "Schema_Validation" | |
40 type: documentation | |
41 doc: | | |
42 # Validating a document against a schema | |
43 | |
44 To validate a document against the schema, first [apply | |
45 preprocessing](#Document_preprocessing), then, use the following | |
46 algorithm. | |
47 | |
48 1. The document root must be an object or a list. If the document root is an | |
49 object containing the field `$graph` (which must be a list of | |
50 objects), then validation applies to each object in the list. | |
51 2. For each object, attempt to validate as one of the record types | |
52 flagged with `documentRoot: true`. | |
53 3. To validate a record, go through `fields` and recursively | |
54 validate each field of the object. | |
55 4. For fields with a list of types (type union), go through each | |
56 type in the list and recursively validate the type. For the | |
57 field to be valid, at least one type in the union must be valid. | |
58 5. Missing fields are considered `null`. To validate, the allowed types | |
59 for the field must include `null` | |
60 6. Primitive types are null, boolean, int, long, float, double, | |
61 string. To validate, the value in the document must have one | |
62 of these type. For numerics, the value appearing in the | |
63 document must fit into the specified type. | |
64 7. To validate an array, the value in the document must be a list, | |
65 and each item in the list must recursively validate as a type | |
66 in `items`. | |
67 8. To validate an enum, the value in the document be a string, and | |
68 the value must be equal to the short name of one of the values | |
69 listed in `symbols`. | |
70 9. As a special case, a field with the `Expression` type validates string values | |
71 which contain a CWL parameter reference or expression in the form | |
72 `$(...)` or `${...}` | |
73 | |
74 # - name: "JSON_LD_Context" | |
75 # type: documentation | |
76 # doc: | | |
77 # # Generating JSON-LD Context | |
78 | |
79 # How to generate the json-ld context... | |
80 | |
81 | |
82 - $import: metaschema_base.yml | |
83 | |
84 - name: JsonldPredicate | |
85 type: record | |
86 doc: | | |
87 Attached to a record field to define how the parent record field is handled for | |
88 URI resolution and JSON-LD context generation. | |
89 fields: | |
90 - name: _id | |
91 type: string? | |
92 jsonldPredicate: | |
93 _id: sld:_id | |
94 _type: "@id" | |
95 identity: true | |
96 doc: | | |
97 The predicate URI that this field corresponds to. | |
98 Corresponds to JSON-LD `@id` directive. | |
99 - name: _type | |
100 type: string? | |
101 doc: | | |
102 The context type hint, corresponds to JSON-LD `@type` directive. | |
103 | |
104 * If the value of this field is `@id` and `identity` is false or | |
105 unspecified, the parent field must be resolved using the link | |
106 resolution rules. If `identity` is true, the parent field must be | |
107 resolved using the identifier expansion rules. | |
108 | |
109 * If the value of this field is `@vocab`, the parent field must be | |
110 resolved using the vocabulary resolution rules. | |
111 | |
112 - name: _container | |
113 type: string? | |
114 doc: | | |
115 Structure hint, corresponds to JSON-LD `@container` directive. | |
116 - name: identity | |
117 type: boolean? | |
118 doc: | | |
119 If true and `_type` is `@id` this indicates that the parent field must | |
120 be resolved according to identity resolution rules instead of link | |
121 resolution rules. In addition, the field value is considered an | |
122 assertion that the linked value exists; absence of an object in the loaded document | |
123 with the URI is not an error. | |
124 - name: noLinkCheck | |
125 type: boolean? | |
126 doc: | | |
127 If true, this indicates that link validation traversal must stop at | |
128 this field. This field (it is is a URI) or any fields under it (if it | |
129 is an object or array) are not subject to link checking. | |
130 - name: mapSubject | |
131 type: string? | |
132 doc: | | |
133 If the value of the field is a JSON object, it must be transformed | |
134 into an array of JSON objects, where each key-value pair from the | |
135 source JSON object is a list item, the list items must be JSON objects, | |
136 and the key is assigned to the field specified by `mapSubject`. | |
137 - name: mapPredicate | |
138 type: string? | |
139 doc: | | |
140 Only applies if `mapSubject` is also provided. If the value of the | |
141 field is a JSON object, it is transformed as described in `mapSubject`, | |
142 with the addition that when the value of a map item is not an object, | |
143 the item is transformed to a JSON object with the key assigned to the | |
144 field specified by `mapSubject` and the value assigned to the field | |
145 specified by `mapPredicate`. | |
146 - name: refScope | |
147 type: int? | |
148 doc: | | |
149 If the field contains a relative reference, it must be resolved by | |
150 searching for valid document references in each successive parent scope | |
151 in the document fragment. For example, a reference of `foo` in the | |
152 context `#foo/bar/baz` will first check for the existence of | |
153 `#foo/bar/baz/foo`, followed by `#foo/bar/foo`, then `#foo/foo` and | |
154 then finally `#foo`. The first valid URI in the search order shall be | |
155 used as the fully resolved value of the identifier. The value of the | |
156 refScope field is the specified number of levels from the containing | |
157 identifer scope before starting the search, so if `refScope: 2` then | |
158 "baz" and "bar" must be stripped to get the base `#foo` and search | |
159 `#foo/foo` and the `#foo`. The last scope searched must be the top | |
160 level scope before determining if the identifier cannot be resolved. | |
161 - name: typeDSL | |
162 type: boolean? | |
163 doc: | | |
164 Field must be expanded based on the the Schema Salad type DSL. | |
165 - name: secondaryFilesDSL | |
166 type: boolean? | |
167 doc: | | |
168 Field must be expanded based on the the Schema Salad secondary file DSL. | |
169 - name: subscope | |
170 type: string? | |
171 doc: | | |
172 Append the subscope to the current scope when performing | |
173 identifier resolution to objects under this field. | |
174 | |
175 - name: SpecializeDef | |
176 type: record | |
177 fields: | |
178 - name: specializeFrom | |
179 type: string | |
180 doc: "The data type to be replaced" | |
181 jsonldPredicate: | |
182 _id: "sld:specializeFrom" | |
183 _type: "@id" | |
184 refScope: 1 | |
185 | |
186 - name: specializeTo | |
187 type: string | |
188 doc: "The new data type to replace with" | |
189 jsonldPredicate: | |
190 _id: "sld:specializeTo" | |
191 _type: "@id" | |
192 refScope: 1 | |
193 | |
194 | |
195 - name: NamedType | |
196 type: record | |
197 abstract: true | |
198 docParent: "#Schema" | |
199 fields: | |
200 - name: name | |
201 type: string | |
202 jsonldPredicate: "@id" | |
203 doc: "The identifier for this type" | |
204 - name: inVocab | |
205 type: boolean? | |
206 default: true | |
207 doc: | | |
208 If "true" (the default), include the short name of this type | |
209 in the vocabulary. The vocabulary are all the symbols (field | |
210 names and other identifiers, such as classes and enum values) | |
211 which can be used in the document without a namespace prefix. | |
212 These are the keys of the JSON-LD context. If false, do not | |
213 include the short name in the vocabulary. | |
214 | |
215 This is useful for specifying schema extensions that will be | |
216 included in validation without introducing ambiguity by | |
217 introducing non-standard terms into the vocabulary. | |
218 | |
219 | |
220 - name: DocType | |
221 type: record | |
222 extends: Documented | |
223 abstract: true | |
224 docParent: "#Schema" | |
225 fields: | |
226 - name: docParent | |
227 type: string? | |
228 doc: | | |
229 Hint to indicate that during documentation generation, documentation | |
230 for this type should appear in a subsection under `docParent`. | |
231 jsonldPredicate: | |
232 _id: "sld:docParent" | |
233 _type: "@id" | |
234 | |
235 - name: docChild | |
236 type: | |
237 - string? | |
238 - string[]? | |
239 doc: | | |
240 Hint to indicate that during documentation generation, documentation | |
241 for `docChild` should appear in a subsection under this type. | |
242 jsonldPredicate: | |
243 _id: "sld:docChild" | |
244 _type: "@id" | |
245 | |
246 - name: docAfter | |
247 type: string? | |
248 doc: | | |
249 Hint to indicate that during documentation generation, documentation | |
250 for this type should appear after the `docAfter` section at the same | |
251 level. | |
252 jsonldPredicate: | |
253 _id: "sld:docAfter" | |
254 _type: "@id" | |
255 | |
256 | |
257 - name: SchemaDefinedType | |
258 type: record | |
259 extends: DocType | |
260 doc: | | |
261 Abstract base for schema-defined types. | |
262 abstract: true | |
263 fields: | |
264 - name: jsonldPredicate | |
265 type: | |
266 - string? | |
267 - JsonldPredicate? | |
268 doc: | | |
269 Annotate this type with linked data context. | |
270 jsonldPredicate: sld:jsonldPredicate | |
271 | |
272 - name: documentRoot | |
273 type: boolean? | |
274 doc: | | |
275 If true, indicates that the type is a valid at the document root. At | |
276 least one type in a schema must be tagged with `documentRoot: true`. | |
277 | |
278 | |
279 - name: SaladRecordField | |
280 type: record | |
281 extends: RecordField | |
282 doc: "A field of a record." | |
283 fields: | |
284 - name: jsonldPredicate | |
285 type: | |
286 - string? | |
287 - JsonldPredicate? | |
288 doc: | | |
289 Annotate this type with linked data context. | |
290 jsonldPredicate: "sld:jsonldPredicate" | |
291 - name: default | |
292 type: Any? | |
293 jsonldPredicate: | |
294 _id: sld:default | |
295 noLinkCheck: true | |
296 doc: | | |
297 The default value to use for this field if the field is missing or "null". | |
298 | |
299 | |
300 - name: SaladRecordSchema | |
301 docParent: "#Schema" | |
302 type: record | |
303 extends: [NamedType, RecordSchema, SchemaDefinedType] | |
304 documentRoot: true | |
305 specialize: | |
306 RecordField: SaladRecordField | |
307 fields: | |
308 - name: abstract | |
309 type: boolean? | |
310 doc: | | |
311 If true, this record is abstract and may be used as a base for other | |
312 records, but is not valid on its own. | |
313 | |
314 - name: extends | |
315 type: | |
316 - string? | |
317 - string[]? | |
318 jsonldPredicate: | |
319 _id: "sld:extends" | |
320 _type: "@id" | |
321 refScope: 1 | |
322 doc: | | |
323 Indicates that this record inherits fields from one or more base records. | |
324 | |
325 - name: specialize | |
326 type: | |
327 - SpecializeDef[]? | |
328 doc: | | |
329 Only applies if `extends` is declared. Apply type specialization using the | |
330 base record as a template. For each field inherited from the base | |
331 record, replace any instance of the type `specializeFrom` with | |
332 `specializeTo`. | |
333 jsonldPredicate: | |
334 _id: "sld:specialize" | |
335 mapSubject: specializeFrom | |
336 mapPredicate: specializeTo | |
337 | |
338 - name: SaladEnumSchema | |
339 docParent: "#Schema" | |
340 type: record | |
341 extends: [NamedType, EnumSchema, SchemaDefinedType] | |
342 documentRoot: true | |
343 doc: | | |
344 Define an enumerated type. | |
345 fields: | |
346 - name: extends | |
347 type: | |
348 - string? | |
349 - string[]? | |
350 jsonldPredicate: | |
351 _id: "sld:extends" | |
352 _type: "@id" | |
353 refScope: 1 | |
354 doc: | | |
355 Indicates that this enum inherits symbols from a base enum. | |
356 | |
357 | |
358 - name: Documentation | |
359 type: record | |
360 docParent: "#Schema" | |
361 extends: [NamedType, DocType] | |
362 documentRoot: true | |
363 doc: | | |
364 A documentation section. This type exists to facilitate self-documenting | |
365 schemas but has no role in formal validation. | |
366 fields: | |
367 - name: type | |
368 doc: "Must be `documentation`" | |
369 type: | |
370 type: enum | |
371 symbols: | |
372 - "sld:documentation" | |
373 jsonldPredicate: | |
374 _id: "sld:type" | |
375 _type: "@vocab" | |
376 typeDSL: true | |
377 refScope: 2 |