Changes for page Technical details
Last modified by lzehl on 2021/07/05 18:57
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -21,47 +21,76 @@ 21 21 All openMINDS metadata models use a light-weighted schema template syntax for defining the metadata. The correspondingly formatted schema files use the extension: **##.schema.tpl.json##**. 22 22 23 23 (% style="text-align: justify;" %) 24 -Although, as the file extension suggests, this openMINDS schema template syntax is inspired by JSON-Schema, it facilitates or even excludes technical aspects that are generally expected for the openMINDS schemas making it more human-readable, especially for untrained eyes. Behind the scenes, within the openMINDS integration pipeline (cf. below), this schema template syntax is then interpreted and flexibly translated to various formal metadata formats (e.g., JSON-Schema).24 +Although, as the file extension suggests, this openMINDS schema template syntax is inspired by JSON-Schema, it facilitates or even excludes technical aspects that are generally expected for the openMINDS schemas making them more human-readable, especially for untrained eyes. Behind the scenes, within the openMINDS integration pipeline (cf. below), this schema template syntax is then interpreted and flexibly translated to various formal metadata formats (e.g., JSON-Schema). 25 25 26 26 (% style="text-align: justify;" %) 27 27 Despite the simplification in comparison to JSON-Schema, the openMINDS schema templates are also, at the core, specially formatted JSON files using a particular syntax, meaning special key-value pairs that define the validation rules of a schema. 28 28 29 29 (% style="text-align: justify;" %) 30 -Please find in the following a full documentation of the openMINDS schema template syntax and how t hekey-value pairs need to be defined and interpreted.30 +Please find in the following a full documentation of the openMINDS schema template syntax and how it's key-value pairs need to be defined and interpreted. 31 31 32 32 (% style="text-align: justify;" %) 33 33 ===== Target & context templates ===== 34 34 35 35 (% style="text-align: justify;" %) 36 - An openMINDS schema//HAS TO HAVE// a **##"_type"##**tobe recognizedas**targettemplate**.Inotherwords,the **##"_type"##**isusedtodefine thepenMINDSnamespaceof acorrespondingschemausingthefollowingnamingconvention:36 +Same as in JSON-Schema, all openMINDS schema templates define the name (written in lowerCamelCase) and value of the metadata (typically called property) they expect under the key **##properties##** as nested dictionaries. Furthermore, the names of obligatory metadata/properties can be listed under the key **##required##**. Here a generalized example: 37 37 38 38 {{code language="json"}} 39 39 { 40 - "_type": "https:~/~/openminds.ebrains.eu/<<schema-model>>/<<schema-name>>" 40 + "properties": { 41 + "propertyNameA": {}, 42 + "propertyNameB": {}, 43 + "propertyNameC": {} 44 + }, 45 + "required": [ 46 + "propertyNameA", 47 + "propertyNameC" 48 + ] 41 41 } 42 42 {{/code}} 43 43 44 44 (% style="text-align: justify;" %) 45 - where**##<<schema-model>>##**hasto be replacedwith thelabelof the openMINDS metadatamodelthecorresponding schemabelongstoand**##<<schema-name>>##**exchanged withthenameof thatschema(writtenin **##CamelCase##**).53 +In addition, an openMINDS schema //has to have// a key **##"_type"##** to be recognized as **target template**. In other words, the **##"_type"##** is used to define the openMINDS namespace of a corresponding schema using a particular naming convention. Here again a generalized example: 46 46 55 +{{code language="json"}} 56 +{ 57 + "_type": "https:~/~/openminds.ebrains.eu/<<schema-model>>/<<schema-name>>", 58 + "properties": {}, 59 + "required": [] 60 +} 61 +{{/code}} 62 + 47 47 (% style="text-align: justify;" %) 48 - If anopenMINDSschema templatefile//DOESNOT//definea**##"_type"##**,it isinterpreted as a **contexttemplate**which//HAS TO BE// extendedtoatargetplate.64 +Note that **##<<schema-model>>##** has to be replaced with the label of the openMINDS metadata model to which the corresponding schema belongs to, and **##<<schema-name>>##** has to be replaced with the corresponding name of the schema (written in **##CamelCase##**). 49 49 50 50 (% style="text-align: justify;" %) 51 - Contexttemplates are andshould be used when multipleopenMINDS schemas(target templates)havethesamesubsetof properties.Thiscommon subsetofpropertiescan thenbe defined withinasinglecontext schemainsteadofeachtarget template whichfacilitates the long-termmaintenance oftheseproperties.67 +If an openMINDS schema template //does not// define a key **##"_type"##** (as in the first example above), it is interpreted as a **context template** which //has to be// extended to a target template. 52 52 53 53 (% style="text-align: justify;" %) 54 - Todefinethat a target templateistheextensionofa contexttemplate,the target templatecanstate under **##"_extends"##**therelativepathtothecontext template.Forexample,theopenMINDScore schema**##Dataset##**(target template)extends thecore concepttemplate**##researchProduct##**:70 +Context templates are and should be used when multiple openMINDS schemas (target templates) have the same subset of properties. Such a common subset of properties can then be defined within a single context schema instead of each target template which facilitates the long-term maintenance of these properties. 55 55 72 +(% style="text-align: justify;" %) 73 +To define that a target template is the extension of a context template, the target template can state under **##"_extends"##** the relative path to the context template. For example, the openMINDS core target template **##Dataset##** extends the core concept template **##researchProduct##** as indicated here: 74 + 56 56 {{code language="json"}} 57 57 { 58 - "_type": "https:~/~/openminds.ebrains.eu/core/Dataset" 59 - "_extends": "products/researchProduct.schema.tpl.json" 77 + "_type": "https:~/~/openminds.ebrains.eu/core/Dataset", 78 + "_extends": "products/researchProduct.schema.tpl.json", 79 + "properties": [] 60 60 } 61 61 {{/code}} 62 62 63 63 Note that this convention requires the context and corresponding target templates to be located in the same openMINDS metadata model repository. 64 64 85 +Note also that for properties, the following rules apply for target and concept template: 86 + 87 +1. A concept template has to define some properties which will be inherited by all extending target templates. 88 +1. If a concept template additionally defines that some of these properties are required, all extending target templates will require the same properties. 89 +1. A target template can require properties of the concept template, that are not explicitly required within the concept template. In such a case, the other target templates extending the same concept template will not require those properties. 90 +1. A target template can (but does not have to) define and require additional properties that were not defined and required in the concept template. These additionally defined and required properties will not be shared with the other target templates extending the same concept template. 91 + 92 +How to define the expected value of a property will be explained for the different property types in the following sections. 93 + 65 65 (% style="text-align: justify;" %) 66 66 ===== String properties ===== 67 67