@@ -91,6 +91,185 @@ An implementation may formally validate the structure of a CWL document using
9191SALAD schemas located at
9292https://github.com/common-workflow-language/common-workflow-language/tree/master/v1.1.0-dev1
9393
94+ ### map
95+
96+ Note: This section is non-normative.
97+ > type: array< ; ComplexType> ; |
98+ > map< ; ` key_field ` , ComplexType> ;
99+
100+ The above syntax in the CWL specifications means there are two or more ways to write the given value.
101+
102+ Option one is a array and is the most verbose option.
103+
104+ Option one generic example:
105+ ```
106+ some_cwl_field:
107+ - key_field: a_complex_type1
108+ field2: foo
109+ field3: bar
110+ - key_field: a_complex_type2
111+ field2: foo2
112+ field3: bar2
113+ - key_field: a_complex_type3
114+ ```
115+
116+ Option one specific example using [ Workflow] ( Workflow.html#Workflow ) .[ inputs] ( Workflow.html#WorkflowInputParameter ) :
117+ > array< ; InputParameter> ; |
118+ > map< ; ` id ` , ` type ` | InputParameter> ;
119+
120+
121+ ```
122+ inputs:
123+ - id: workflow_input01
124+ type: string
125+ - id: workflow_input02
126+ type: File
127+ format: http://edamontology.org/format_2572
128+ ```
129+
130+ Option two is enabled by the ` map<…> ` syntax. Instead of an array of entries we
131+ use a mapping, where one field of the ` ComplexType ` (here named ` key_field ` )
132+ becomes the key in the map, and its value is the rest of the ` ComplexType `
133+ without the key field. If all of the other fields of the ` ComplexType ` are
134+ optional and unneeded, then we can indicate this with an empty mapping as the
135+ value: ` a_complex_type3: {} `
136+
137+ Option two generic example:
138+ ```
139+ some_cwl_field:
140+ a_complex_type1: # this was the "key_field" from above
141+ field2: foo
142+ field3: bar
143+ a_complex_type2:
144+ field2: foo2
145+ field3: bar2
146+ a_complex_type3: {} # we accept the defualt values for "field2" and "field3"
147+ ```
148+
149+ Option two specific example using [ Workflow] ( Workflow.html#Workflow ) .[ inputs] ( Workflow.html#WorkflowInputParameter ) :
150+ > array< ; InputParameter> ; |
151+ > map< ; ` id ` , ` type ` | InputParameter> ;
152+
153+
154+ ```
155+ inputs:
156+ workflow_input01:
157+ type: string
158+ workflow_input02:
159+ type: File
160+ format: http://edamontology.org/format_2572
161+ ```
162+
163+ Option two specific example using [ SoftwareRequirement] ( #SoftwareRequirement ) .[ packages] ( #SoftwarePackage ) :
164+ > array< ; SoftwarePackage> ; |
165+ > map< ; ` package ` , ` specs ` | SoftwarePackage> ;
166+
167+
168+ ```
169+ hints:
170+ SoftwareRequirement:
171+ packages:
172+ sourmash:
173+ specs: [ https://doi.org/10.21105/joss.00027 ]
174+ screed:
175+ version: [ "1.0" ]
176+ python: {}
177+ ```
178+ `
179+ Sometimes we have a third and even more compact option denoted like this:
180+ > type: array< ; ComplexType> ; |
181+ > map< ; ` key_field ` , ` field2 ` | ComplexType> ;
182+
183+ For this example, if we only need the ` key_field ` and ` field2 ` when specifying
184+ our ` ComplexType ` s (because the other fields are optional and we are fine with
185+ their default values) then we can abbreviate.
186+
187+ Option three generic example:
188+ ```
189+ some_cwl_field:
190+ a_complex_type1: foo # we accept the default value for field3
191+ a_complex_type2: foo2 # we accept the default value for field3
192+ a_complex_type3: {} # we accept the default values for "field2" and "field3"
193+ ```
194+
195+ Option three specific example using [ Workflow] ( Workflow.html#Workflow ) .[ inputs] ( Workflow.html#WorkflowInputParameter ) :
196+ > array< ; InputParameter> ; |
197+ > map< ; ` id ` , ` type ` | InputParameter> ;
198+
199+
200+ ```
201+ inputs:
202+ workflow_input01: string
203+ workflow_input02: File # we accept the default of no File format
204+ ```
205+
206+ Option three specific example using [ SoftwareRequirement] ( #SoftwareRequirement ) .[ packages] ( #SoftwarePackage ) :
207+ > array< ; SoftwarePackage> ; |
208+ > map< ; ` package ` , ` specs ` | SoftwarePackage> ;
209+
210+
211+ ```
212+ hints:
213+ SoftwareRequirement:
214+ packages:
215+ sourmash: [ https://doi.org/10.21105/joss.00027 ]
216+ python: {}
217+ ```
218+
219+
220+ What if some entries we want to mix the option 2 and 3? You can!
221+
222+ Mixed option 2 and 3 generic example:
223+ ```
224+ some_cwl_field:
225+ my_complex_type1: foo # we accept the default value for field3
226+ my_complex_type2:
227+ field2: foo2
228+ field3: bar2 # we did not accept the default value for field3
229+ # so we had to use the slightly expanded syntax
230+ my_complex_type3: {} # as before, we accept the default values for both
231+ # "field2" and "field3"
232+ ```
233+
234+ Mixed option 2 and 3 specific example using [ Workflow] ( Workflow.html#Workflow ) .[ inputs] ( Workflow.html#WorkflowInputParameter ) :
235+ > array< ; InputParameter> ; |
236+ > map< ; ` id ` , ` type ` | InputParameter> ;
237+
238+
239+ ```
240+ inputs:
241+ workflow_input01: string
242+ workflow_input02: # we use the longer way
243+ type: File # because we want to specify the "format" too
244+ format: http://edamontology.org/format_2572
245+ workflow_input03: {} # back to the short form as this entry
246+ # uses the default of no "type" just like the prior
247+ # examples
248+ ```
249+
250+ Mixed option 2 and 3 specific example using [ SoftwareRequirement] ( #SoftwareRequirement ) .[ packages] ( #SoftwarePackage ) :
251+ > array< ; SoftwarePackage> ; |
252+ > map< ; ` package ` , ` specs ` | SoftwarePackage> ;
253+
254+
255+ ```
256+ hints:
257+ SoftwareRequirement:
258+ packages:
259+ sourmash: [ https://doi.org/10.21105/joss.00027 ]
260+ screed:
261+ specs: [ https://github.com/dib-lab/screed ]
262+ version: [ "1.0" ]
263+ python: {}
264+ ```
265+
266+ Note: The ` map<…> ` (compact) versions are optional, the verbose option #1 is
267+ always allowed, but for presentation reasons option 3 and 2 may be preferred
268+ by human readers.
269+
270+ The normative explanation for these variations, aimed at implementors, is in the
271+ [ Schema Salad specification] ( SchemaSalad.html#Identifier_maps ) .
272+
94273## Identifiers
95274
96275If an object contains an ` id ` field, that is used to uniquely identify the
@@ -187,15 +366,19 @@ of [process requirements](#Requirements_and_hints).
187366The generic execution sequence of a CWL process (including workflows and
188367command line line tools) is as follows.
189368
190- 1 . Load, process and validate a CWL document, yielding a process object.
191- 2 . Load input object.
192- 3 . Validate the input object against the ` inputs ` schema for the process.
193- 4 . Validate process requirements are met.
194- 5 . Perform any further setup required by the specific process type.
195- 6 . Execute the process.
196- 7 . Capture results of process execution into the output object.
197- 8 . Validate the output object against the ` outputs ` schema for the process.
198- 9 . Report the output object to the process caller.
369+ 1 . Load input object.
370+ 1 . Load, process and validate a CWL document, yielding one or more process objects.
371+ 1 . If there are multiple process objects (due to [ ` $graph ` ] ( SchemaSalad.html#Document_graph ) )
372+ and which process object to start with is not specified in the input object (via
373+ a [ ` cwl:tool ` ] ( #Executing_CWL_documents_as_scripts ) entry) or by any other means
374+ (like a URL fragment) then choose the process with the ` id ` of "#main" or "main".
375+ 1 . Validate the input object against the ` inputs ` schema for the process.
376+ 1 . Validate process requirements are met.
377+ 1 . Perform any further setup required by the specific process type.
378+ 1 . Execute the process.
379+ 1 . Capture results of process execution into the output object.
380+ 1 . Validate the output object against the ` outputs ` schema for the process.
381+ 1 . Report the output object to the process caller.
199382
200383## Requirements and hints
201384
0 commit comments