@nfdi4plants/arctrl 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/ARC.js +103 -12
  2. package/CWL/CWLTypes.js +2 -2
  3. package/CWL/Decode.js +2 -2
  4. package/CWL/Inputs.js +2 -2
  5. package/CWL/Outputs.js +2 -2
  6. package/CWL/Requirements.js +2 -2
  7. package/CWL/ToolDescription.js +1 -1
  8. package/CWL/WorkflowDescription.js +1 -1
  9. package/CWL/WorkflowSteps.js +1 -1
  10. package/ColumnIndex.js +258 -0
  11. package/Conversion.js +1679 -0
  12. package/Core/Data.js +28 -3
  13. package/Core/DataFile.js +19 -3
  14. package/Core/Helper/Collections.js +107 -4
  15. package/Core/Helper/DateTime.js +17 -0
  16. package/Core/Helper/ORCID.js +39 -0
  17. package/Json/Decode.js +3 -3
  18. package/Json/Encode.js +9 -0
  19. package/Json/OntologySourceReference.js +4 -4
  20. package/Json/ROCrate/LDContext.js +121 -0
  21. package/Json/ROCrate/LDGraph.js +87 -0
  22. package/Json/{LDObject.js → ROCrate/LDNode.js} +55 -46
  23. package/Json/ROCrate/LDRef.js +25 -0
  24. package/Json/ROCrate/LDValue.js +66 -0
  25. package/JsonIO/LDObject.js +30 -5
  26. package/ROCrate/ArcROCrateMetadata.js +14 -13
  27. package/ROCrate/Generic/Comment.js +115 -0
  28. package/ROCrate/Generic/Dataset.js +669 -0
  29. package/ROCrate/Generic/DefinedTerm.js +115 -0
  30. package/ROCrate/Generic/File.js +200 -0
  31. package/ROCrate/Generic/LabProcess.js +238 -0
  32. package/ROCrate/Generic/LabProtocol.js +275 -0
  33. package/ROCrate/Generic/Organization.js +71 -0
  34. package/ROCrate/Generic/Person.js +411 -0
  35. package/ROCrate/Generic/PostalAddress.js +159 -0
  36. package/ROCrate/Generic/PropertyValue.js +548 -0
  37. package/ROCrate/Generic/Sample.js +139 -0
  38. package/ROCrate/Generic/ScholarlyArticle.js +187 -0
  39. package/ROCrate/Helper.js +6 -0
  40. package/ROCrate/ISAProfile/Assay.js +3 -3
  41. package/ROCrate/ISAProfile/Data.js +7 -7
  42. package/ROCrate/ISAProfile/Dataset.js +7 -6
  43. package/ROCrate/ISAProfile/Investigation.js +3 -3
  44. package/ROCrate/ISAProfile/LabProcess.js +7 -7
  45. package/ROCrate/ISAProfile/LabProtocol.js +7 -7
  46. package/ROCrate/ISAProfile/Person.js +7 -7
  47. package/ROCrate/ISAProfile/PropertyValue.js +7 -7
  48. package/ROCrate/ISAProfile/Sample.js +7 -7
  49. package/ROCrate/ISAProfile/ScholarlyArticle.js +7 -7
  50. package/ROCrate/ISAProfile/Study.js +3 -3
  51. package/ROCrate/LDContext.js +283 -0
  52. package/ROCrate/LDObject.js +902 -36
  53. package/ROCrate/ROCrateContext.js +44 -0
  54. package/ROCrateIO.js +62 -0
  55. package/Spreadsheet/DataMapTable/DataMapHeader.js +3 -2
  56. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynObj.fs +31 -1
  57. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynObj.fs.js +30 -1
  58. package/fable_modules/DynamicObj.7.0.1/DynamicObj.fs +1025 -0
  59. package/fable_modules/DynamicObj.7.0.1/DynamicObj.fs.js +433 -0
  60. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FableJS.fs +16 -0
  61. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FablePy.fs +14 -0
  62. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/HashCodes.fs +15 -0
  63. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/HashCodes.fs.js +4 -0
  64. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Debug/netstandard2.0/DynamicObj.AssemblyInfo.fs +1 -1
  65. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Release/netstandard2.0/DynamicObj.AssemblyInfo.fs +3 -3
  66. package/fable_modules/project_cracked.json +1 -1
  67. package/package.json +1 -1
  68. package/Json/ARC.js +0 -31
  69. package/JsonIO/ARC.js +0 -31
  70. package/fable_modules/DynamicObj.4.0.3/DynamicObj.fs +0 -310
  71. package/fable_modules/DynamicObj.4.0.3/DynamicObj.fs.js +0 -166
  72. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynamicObj.fableproj +0 -0
  73. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FableJS.fs.js +0 -0
  74. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/PropertyHelper.fs +0 -0
  75. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/PropertyHelper.fs.js +0 -0
  76. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/ReflectionUtils.fs +0 -0
  77. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/ReflectionUtils.fs.js +0 -0
  78. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
  79. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
package/Conversion.js ADDED
@@ -0,0 +1,1679 @@
1
+ import { fromString } from "./fable_modules/Thoth.Json.JavaScript.0.3.0/Decode.fs.js";
2
+ import { Decode_datetime } from "./Json/Decode.js";
3
+ import { join, remove, toFail, printf, toText } from "./fable_modules/fable-library-js.4.24.0/String.js";
4
+ import { toString } from "./fable_modules/Thoth.Json.JavaScript.0.3.0/Encode.fs.js";
5
+ import { dateTime } from "./Json/Encode.js";
6
+ import { parse, tryParse } from "./fable_modules/fable-library-js.4.24.0/Int32.js";
7
+ import { toString as toString_1, FSharpRef } from "./fable_modules/fable-library-js.4.24.0/Types.js";
8
+ import { bind, defaultArg, map, unwrap, value as value_4 } from "./fable_modules/fable-library-js.4.24.0/Option.js";
9
+ import { safeHash, equals, disposeSafe, getEnumerator, stringHash, comparePrimitives, int32ToString } from "./fable_modules/fable-library-js.4.24.0/Util.js";
10
+ import { class_type } from "./fable_modules/fable-library-js.4.24.0/Reflection.js";
11
+ import { LDComment } from "./ROCrate/Generic/Comment.js";
12
+ import { Comment$ } from "./Core/Comment.js";
13
+ import { OntologyAnnotation } from "./Core/OntologyAnnotation.js";
14
+ import { ResizeArray_groupBy, ResizeArray_tryFind, ResizeArray_filter, ResizeArray_collect, ResizeArray_choose, ResizeArray_append, ResizeArray_distinct, ResizeArray_tryPick, ResizeArray_appendSingleton, ResizeArray_zip, ResizeArray_create, ResizeArray_singleton, ResizeArray_map, Option_fromSeq, Option_fromValueWithDefault } from "./Core/Helper/Collections.js";
15
+ import { LDDefinedTerm } from "./ROCrate/Generic/DefinedTerm.js";
16
+ import { LDPropertyValue } from "./ROCrate/Generic/PropertyValue.js";
17
+ import { DataFile_fromString_Z721C83C5, DataFile__get_AsString } from "./Core/DataFile.js";
18
+ import { LDFile } from "./ROCrate/Generic/File.js";
19
+ import { DataAux_pathAndSelectorFromName, Data } from "./Core/Data.js";
20
+ import { DataContext_$ctor_Z780A8A2A, DataContext__get_Label, DataContext__get_Description, DataContext__get_GeneratedBy, DataContext__get_ObjectType, DataContext__get_Unit, DataContext__get_Explication } from "./Core/DataContext.js";
21
+ import { LDNode, LDRef } from "./ROCrate/LDObject.js";
22
+ import { LDSample } from "./ROCrate/Generic/Sample.js";
23
+ import { CompositeCell } from "./Core/Table/CompositeCell.js";
24
+ import { IOType, CompositeHeader } from "./Core/Table/CompositeHeader.js";
25
+ import { ActivePatterns_$007CRegex$007C_$007C } from "./Core/Helper/Regex.js";
26
+ import { LDLabProtocol } from "./ROCrate/Generic/LabProtocol.js";
27
+ import { getItemFromDict } from "./fable_modules/fable-library-js.4.24.0/MapUtil.js";
28
+ import { LDPerson } from "./ROCrate/Generic/Person.js";
29
+ import { isEmpty, zip, fold, singleton, empty as empty_1, append, delay, max, map as map_1, choose as choose_1, tryPick, filter, toList, indexed } from "./fable_modules/fable-library-js.4.24.0/Seq.js";
30
+ import { ofSeq, collect, initialize, singleton as singleton_2, sortBy, map as map_2, empty, length, choose } from "./fable_modules/fable-library-js.4.24.0/List.js";
31
+ import { LDLabProcess } from "./ROCrate/Generic/LabProcess.js";
32
+ import { List_distinct, List_groupBy } from "./fable_modules/fable-library-js.4.24.0/Seq2.js";
33
+ import { createMissingIdentifier } from "./Core/Helper/Identifier.js";
34
+ import { ArcTable } from "./Core/Table/ArcTable.js";
35
+ import { singleton as singleton_1 } from "./fable_modules/fable-library-js.4.24.0/Array.js";
36
+ import { rangeDouble } from "./fable_modules/fable-library-js.4.24.0/Range.js";
37
+ import { Unchecked_alignByHeaders } from "./Core/Table/ArcTableAux.js";
38
+ import { ArcTables } from "./Core/Table/ArcTables.js";
39
+ import { DataMap_init, DataMap_$ctor_4E3220A7, DataMap__get_DataContexts } from "./Core/DataMap.js";
40
+ import { LDOrganization } from "./ROCrate/Generic/Organization.js";
41
+ import { encoder, decoder as decoder_1 } from "./Json/ROCrate/LDNode.js";
42
+ import { tryGetOrcidNumber } from "./Core/Helper/ORCID.js";
43
+ import { Person } from "./Core/Person.js";
44
+ import { StringBuilder__Clear, StringBuilder__Append_244C7CD6, StringBuilder_$ctor } from "./fable_modules/fable-library-js.4.24.0/System.Text.js";
45
+ import { LDScholarlyArticle } from "./ROCrate/Generic/ScholarlyArticle.js";
46
+ import { Publication } from "./Core/Publication.js";
47
+ import { LDDataset } from "./ROCrate/Generic/Dataset.js";
48
+ import { ArcInvestigation, ArcStudy, ArcAssay } from "./Core/ArcTypes.js";
49
+ import { now } from "./fable_modules/fable-library-js.4.24.0/Date.js";
50
+
51
+ export function DateTime_tryFromString(s) {
52
+ let matchValue;
53
+ try {
54
+ return (matchValue = fromString(Decode_datetime, s), (matchValue.tag === 1) ? (() => {
55
+ throw new Error(toText(printf("Error decoding string: %O"))(matchValue.fields[0]));
56
+ })() : matchValue.fields[0]);
57
+ }
58
+ catch (matchValue_1) {
59
+ return undefined;
60
+ }
61
+ }
62
+
63
+ export function DateTime_toString(d) {
64
+ return toString(0, dateTime(d));
65
+ }
66
+
67
+ function ColumnIndex_tryInt(str) {
68
+ let matchValue;
69
+ let outArg = 0;
70
+ matchValue = [tryParse(str, 511, false, 32, new FSharpRef(() => outArg, (v) => {
71
+ outArg = (v | 0);
72
+ })), outArg];
73
+ if (matchValue[0]) {
74
+ return matchValue[1];
75
+ }
76
+ else {
77
+ return undefined;
78
+ }
79
+ }
80
+
81
+ export const ColumnIndex_orderName = "columnIndex";
82
+
83
+ export function ColumnIndex_tryGetIndex(node) {
84
+ const matchValue = node.TryGetPropertyAsSingleton(ColumnIndex_orderName);
85
+ let matchResult, ci;
86
+ if (matchValue != null) {
87
+ if (typeof value_4(matchValue) === "string") {
88
+ matchResult = 0;
89
+ ci = value_4(matchValue);
90
+ }
91
+ else {
92
+ matchResult = 1;
93
+ }
94
+ }
95
+ else {
96
+ matchResult = 1;
97
+ }
98
+ switch (matchResult) {
99
+ case 0:
100
+ return ColumnIndex_tryInt(ci);
101
+ default:
102
+ return undefined;
103
+ }
104
+ }
105
+
106
+ export function ColumnIndex_setIndex(node, index) {
107
+ node.SetProperty(ColumnIndex_orderName, int32ToString(index));
108
+ }
109
+
110
+ export function ARCtrl_ROCrate_LDNode__LDNode_GetColumnIndex(this$) {
111
+ return value_4(ColumnIndex_tryGetIndex(this$));
112
+ }
113
+
114
+ export function ARCtrl_ROCrate_LDNode__LDNode_TryGetColumnIndex(this$) {
115
+ return ColumnIndex_tryGetIndex(this$);
116
+ }
117
+
118
+ export function ARCtrl_ROCrate_LDNode__LDNode_SetColumnIndex_Z524259A4(this$, index) {
119
+ ColumnIndex_setIndex(this$, index);
120
+ }
121
+
122
+ export class BaseTypes {
123
+ constructor() {
124
+ }
125
+ }
126
+
127
+ export function BaseTypes_$reflection() {
128
+ return class_type("ARCtrl.Conversion.BaseTypes", undefined, BaseTypes);
129
+ }
130
+
131
+ export function BaseTypes_composeComment_Z13201A7E(comment) {
132
+ let name;
133
+ const matchValue = comment.Name;
134
+ if (matchValue == null) {
135
+ throw new Error("Comment must have a name");
136
+ }
137
+ else {
138
+ name = matchValue;
139
+ }
140
+ return LDComment.create(name, undefined, unwrap(comment.Value));
141
+ }
142
+
143
+ export function BaseTypes_decomposeComment_Z2F770004(comment, context) {
144
+ return new Comment$(LDComment.getNameAsString(comment, unwrap(context)), unwrap(LDComment.tryGetTextAsString(comment, unwrap(context))));
145
+ }
146
+
147
+ export function BaseTypes_ontologyTermFromNameAndID_40457300(name, id) {
148
+ if (id == null) {
149
+ return OntologyAnnotation.create(unwrap(name));
150
+ }
151
+ else {
152
+ const t = id;
153
+ return OntologyAnnotation.fromTermAnnotation(t, unwrap(name));
154
+ }
155
+ }
156
+
157
+ export function BaseTypes_tryOntologyTermFromNameAndID_40457300(name, id) {
158
+ if ((name == null) && (id == null)) {
159
+ return undefined;
160
+ }
161
+ else {
162
+ return BaseTypes_ontologyTermFromNameAndID_40457300(unwrap(name), unwrap(id));
163
+ }
164
+ }
165
+
166
+ export function BaseTypes_composeDefinedTerm_ZDED3A0F(term) {
167
+ const tan = Option_fromValueWithDefault("", term.TermAccessionAndOntobeeUrlIfShort);
168
+ return LDDefinedTerm.create(term.NameText, undefined, unwrap(tan));
169
+ }
170
+
171
+ export function BaseTypes_decomposeDefinedTerm_Z2F770004(term, context) {
172
+ return BaseTypes_ontologyTermFromNameAndID_40457300(LDDefinedTerm.getNameAsString(term, unwrap(context)), unwrap(LDDefinedTerm.tryGetTermCodeAsString(term, unwrap(context))));
173
+ }
174
+
175
+ export function BaseTypes_composePropertyValueFromOA_ZDED3A0F(term) {
176
+ const tan = Option_fromValueWithDefault("", term.TermAccessionAndOntobeeUrlIfShort);
177
+ return LDPropertyValue.create(term.NameText, undefined, undefined, unwrap(tan));
178
+ }
179
+
180
+ export function BaseTypes_decomposePropertyValueToOA_Z2F770004(term, context) {
181
+ return BaseTypes_ontologyTermFromNameAndID_40457300(LDPropertyValue.getNameAsString(term, unwrap(context)), unwrap(LDPropertyValue.tryGetPropertyIDAsString(term, unwrap(context))));
182
+ }
183
+
184
+ /**
185
+ * Convert a CompositeCell to a ISA Value and Unit tuple.
186
+ */
187
+ export function BaseTypes_valuesOfCell_Z436420FE(value) {
188
+ switch (value.tag) {
189
+ case 0:
190
+ if (value.fields[0].isEmpty()) {
191
+ return [undefined, undefined, undefined, undefined];
192
+ }
193
+ else if (value.fields[0].TANInfo != null) {
194
+ return [value.fields[0].Name, value.fields[0].TermAccessionAndOntobeeUrlIfShort, undefined, undefined];
195
+ }
196
+ else {
197
+ return [value.fields[0].Name, undefined, undefined, undefined];
198
+ }
199
+ case 2: {
200
+ const patternInput = value.fields[1].isEmpty() ? [undefined, undefined] : [value.fields[1].Name, Option_fromValueWithDefault("", value.fields[1].TermAccessionAndOntobeeUrlIfShort)];
201
+ return [Option_fromValueWithDefault("", value.fields[0]), undefined, patternInput[0], patternInput[1]];
202
+ }
203
+ case 3:
204
+ throw new Error("Data cell should not be parsed to isa value");
205
+ default:
206
+ if (value.fields[0] === "") {
207
+ return [undefined, undefined, undefined, undefined];
208
+ }
209
+ else {
210
+ return [value.fields[0], undefined, undefined, undefined];
211
+ }
212
+ }
213
+ }
214
+
215
+ export function BaseTypes_termOfHeader_6CAF647B(header) {
216
+ let matchResult, oa;
217
+ switch (header.tag) {
218
+ case 0: {
219
+ matchResult = 0;
220
+ oa = header.fields[0];
221
+ break;
222
+ }
223
+ case 3: {
224
+ matchResult = 0;
225
+ oa = header.fields[0];
226
+ break;
227
+ }
228
+ case 2: {
229
+ matchResult = 0;
230
+ oa = header.fields[0];
231
+ break;
232
+ }
233
+ case 1: {
234
+ matchResult = 0;
235
+ oa = header.fields[0];
236
+ break;
237
+ }
238
+ default:
239
+ matchResult = 1;
240
+ }
241
+ switch (matchResult) {
242
+ case 0:
243
+ return [oa.NameText, (oa.TANInfo != null) ? oa.TermAccessionAndOntobeeUrlIfShort : undefined];
244
+ default:
245
+ return toFail(printf("header %O should not be parsed to isa value"))(header);
246
+ }
247
+ }
248
+
249
+ /**
250
+ * Convert a CompositeHeader and Cell tuple to a ISA Component
251
+ */
252
+ export function BaseTypes_composeComponent(header, value) {
253
+ const patternInput = BaseTypes_valuesOfCell_Z436420FE(value);
254
+ const patternInput_1 = BaseTypes_termOfHeader_6CAF647B(header);
255
+ return LDPropertyValue.createComponent(patternInput_1[0], unwrap(patternInput[0]), undefined, unwrap(patternInput_1[1]), unwrap(patternInput[3]), unwrap(patternInput[2]), unwrap(patternInput[1]));
256
+ }
257
+
258
+ /**
259
+ * Convert a CompositeHeader and Cell tuple to a ISA ProcessParameterValue
260
+ */
261
+ export function BaseTypes_composeParameterValue(header, value) {
262
+ const patternInput = BaseTypes_valuesOfCell_Z436420FE(value);
263
+ const patternInput_1 = BaseTypes_termOfHeader_6CAF647B(header);
264
+ return LDPropertyValue.createParameterValue(patternInput_1[0], unwrap(patternInput[0]), undefined, unwrap(patternInput_1[1]), unwrap(patternInput[3]), unwrap(patternInput[2]), unwrap(patternInput[1]));
265
+ }
266
+
267
+ /**
268
+ * Convert a CompositeHeader and Cell tuple to a ISA FactorValue
269
+ */
270
+ export function BaseTypes_composeFactorValue(header, value) {
271
+ const patternInput = BaseTypes_valuesOfCell_Z436420FE(value);
272
+ const patternInput_1 = BaseTypes_termOfHeader_6CAF647B(header);
273
+ return LDPropertyValue.createFactorValue(patternInput_1[0], unwrap(patternInput[0]), undefined, unwrap(patternInput_1[1]), unwrap(patternInput[3]), unwrap(patternInput[2]), unwrap(patternInput[1]));
274
+ }
275
+
276
+ /**
277
+ * Convert a CompositeHeader and Cell tuple to a ISA MaterialAttributeValue
278
+ */
279
+ export function BaseTypes_composeCharacteristicValue(header, value) {
280
+ const patternInput = BaseTypes_valuesOfCell_Z436420FE(value);
281
+ const patternInput_1 = BaseTypes_termOfHeader_6CAF647B(header);
282
+ return LDPropertyValue.createCharacteristicValue(patternInput_1[0], unwrap(patternInput[0]), undefined, unwrap(patternInput_1[1]), unwrap(patternInput[3]), unwrap(patternInput[2]), unwrap(patternInput[1]));
283
+ }
284
+
285
+ export function BaseTypes_composeFreetextMaterialName(headerFT, name) {
286
+ return `${headerFT}=${name}`;
287
+ }
288
+
289
+ export function BaseTypes_composeFile_3A03A101(d) {
290
+ const dataType = map(DataFile__get_AsString, d.DataType);
291
+ return LDFile.create(d.NameText, d.NameText, undefined, unwrap(dataType), unwrap(d.Format), unwrap(d.SelectorFormat));
292
+ }
293
+
294
+ export function BaseTypes_decomposeFile_Z2F770004(f, context) {
295
+ const dataType = map(DataFile_fromString_Z721C83C5, LDFile.tryGetDisambiguatingDescriptionAsString(f, unwrap(context)));
296
+ const format = LDFile.tryGetEncodingFormatAsString(f, unwrap(context));
297
+ const selectorFormat = LDFile.tryGetUsageInfoAsString(f, unwrap(context));
298
+ return new Data(undefined, LDFile.getNameAsString(f, unwrap(context)), unwrap(dataType), unwrap(format), unwrap(selectorFormat));
299
+ }
300
+
301
+ export function BaseTypes_composeFragmentDescriptor_Z4C0BEF62(dc) {
302
+ if (dc.Name == null) {
303
+ throw new Error("RO-Crate parsing of DataContext failed: Cannot create a fragment descriptor without a name.");
304
+ }
305
+ const id = LDPropertyValue.genIdFragmentDescriptor(dc.NameText);
306
+ const patternInput = defaultArg(map((e) => [e.Name, Option_fromValueWithDefault("", e.TermAccessionAndOntobeeUrlIfShort)], DataContext__get_Explication(dc)), [undefined, undefined]);
307
+ const patternInput_1 = defaultArg(map((u) => [u.Name, Option_fromValueWithDefault("", u.TermAccessionAndOntobeeUrlIfShort)], DataContext__get_Unit(dc)), [undefined, undefined]);
308
+ const disambiguatingDescriptions = Option_fromSeq(ResizeArray_map(toString_1, dc.Comments));
309
+ const dataFragment = BaseTypes_composeFile_3A03A101(dc);
310
+ const pattern = map(BaseTypes_composeDefinedTerm_ZDED3A0F, DataContext__get_ObjectType(dc));
311
+ dataFragment.SetProperty(LDFile.about, new LDRef(id));
312
+ dataFragment.SetOptionalProperty(LDFile.pattern, pattern);
313
+ return LDPropertyValue.createFragmentDescriptor(dc.NameText, unwrap(patternInput[0]), undefined, unwrap(patternInput_1[1]), unwrap(patternInput_1[0]), unwrap(patternInput[1]), unwrap(DataContext__get_GeneratedBy(dc)), unwrap(DataContext__get_Description(dc)), unwrap(DataContext__get_Label(dc)), unwrap(disambiguatingDescriptions), dataFragment);
314
+ }
315
+
316
+ export function BaseTypes_decomposeFragmentDescriptor_Z6839B9E8(fd, graph, context) {
317
+ const file = LDPropertyValue.tryGetSubjectOf(fd, unwrap(graph), unwrap(context));
318
+ let name;
319
+ if (file == null) {
320
+ throw new Error("RO-Crate parsing of DataContext failed: Cannot decompose a fragment descriptor without a name.");
321
+ }
322
+ else {
323
+ const f = file;
324
+ name = LDFile.getNameAsString(f, unwrap(context));
325
+ }
326
+ const objectType = map((pa) => BaseTypes_decomposeDefinedTerm_Z2F770004(pa, unwrap(context)), bind((f_1) => LDFile.tryGetPatternAsDefinedTerm(f_1, unwrap(graph), unwrap(context)), file));
327
+ const format = bind((f_2) => LDFile.tryGetEncodingFormatAsString(f_2, unwrap(context)), file);
328
+ const selectorFormat = bind((f_3) => LDFile.tryGetUsageInfoAsString(f_3, unwrap(context)), file);
329
+ const explication = BaseTypes_tryOntologyTermFromNameAndID_40457300(unwrap(LDPropertyValue.tryGetValueAsString(fd)), unwrap(LDPropertyValue.tryGetValueReferenceAsString(fd)));
330
+ const unit = BaseTypes_tryOntologyTermFromNameAndID_40457300(unwrap(LDPropertyValue.tryGetUnitTextAsString(fd)), unwrap(LDPropertyValue.tryGetUnitCodeAsString(fd)));
331
+ const generatedBy = LDPropertyValue.tryGetMeasurementMethodAsString(fd);
332
+ const description = LDPropertyValue.tryGetDescriptionAsString(fd);
333
+ return DataContext_$ctor_Z780A8A2A(undefined, name, undefined, unwrap(format), unwrap(selectorFormat), unwrap(explication), unwrap(unit), unwrap(objectType), unwrap(LDPropertyValue.tryGetAlternateNameAsString(fd)), unwrap(description), unwrap(generatedBy), ResizeArray_map((s) => Comment$.fromString(s), LDPropertyValue.getDisambiguatingDescriptionsAsString(fd)));
334
+ }
335
+
336
+ /**
337
+ * Convert a CompositeHeader and Cell tuple to a ISA ProcessInput
338
+ */
339
+ export function BaseTypes_composeProcessInput(header, value) {
340
+ if (header.tag === 11) {
341
+ switch (header.fields[0].tag) {
342
+ case 1:
343
+ return LDSample.createSample(value.AsFreeText);
344
+ case 3:
345
+ return LDSample.createMaterial(value.AsFreeText);
346
+ case 2:
347
+ switch (value.tag) {
348
+ case 1: {
349
+ const ft = value.fields[0];
350
+ return LDFile.create(ft, ft);
351
+ }
352
+ case 3:
353
+ return BaseTypes_composeFile_3A03A101(value.fields[0]);
354
+ default:
355
+ return toFail(printf("Could not parse input data %O"))(value);
356
+ }
357
+ case 4: {
358
+ const n = new LDNode(BaseTypes_composeFreetextMaterialName(header.fields[0].fields[0], value.AsFreeText), [header.fields[0].fields[0]]);
359
+ n.SetProperty(LDSample.name, value.AsFreeText);
360
+ return n;
361
+ }
362
+ default:
363
+ return LDSample.createSource(value.AsFreeText);
364
+ }
365
+ }
366
+ else {
367
+ return toFail(printf("Could not parse input header %O"))(header);
368
+ }
369
+ }
370
+
371
+ /**
372
+ * Convert a CompositeHeader and Cell tuple to a ISA ProcessOutput
373
+ */
374
+ export function BaseTypes_composeProcessOutput(header, value) {
375
+ let matchResult, ft_1;
376
+ if (header.tag === 12) {
377
+ switch (header.fields[0].tag) {
378
+ case 3: {
379
+ matchResult = 1;
380
+ break;
381
+ }
382
+ case 2: {
383
+ matchResult = 2;
384
+ break;
385
+ }
386
+ case 4: {
387
+ matchResult = 3;
388
+ ft_1 = header.fields[0].fields[0];
389
+ break;
390
+ }
391
+ default:
392
+ matchResult = 0;
393
+ }
394
+ }
395
+ else {
396
+ matchResult = 4;
397
+ }
398
+ switch (matchResult) {
399
+ case 0:
400
+ return LDSample.createSample(value.AsFreeText);
401
+ case 1:
402
+ return LDSample.createMaterial(value.AsFreeText);
403
+ case 2:
404
+ switch (value.tag) {
405
+ case 1: {
406
+ const ft = value.fields[0];
407
+ return LDFile.create(ft, ft);
408
+ }
409
+ case 3:
410
+ return BaseTypes_composeFile_3A03A101(value.fields[0]);
411
+ default:
412
+ return toFail(printf("Could not parse output data %O"))(value);
413
+ }
414
+ case 3: {
415
+ const n = new LDNode(BaseTypes_composeFreetextMaterialName(ft_1, value.AsFreeText), [ft_1]);
416
+ n.SetProperty(LDSample.name, value.AsFreeText);
417
+ return n;
418
+ }
419
+ default:
420
+ return toFail(printf("Could not parse output header %O"))(header);
421
+ }
422
+ }
423
+
424
+ export function BaseTypes_headerOntologyOfPropertyValue_Z2F770004(pv, context) {
425
+ const n = LDPropertyValue.getNameAsString(pv, unwrap(context));
426
+ const matchValue = LDPropertyValue.tryGetPropertyIDAsString(pv, unwrap(context));
427
+ if (matchValue == null) {
428
+ return new OntologyAnnotation(n);
429
+ }
430
+ else {
431
+ const nRef = matchValue;
432
+ return OntologyAnnotation.fromTermAnnotation(nRef, n);
433
+ }
434
+ }
435
+
436
+ /**
437
+ * Convert an ISA Value and Unit tuple to a CompositeCell
438
+ */
439
+ export function BaseTypes_cellOfPropertyValue_Z2F770004(pv, context) {
440
+ const v = LDPropertyValue.tryGetValueAsString(pv, unwrap(context));
441
+ const vRef = LDPropertyValue.tryGetValueReferenceAsString(pv, unwrap(context));
442
+ const u = LDPropertyValue.tryGetUnitTextAsString(pv, unwrap(context));
443
+ const uRef = LDPropertyValue.tryGetUnitCodeAsString(pv, unwrap(context));
444
+ let matchResult, vr, u_1, uRef_1;
445
+ if (vRef == null) {
446
+ if (u == null) {
447
+ if (uRef == null) {
448
+ matchResult = 3;
449
+ }
450
+ else {
451
+ matchResult = 2;
452
+ uRef_1 = uRef;
453
+ }
454
+ }
455
+ else if (uRef != null) {
456
+ matchResult = 2;
457
+ uRef_1 = uRef;
458
+ }
459
+ else {
460
+ matchResult = 1;
461
+ u_1 = u;
462
+ }
463
+ }
464
+ else if (u == null) {
465
+ if (uRef == null) {
466
+ matchResult = 0;
467
+ vr = vRef;
468
+ }
469
+ else {
470
+ matchResult = 4;
471
+ }
472
+ }
473
+ else {
474
+ matchResult = 4;
475
+ }
476
+ switch (matchResult) {
477
+ case 0:
478
+ return new CompositeCell(0, [OntologyAnnotation.fromTermAnnotation(vr, unwrap(v))]);
479
+ case 1:
480
+ return new CompositeCell(2, [defaultArg(v, ""), new OntologyAnnotation(u_1)]);
481
+ case 2:
482
+ return new CompositeCell(2, [defaultArg(v, ""), OntologyAnnotation.fromTermAnnotation(uRef_1, unwrap(u))]);
483
+ case 3:
484
+ return new CompositeCell(0, [new OntologyAnnotation(unwrap(v))]);
485
+ default: {
486
+ const arg = defaultArg(v, "");
487
+ return toFail(printf("Could not parse value %s with unit %O and unit reference %O"))(arg)(u)(uRef);
488
+ }
489
+ }
490
+ }
491
+
492
+ /**
493
+ * Convert an ISA Component to a CompositeHeader and Cell tuple
494
+ */
495
+ export function BaseTypes_decomposeComponent_Z2F770004(c, context) {
496
+ return [new CompositeHeader(0, [BaseTypes_headerOntologyOfPropertyValue_Z2F770004(c, unwrap(context))]), BaseTypes_cellOfPropertyValue_Z2F770004(c, unwrap(context))];
497
+ }
498
+
499
+ /**
500
+ * Convert an ISA ProcessParameterValue to a CompositeHeader and Cell tuple
501
+ */
502
+ export function BaseTypes_decomposeParameterValue_Z2F770004(c, context) {
503
+ return [new CompositeHeader(3, [BaseTypes_headerOntologyOfPropertyValue_Z2F770004(c, unwrap(context))]), BaseTypes_cellOfPropertyValue_Z2F770004(c, unwrap(context))];
504
+ }
505
+
506
+ /**
507
+ * Convert an ISA FactorValue to a CompositeHeader and Cell tuple
508
+ */
509
+ export function BaseTypes_decomposeFactorValue_Z2F770004(c, context) {
510
+ return [new CompositeHeader(2, [BaseTypes_headerOntologyOfPropertyValue_Z2F770004(c, unwrap(context))]), BaseTypes_cellOfPropertyValue_Z2F770004(c, unwrap(context))];
511
+ }
512
+
513
+ /**
514
+ * Convert an ISA MaterialAttributeValue to a CompositeHeader and Cell tuple
515
+ */
516
+ export function BaseTypes_decomposeCharacteristicValue_Z2F770004(c, context) {
517
+ return [new CompositeHeader(1, [BaseTypes_headerOntologyOfPropertyValue_Z2F770004(c, unwrap(context))]), BaseTypes_cellOfPropertyValue_Z2F770004(c, unwrap(context))];
518
+ }
519
+
520
+ /**
521
+ * Convert an ISA ProcessOutput to a CompositeHeader and Cell tuple
522
+ */
523
+ export function BaseTypes_decomposeProcessInput_Z2F770004(pn, context) {
524
+ if (LDSample.validateSource(pn, unwrap(context))) {
525
+ return [new CompositeHeader(11, [new IOType(0, [])]), new CompositeCell(1, [LDSample.getNameAsString(pn, unwrap(context))])];
526
+ }
527
+ else if (LDSample.validateMaterial(pn, unwrap(context))) {
528
+ return [new CompositeHeader(11, [new IOType(3, [])]), new CompositeCell(1, [LDSample.getNameAsString(pn, unwrap(context))])];
529
+ }
530
+ else if (LDSample.validate(pn, unwrap(context))) {
531
+ return [new CompositeHeader(11, [new IOType(1, [])]), new CompositeCell(1, [LDSample.getNameAsString(pn, unwrap(context))])];
532
+ }
533
+ else if (LDFile.validate(pn, unwrap(context))) {
534
+ return [new CompositeHeader(11, [new IOType(2, [])]), new CompositeCell(3, [BaseTypes_decomposeFile_Z2F770004(pn, unwrap(context))])];
535
+ }
536
+ else {
537
+ const n = pn;
538
+ return [new CompositeHeader(11, [new IOType(4, [n.SchemaType[0]])]), new CompositeCell(1, [LDSample.getNameAsString(n, unwrap(context))])];
539
+ }
540
+ }
541
+
542
+ export function BaseTypes_decomposeProcessOutput_Z2F770004(pn, context) {
543
+ if (LDSample.validateMaterial(pn, unwrap(context))) {
544
+ return [new CompositeHeader(12, [new IOType(3, [])]), new CompositeCell(1, [LDSample.getNameAsString(pn, unwrap(context))])];
545
+ }
546
+ else if (LDSample.validate(pn, unwrap(context))) {
547
+ return [new CompositeHeader(12, [new IOType(1, [])]), new CompositeCell(1, [LDSample.getNameAsString(pn, unwrap(context))])];
548
+ }
549
+ else if (LDFile.validate(pn, unwrap(context))) {
550
+ return [new CompositeHeader(12, [new IOType(2, [])]), new CompositeCell(3, [BaseTypes_decomposeFile_Z2F770004(pn, unwrap(context))])];
551
+ }
552
+ else {
553
+ const n = pn;
554
+ return [new CompositeHeader(12, [new IOType(4, [n.SchemaType[0]])]), new CompositeCell(1, [LDSample.getNameAsString(n, unwrap(context))])];
555
+ }
556
+ }
557
+
558
+ /**
559
+ * This function creates a string containing the name and the ontology short-string of the given ontology annotation term
560
+ *
561
+ * TechnologyPlatforms are plain strings in ISA-JSON.
562
+ *
563
+ * This function allows us, to parse them as an ontology term.
564
+ */
565
+ export function BaseTypes_composeTechnologyPlatform_ZDED3A0F(tp) {
566
+ const matchValue = tp.TANInfo;
567
+ if (matchValue == null) {
568
+ return `${tp.NameText}`;
569
+ }
570
+ else {
571
+ return `${tp.NameText} (${tp.TermAccessionShort})`;
572
+ }
573
+ }
574
+
575
+ /**
576
+ * This function parses the given string containing the name and the ontology short-string of the given ontology annotation term
577
+ *
578
+ * TechnologyPlatforms are plain strings in ISA-JSON.
579
+ *
580
+ * This function allows us, to parse them as an ontology term.
581
+ */
582
+ export function BaseTypes_decomposeTechnologyPlatform_Z721C83C5(name) {
583
+ const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("^(?<value>.+) \\((?<ontology>[^(]*:[^)]*)\\)$", name);
584
+ if (activePatternResult != null) {
585
+ const r = activePatternResult;
586
+ let oa;
587
+ const tan = (r.groups && r.groups.ontology) || "";
588
+ oa = OntologyAnnotation.fromTermAnnotation(tan);
589
+ const v = (r.groups && r.groups.value) || "";
590
+ return OntologyAnnotation.create(v, unwrap(oa.TermSourceREF), unwrap(oa.TermAccessionNumber));
591
+ }
592
+ else {
593
+ return OntologyAnnotation.create(name);
594
+ }
595
+ }
596
+
597
+ export class ProcessConversion {
598
+ constructor() {
599
+ }
600
+ }
601
+
602
+ export function ProcessConversion_$reflection() {
603
+ return class_type("ARCtrl.Conversion.ProcessConversion", undefined, ProcessConversion);
604
+ }
605
+
606
+ export function ProcessConversion_tryGetProtocolType_Z6839B9E8(pv, graph, context) {
607
+ const matchValue = LDLabProtocol.tryGetIntendedUseAsDefinedTerm(pv, unwrap(graph), unwrap(context));
608
+ if (matchValue == null) {
609
+ const matchValue_1 = LDLabProtocol.tryGetIntendedUseAsString(pv, unwrap(context));
610
+ if (matchValue_1 == null) {
611
+ return undefined;
612
+ }
613
+ else {
614
+ const s = matchValue_1;
615
+ return OntologyAnnotation.create(s);
616
+ }
617
+ }
618
+ else {
619
+ return BaseTypes_decomposeDefinedTerm_Z2F770004(matchValue, unwrap(context));
620
+ }
621
+ }
622
+
623
+ export function ProcessConversion_composeProcessName(processNameRoot, i) {
624
+ return `${processNameRoot}_${i}`;
625
+ }
626
+
627
+ export function ProcessConversion_decomposeProcessName_Z721C83C5(name) {
628
+ const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("(?<name>.+)_(?<num>\\d+)", name);
629
+ if (activePatternResult != null) {
630
+ const r = activePatternResult;
631
+ return [(r.groups && r.groups.name) || "", parse((r.groups && r.groups.num) || "", 511, false, 32)];
632
+ }
633
+ else {
634
+ return [name, undefined];
635
+ }
636
+ }
637
+
638
+ /**
639
+ * If the given headers depict a component, returns a function for parsing the values of the matrix to the values of this component
640
+ */
641
+ export function ProcessConversion_tryComponentGetter(generalI, valueI, valueHeader) {
642
+ if (valueHeader.tag === 0) {
643
+ return (matrix) => ((i) => {
644
+ const c = BaseTypes_composeComponent(valueHeader, getItemFromDict(matrix, [generalI, i]));
645
+ ARCtrl_ROCrate_LDNode__LDNode_SetColumnIndex_Z524259A4(c, valueI);
646
+ return c;
647
+ });
648
+ }
649
+ else {
650
+ return undefined;
651
+ }
652
+ }
653
+
654
+ /**
655
+ * If the given headers depict a parameter, returns a function for parsing the values of the matrix to the values of this type
656
+ */
657
+ export function ProcessConversion_tryParameterGetter(generalI, valueI, valueHeader) {
658
+ if (valueHeader.tag === 3) {
659
+ return (matrix) => ((i) => {
660
+ const p = BaseTypes_composeParameterValue(valueHeader, getItemFromDict(matrix, [generalI, i]));
661
+ ARCtrl_ROCrate_LDNode__LDNode_SetColumnIndex_Z524259A4(p, valueI);
662
+ return p;
663
+ });
664
+ }
665
+ else {
666
+ return undefined;
667
+ }
668
+ }
669
+
670
+ /**
671
+ * If the given headers depict a factor, returns a function for parsing the values of the matrix to the values of this type
672
+ */
673
+ export function ProcessConversion_tryFactorGetter(generalI, valueI, valueHeader) {
674
+ if (valueHeader.tag === 2) {
675
+ return (matrix) => ((i) => {
676
+ const f = BaseTypes_composeFactorValue(valueHeader, getItemFromDict(matrix, [generalI, i]));
677
+ ARCtrl_ROCrate_LDNode__LDNode_SetColumnIndex_Z524259A4(f, valueI);
678
+ return f;
679
+ });
680
+ }
681
+ else {
682
+ return undefined;
683
+ }
684
+ }
685
+
686
+ /**
687
+ * If the given headers depict a protocolType, returns a function for parsing the values of the matrix to the values of this type
688
+ */
689
+ export function ProcessConversion_tryCharacteristicGetter(generalI, valueI, valueHeader) {
690
+ if (valueHeader.tag === 1) {
691
+ return (matrix) => ((i) => {
692
+ const c = BaseTypes_composeCharacteristicValue(valueHeader, getItemFromDict(matrix, [generalI, i]));
693
+ ARCtrl_ROCrate_LDNode__LDNode_SetColumnIndex_Z524259A4(c, valueI);
694
+ return c;
695
+ });
696
+ }
697
+ else {
698
+ return undefined;
699
+ }
700
+ }
701
+
702
+ /**
703
+ * If the given headers depict a protocolType, returns a function for parsing the values of the matrix to the values of this type
704
+ */
705
+ export function ProcessConversion_tryGetProtocolTypeGetter(generalI, header) {
706
+ if (header.tag === 4) {
707
+ return (matrix) => ((i) => BaseTypes_composeDefinedTerm_ZDED3A0F(getItemFromDict(matrix, [generalI, i]).AsTerm));
708
+ }
709
+ else {
710
+ return undefined;
711
+ }
712
+ }
713
+
714
+ /**
715
+ * If the given headers depict a protocolREF, returns a function for parsing the values of the matrix to the values of this type
716
+ */
717
+ export function ProcessConversion_tryGetProtocolREFGetter(generalI, header) {
718
+ if (header.tag === 8) {
719
+ return (matrix) => ((i) => getItemFromDict(matrix, [generalI, i]).AsFreeText);
720
+ }
721
+ else {
722
+ return undefined;
723
+ }
724
+ }
725
+
726
+ /**
727
+ * If the given headers depict a protocolDescription, returns a function for parsing the values of the matrix to the values of this type
728
+ */
729
+ export function ProcessConversion_tryGetProtocolDescriptionGetter(generalI, header) {
730
+ if (header.tag === 5) {
731
+ return (matrix) => ((i) => getItemFromDict(matrix, [generalI, i]).AsFreeText);
732
+ }
733
+ else {
734
+ return undefined;
735
+ }
736
+ }
737
+
738
+ /**
739
+ * If the given headers depict a protocolURI, returns a function for parsing the values of the matrix to the values of this type
740
+ */
741
+ export function ProcessConversion_tryGetProtocolURIGetter(generalI, header) {
742
+ if (header.tag === 6) {
743
+ return (matrix) => ((i) => getItemFromDict(matrix, [generalI, i]).AsFreeText);
744
+ }
745
+ else {
746
+ return undefined;
747
+ }
748
+ }
749
+
750
+ /**
751
+ * If the given headers depict a protocolVersion, returns a function for parsing the values of the matrix to the values of this type
752
+ */
753
+ export function ProcessConversion_tryGetProtocolVersionGetter(generalI, header) {
754
+ if (header.tag === 7) {
755
+ return (matrix) => ((i) => getItemFromDict(matrix, [generalI, i]).AsFreeText);
756
+ }
757
+ else {
758
+ return undefined;
759
+ }
760
+ }
761
+
762
+ /**
763
+ * If the given headers depict an input, returns a function for parsing the values of the matrix to the values of this type
764
+ */
765
+ export function ProcessConversion_tryGetInputGetter(generalI, header) {
766
+ if (header.tag === 11) {
767
+ return (matrix) => ((i) => BaseTypes_composeProcessInput(header, getItemFromDict(matrix, [generalI, i])));
768
+ }
769
+ else {
770
+ return undefined;
771
+ }
772
+ }
773
+
774
+ /**
775
+ * If the given headers depict an output, returns a function for parsing the values of the matrix to the values of this type
776
+ */
777
+ export function ProcessConversion_tryGetOutputGetter(generalI, header) {
778
+ if (header.tag === 12) {
779
+ return (matrix) => ((i) => BaseTypes_composeProcessOutput(header, getItemFromDict(matrix, [generalI, i])));
780
+ }
781
+ else {
782
+ return undefined;
783
+ }
784
+ }
785
+
786
+ /**
787
+ * If the given headers depict a comment, returns a function for parsing the values of the matrix to the values of this type
788
+ */
789
+ export function ProcessConversion_tryGetCommentGetter(generalI, header) {
790
+ if (header.tag === 14) {
791
+ return (matrix) => ((i) => toString_1(new Comment$(header.fields[0], getItemFromDict(matrix, [generalI, i]).AsFreeText)));
792
+ }
793
+ else {
794
+ return undefined;
795
+ }
796
+ }
797
+
798
+ export function ProcessConversion_tryGetPerformerGetter(generalI, header) {
799
+ if (header.tag === 9) {
800
+ return (matrix) => ((i) => {
801
+ const performer = getItemFromDict(matrix, [generalI, i]).AsFreeText;
802
+ return LDPerson.create(performer);
803
+ });
804
+ }
805
+ else {
806
+ return undefined;
807
+ }
808
+ }
809
+
810
+ /**
811
+ * Given the header sequence of an ArcTable, returns a function for parsing each row of the table to a process
812
+ */
813
+ export function ProcessConversion_getProcessGetter(processNameRoot, headers) {
814
+ const headers_1 = indexed(headers);
815
+ const valueHeaders = toList(indexed(filter((arg) => arg[1].IsCvParamColumn, headers_1)));
816
+ const charGetters = choose((tupledArg) => {
817
+ const _arg = tupledArg[1];
818
+ return ProcessConversion_tryCharacteristicGetter(_arg[0], tupledArg[0], _arg[1]);
819
+ }, valueHeaders);
820
+ const factorValueGetters = choose((tupledArg_1) => {
821
+ const _arg_1 = tupledArg_1[1];
822
+ return ProcessConversion_tryFactorGetter(_arg_1[0], tupledArg_1[0], _arg_1[1]);
823
+ }, valueHeaders);
824
+ const parameterValueGetters = choose((tupledArg_2) => {
825
+ const _arg_2 = tupledArg_2[1];
826
+ return ProcessConversion_tryParameterGetter(_arg_2[0], tupledArg_2[0], _arg_2[1]);
827
+ }, valueHeaders);
828
+ const componentGetters = choose((tupledArg_3) => {
829
+ const _arg_3 = tupledArg_3[1];
830
+ return ProcessConversion_tryComponentGetter(_arg_3[0], tupledArg_3[0], _arg_3[1]);
831
+ }, valueHeaders);
832
+ const protocolTypeGetter = tryPick((tupledArg_4) => ProcessConversion_tryGetProtocolTypeGetter(tupledArg_4[0], tupledArg_4[1]), headers_1);
833
+ const protocolREFGetter = tryPick((tupledArg_5) => ProcessConversion_tryGetProtocolREFGetter(tupledArg_5[0], tupledArg_5[1]), headers_1);
834
+ const protocolDescriptionGetter = tryPick((tupledArg_6) => ProcessConversion_tryGetProtocolDescriptionGetter(tupledArg_6[0], tupledArg_6[1]), headers_1);
835
+ const protocolURIGetter = tryPick((tupledArg_7) => ProcessConversion_tryGetProtocolURIGetter(tupledArg_7[0], tupledArg_7[1]), headers_1);
836
+ const protocolVersionGetter = tryPick((tupledArg_8) => ProcessConversion_tryGetProtocolVersionGetter(tupledArg_8[0], tupledArg_8[1]), headers_1);
837
+ const performerGetter = tryPick((tupledArg_9) => ProcessConversion_tryGetPerformerGetter(tupledArg_9[0], tupledArg_9[1]), headers_1);
838
+ const commentGetters = toList(choose_1((tupledArg_10) => ProcessConversion_tryGetCommentGetter(tupledArg_10[0], tupledArg_10[1]), headers_1));
839
+ let inputGetter_1;
840
+ const matchValue = tryPick((tupledArg_11) => ProcessConversion_tryGetInputGetter(tupledArg_11[0], tupledArg_11[1]), headers_1);
841
+ if (matchValue == null) {
842
+ inputGetter_1 = ((length(charGetters) !== 0) ? ((matrix_1) => ((i_1) => {
843
+ let chars_1;
844
+ const collection_1 = map_1((f_1) => f_1(matrix_1)(i_1), charGetters);
845
+ chars_1 = Array.from(collection_1);
846
+ return ResizeArray_singleton(LDSample.createSample(`${processNameRoot}_Input_${i_1}`, undefined, chars_1));
847
+ })) : ((matrix_2) => ((i_2) => [])));
848
+ }
849
+ else {
850
+ const inputGetter = matchValue;
851
+ inputGetter_1 = ((matrix) => ((i) => {
852
+ let chars;
853
+ const collection = map_1((f) => f(matrix)(i), charGetters);
854
+ chars = Array.from(collection);
855
+ const input = inputGetter(matrix)(i);
856
+ if (chars.length > 0) {
857
+ LDSample.setAdditionalProperties(input, chars);
858
+ }
859
+ return ResizeArray_singleton(input);
860
+ }));
861
+ }
862
+ let outputGetter_1;
863
+ const matchValue_1 = tryPick((tupledArg_12) => ProcessConversion_tryGetOutputGetter(tupledArg_12[0], tupledArg_12[1]), headers_1);
864
+ if (matchValue_1 == null) {
865
+ outputGetter_1 = ((length(factorValueGetters) !== 0) ? ((matrix_4) => ((i_4) => {
866
+ let factors_1;
867
+ const collection_3 = map_1((f_3) => f_3(matrix_4)(i_4), factorValueGetters);
868
+ factors_1 = Array.from(collection_3);
869
+ return ResizeArray_singleton(LDSample.createSample(`${processNameRoot}_Output_${i_4}`, undefined, factors_1));
870
+ })) : ((matrix_5) => ((i_5) => [])));
871
+ }
872
+ else {
873
+ const outputGetter = matchValue_1;
874
+ outputGetter_1 = ((matrix_3) => ((i_3) => {
875
+ let factors;
876
+ const collection_2 = map_1((f_2) => f_2(matrix_3)(i_3), factorValueGetters);
877
+ factors = Array.from(collection_2);
878
+ const output = outputGetter(matrix_3)(i_3);
879
+ if (factors.length > 0) {
880
+ LDSample.setAdditionalProperties(output, factors);
881
+ }
882
+ return ResizeArray_singleton(output);
883
+ }));
884
+ }
885
+ return (matrix_6) => ((i_6) => {
886
+ const pn = ((1 + max(map_1((tuple_1) => tuple_1[1], matrix_6.keys()), {
887
+ Compare: comparePrimitives,
888
+ })) === 1) ? processNameRoot : ProcessConversion_composeProcessName(processNameRoot, i_6);
889
+ const paramvalues = map((collection_4) => Array.from(collection_4), Option_fromValueWithDefault(empty(), map_2((f_4) => f_4(matrix_6)(i_6), parameterValueGetters)));
890
+ const comments = map((collection_5) => Array.from(collection_5), Option_fromValueWithDefault(empty(), map_2((f_5) => f_5(matrix_6)(i_6), commentGetters)));
891
+ const components = map((collection_6) => Array.from(collection_6), Option_fromValueWithDefault(empty(), map_2((f_6) => f_6(matrix_6)(i_6), componentGetters)));
892
+ let protocol;
893
+ const name = map((f_7) => f_7(matrix_6)(i_6), protocolREFGetter);
894
+ const protocolId = LDLabProtocol.genId(unwrap(name), processNameRoot);
895
+ protocol = LDLabProtocol.create(protocolId, unwrap(name), unwrap(map((f_8) => f_8(matrix_6)(i_6), protocolDescriptionGetter)), unwrap(map((f_9) => f_9(matrix_6)(i_6), protocolTypeGetter)), undefined, undefined, unwrap(components), undefined, unwrap(map((f_10) => f_10(matrix_6)(i_6), protocolURIGetter)), unwrap(map((f_11) => f_11(matrix_6)(i_6), protocolVersionGetter)));
896
+ const matchValue_2 = inputGetter_1(matrix_6)(i_6);
897
+ const matchValue_3 = outputGetter_1(matrix_6)(i_6);
898
+ const agent = map((f_12) => f_12(matrix_6)(i_6), performerGetter);
899
+ return LDLabProcess.create(pn, matchValue_2, matchValue_3, undefined, unwrap(agent), unwrap(protocol), unwrap(paramvalues), undefined, unwrap(comments));
900
+ });
901
+ }
902
+
903
+ /**
904
+ * Groups processes by their name, or by the name of the protocol they execute
905
+ *
906
+ * Process names are taken from the Worksheet name and numbered: SheetName_1, SheetName_2, etc.
907
+ *
908
+ * This function decomposes this name into a root name and a number, and groups processes by root name.
909
+ */
910
+ export function ProcessConversion_groupProcesses_Z27F0B586(processes, graph, context) {
911
+ return List_groupBy((p) => {
912
+ let protocol, name_1, name_2, protocol_1;
913
+ const matchValue = LDLabProcess.tryGetNameAsString(p, unwrap(context));
914
+ const matchValue_1 = LDLabProcess.tryGetExecutesLabProtocol(p, unwrap(graph), unwrap(context));
915
+ let matchResult, name_3, protocol_2, name_4, name_5, protocol_3;
916
+ if (matchValue != null) {
917
+ if (ProcessConversion_decomposeProcessName_Z721C83C5(matchValue)[1] != null) {
918
+ matchResult = 0;
919
+ name_3 = matchValue;
920
+ }
921
+ else if (matchValue_1 != null) {
922
+ if ((protocol = matchValue_1, LDLabProtocol.tryGetNameAsString(protocol, unwrap(context)) != null)) {
923
+ matchResult = 1;
924
+ protocol_2 = matchValue_1;
925
+ }
926
+ else if ((name_1 = matchValue, name_1.indexOf("_") >= 0)) {
927
+ matchResult = 2;
928
+ name_4 = matchValue;
929
+ }
930
+ else {
931
+ matchResult = 3;
932
+ name_5 = matchValue;
933
+ }
934
+ }
935
+ else if ((name_2 = matchValue, name_2.indexOf("_") >= 0)) {
936
+ matchResult = 2;
937
+ name_4 = matchValue;
938
+ }
939
+ else {
940
+ matchResult = 3;
941
+ name_5 = matchValue;
942
+ }
943
+ }
944
+ else if (matchValue_1 != null) {
945
+ if ((protocol_1 = matchValue_1, LDLabProtocol.tryGetNameAsString(protocol_1, unwrap(context)) != null)) {
946
+ matchResult = 1;
947
+ protocol_2 = matchValue_1;
948
+ }
949
+ else {
950
+ matchResult = 4;
951
+ protocol_3 = matchValue_1;
952
+ }
953
+ }
954
+ else {
955
+ matchResult = 5;
956
+ }
957
+ switch (matchResult) {
958
+ case 0:
959
+ return ProcessConversion_decomposeProcessName_Z721C83C5(name_3)[0];
960
+ case 1:
961
+ return defaultArg(LDLabProtocol.tryGetNameAsString(protocol_2, unwrap(context)), "");
962
+ case 2:
963
+ return remove(name_4, name_4.lastIndexOf("_"));
964
+ case 3:
965
+ return name_5;
966
+ case 4:
967
+ return protocol_3.Id;
968
+ default:
969
+ return createMissingIdentifier();
970
+ }
971
+ }, processes, {
972
+ Equals: (x, y) => (x === y),
973
+ GetHashCode: stringHash,
974
+ });
975
+ }
976
+
977
+ /**
978
+ * Merges processes with the same name, protocol and param values
979
+ */
980
+ export function ProcessConversion_processToRows_Z6839B9E8(p, graph, context) {
981
+ const pvs = ResizeArray_map((ppv) => [BaseTypes_decomposeParameterValue_Z2F770004(ppv, unwrap(context)), ColumnIndex_tryGetIndex(ppv)], LDLabProcess.getParameterValues(p, unwrap(graph), unwrap(context)));
982
+ let components;
983
+ const matchValue = LDLabProcess.tryGetExecutesLabProtocol(p, unwrap(graph), unwrap(context));
984
+ if (matchValue == null) {
985
+ components = [];
986
+ }
987
+ else {
988
+ const prot = matchValue;
989
+ components = ResizeArray_map((ppv_1) => [BaseTypes_decomposeComponent_Z2F770004(ppv_1, unwrap(context)), ColumnIndex_tryGetIndex(ppv_1)], LDLabProtocol.getComponents(prot, unwrap(graph), unwrap(context)));
990
+ }
991
+ let protVals;
992
+ const matchValue_1 = LDLabProcess.tryGetExecutesLabProtocol(p, unwrap(graph), unwrap(context));
993
+ if (matchValue_1 == null) {
994
+ protVals = empty();
995
+ }
996
+ else {
997
+ const prot_1 = matchValue_1;
998
+ protVals = toList(delay(() => {
999
+ let matchValue_2;
1000
+ return append((matchValue_2 = LDLabProtocol.tryGetNameAsString(prot_1, unwrap(context)), (matchValue_2 == null) ? (empty_1()) : singleton([new CompositeHeader(8, []), new CompositeCell(1, [matchValue_2])])), delay(() => {
1001
+ let matchValue_3;
1002
+ return append((matchValue_3 = LDLabProtocol.tryGetDescriptionAsString(prot_1, unwrap(context)), (matchValue_3 == null) ? (empty_1()) : singleton([new CompositeHeader(5, []), new CompositeCell(1, [matchValue_3])])), delay(() => {
1003
+ let matchValue_4;
1004
+ return append((matchValue_4 = LDLabProtocol.tryGetUrl(prot_1, unwrap(context)), (matchValue_4 == null) ? (empty_1()) : singleton([new CompositeHeader(6, []), new CompositeCell(1, [matchValue_4])])), delay(() => {
1005
+ let matchValue_5;
1006
+ return append((matchValue_5 = LDLabProtocol.tryGetVersionAsString(prot_1, unwrap(context)), (matchValue_5 == null) ? (empty_1()) : singleton([new CompositeHeader(7, []), new CompositeCell(1, [matchValue_5])])), delay(() => {
1007
+ const matchValue_6 = ProcessConversion_tryGetProtocolType_Z6839B9E8(prot_1, unwrap(graph), unwrap(context));
1008
+ if (matchValue_6 == null) {
1009
+ return empty_1();
1010
+ }
1011
+ else {
1012
+ return singleton([new CompositeHeader(4, []), new CompositeCell(0, [matchValue_6])]);
1013
+ }
1014
+ }));
1015
+ }));
1016
+ }));
1017
+ }));
1018
+ }));
1019
+ }
1020
+ const comments = ResizeArray_map((c) => {
1021
+ const c_1 = Comment$.fromString(c);
1022
+ return [new CompositeHeader(14, [defaultArg(c_1.Name, "")]), new CompositeCell(1, [defaultArg(c_1.Value, "")])];
1023
+ }, LDLabProcess.getDisambiguatingDescriptionsAsString(p, unwrap(context)));
1024
+ const inputs = LDLabProcess.getObjects(p, unwrap(graph), unwrap(context));
1025
+ const outputs = LDLabProcess.getResults(p, unwrap(graph), unwrap(context));
1026
+ const patternInput = ((inputs.length === 0) && (outputs.length !== 0)) ? [ResizeArray_create(outputs.length, undefined), ResizeArray_map((Value) => Value, outputs)] : (((inputs.length !== 0) && (outputs.length === 0)) ? [ResizeArray_map((Value_1) => Value_1, inputs), ResizeArray_create(inputs.length, undefined)] : [ResizeArray_map((Value_2) => Value_2, inputs), ResizeArray_map((Value_3) => Value_3, outputs)]);
1027
+ const outputs_1 = patternInput[1];
1028
+ const inputs_1 = patternInput[0];
1029
+ if ((inputs_1.length === 0) && (outputs_1.length === 0)) {
1030
+ const vals = map_2((tuple_1) => tuple_1[0], sortBy((arg) => defaultArg(arg[1], 10000), toList(delay(() => append(components, delay(() => pvs)))), {
1031
+ Compare: comparePrimitives,
1032
+ }));
1033
+ return ResizeArray_singleton(toList(delay(() => append(protVals, delay(() => append(vals, delay(() => comments)))))));
1034
+ }
1035
+ else {
1036
+ return ResizeArray_map((tupledArg) => {
1037
+ const i = tupledArg[0];
1038
+ const o = tupledArg[1];
1039
+ let chars;
1040
+ if (i == null) {
1041
+ chars = [];
1042
+ }
1043
+ else {
1044
+ const i_1 = i;
1045
+ chars = ResizeArray_map((cv) => [BaseTypes_decomposeCharacteristicValue_Z2F770004(cv, unwrap(context)), ColumnIndex_tryGetIndex(cv)], LDSample.getCharacteristics(i_1, unwrap(graph), unwrap(context)));
1046
+ }
1047
+ let factors;
1048
+ if (o == null) {
1049
+ factors = [];
1050
+ }
1051
+ else {
1052
+ const o_1 = o;
1053
+ factors = ResizeArray_map((fv) => [BaseTypes_decomposeFactorValue_Z2F770004(fv, unwrap(context)), ColumnIndex_tryGetIndex(fv)], LDSample.getFactors(o_1, unwrap(graph), unwrap(context)));
1054
+ }
1055
+ const vals_1 = map_2((tuple_3) => tuple_3[0], sortBy((arg_1) => defaultArg(arg_1[1], 10000), toList(delay(() => append(chars, delay(() => append(components, delay(() => append(pvs, delay(() => factors)))))))), {
1056
+ Compare: comparePrimitives,
1057
+ }));
1058
+ return toList(delay(() => append((i != null) ? singleton(BaseTypes_decomposeProcessInput_Z2F770004(value_4(i), unwrap(context))) : empty_1(), delay(() => append(protVals, delay(() => append(vals_1, delay(() => append(comments, delay(() => ((o != null) ? singleton(BaseTypes_decomposeProcessOutput_Z2F770004(value_4(o), unwrap(context))) : empty_1())))))))))));
1059
+ }, ResizeArray_zip(inputs_1, outputs_1));
1060
+ }
1061
+ }
1062
+
1063
+ export function CompositeRow_toProtocol(tableName, row) {
1064
+ return fold((p, hc) => {
1065
+ let matchResult, oa, v, v_1, v_2, v_3;
1066
+ switch (hc[0].tag) {
1067
+ case 4: {
1068
+ if (hc[1].tag === 0) {
1069
+ matchResult = 0;
1070
+ oa = hc[1].fields[0];
1071
+ }
1072
+ else {
1073
+ matchResult = 6;
1074
+ }
1075
+ break;
1076
+ }
1077
+ case 7: {
1078
+ if (hc[1].tag === 1) {
1079
+ matchResult = 1;
1080
+ v = hc[1].fields[0];
1081
+ }
1082
+ else {
1083
+ matchResult = 6;
1084
+ }
1085
+ break;
1086
+ }
1087
+ case 6: {
1088
+ if (hc[1].tag === 1) {
1089
+ matchResult = 2;
1090
+ v_1 = hc[1].fields[0];
1091
+ }
1092
+ else {
1093
+ matchResult = 6;
1094
+ }
1095
+ break;
1096
+ }
1097
+ case 5: {
1098
+ if (hc[1].tag === 1) {
1099
+ matchResult = 3;
1100
+ v_2 = hc[1].fields[0];
1101
+ }
1102
+ else {
1103
+ matchResult = 6;
1104
+ }
1105
+ break;
1106
+ }
1107
+ case 8: {
1108
+ if (hc[1].tag === 1) {
1109
+ matchResult = 4;
1110
+ v_3 = hc[1].fields[0];
1111
+ }
1112
+ else {
1113
+ matchResult = 6;
1114
+ }
1115
+ break;
1116
+ }
1117
+ case 0: {
1118
+ switch (hc[1].tag) {
1119
+ case 0:
1120
+ case 2: {
1121
+ matchResult = 5;
1122
+ break;
1123
+ }
1124
+ default:
1125
+ matchResult = 6;
1126
+ }
1127
+ break;
1128
+ }
1129
+ default:
1130
+ matchResult = 6;
1131
+ }
1132
+ switch (matchResult) {
1133
+ case 0: {
1134
+ LDLabProtocol.setIntendedUseAsDefinedTerm(p, BaseTypes_composeDefinedTerm_ZDED3A0F(oa));
1135
+ break;
1136
+ }
1137
+ case 1: {
1138
+ LDLabProtocol.setVersionAsString(p, v);
1139
+ break;
1140
+ }
1141
+ case 2: {
1142
+ LDLabProtocol.setUrl(p, v_1);
1143
+ break;
1144
+ }
1145
+ case 3: {
1146
+ LDLabProtocol.setDescriptionAsString(p, v_2);
1147
+ break;
1148
+ }
1149
+ case 4: {
1150
+ LDLabProtocol.setNameAsString(p, v_3);
1151
+ break;
1152
+ }
1153
+ case 5: {
1154
+ const newC = ResizeArray_appendSingleton(BaseTypes_composeComponent(hc[0], hc[1]), LDLabProtocol.getLabEquipments(p));
1155
+ LDLabProtocol.setLabEquipments(p, newC);
1156
+ break;
1157
+ }
1158
+ }
1159
+ return p;
1160
+ }, LDLabProtocol.create(tableName, tableName), row);
1161
+ }
1162
+
1163
+ /**
1164
+ * Create a new table from an ISA protocol.
1165
+ *
1166
+ * The table will have at most one row, with the protocol information and the component values
1167
+ */
1168
+ export function ARCtrl_ArcTable__ArcTable_fromProtocol_Static_Z6839B9E8(p, graph, context) {
1169
+ const name = LDLabProtocol.getNameAsString(p, unwrap(context));
1170
+ const t = ArcTable.init(name);
1171
+ let enumerator = getEnumerator(LDLabProtocol.getComponents(p, unwrap(graph), unwrap(context)));
1172
+ try {
1173
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
1174
+ const c = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
1175
+ const patternInput = BaseTypes_decomposeComponent_Z2F770004(c, unwrap(context));
1176
+ t.AddColumn(patternInput[0], singleton_1(patternInput[1]), unwrap(ARCtrl_ROCrate_LDNode__LDNode_TryGetColumnIndex(c)));
1177
+ }
1178
+ }
1179
+ finally {
1180
+ disposeSafe(enumerator);
1181
+ }
1182
+ map((d) => {
1183
+ t.AddProtocolDescriptionColumn([d]);
1184
+ }, LDLabProtocol.tryGetDescriptionAsString(p, unwrap(context)));
1185
+ map((d_1) => {
1186
+ t.AddProtocolVersionColumn([d_1]);
1187
+ }, LDLabProtocol.tryGetVersionAsString(p, unwrap(context)));
1188
+ map((d_2) => {
1189
+ t.AddProtocolTypeColumn([d_2]);
1190
+ }, ProcessConversion_tryGetProtocolType_Z6839B9E8(p, undefined, unwrap(context)));
1191
+ map((d_3) => {
1192
+ t.AddProtocolUriColumn([d_3]);
1193
+ }, LDLabProtocol.tryGetUrl(p, unwrap(context)));
1194
+ t.AddProtocolNameColumn([name]);
1195
+ return t;
1196
+ }
1197
+
1198
+ /**
1199
+ * Returns the list of protocols executed in this ArcTable
1200
+ */
1201
+ export function ARCtrl_ArcTable__ArcTable_GetProtocols(this$) {
1202
+ let source;
1203
+ if (this$.RowCount === 0) {
1204
+ return singleton_2((source = this$.Headers, fold((p, h) => {
1205
+ if (h.tag === 0) {
1206
+ const oa = h.fields[0];
1207
+ const matchValue = oa.NameText;
1208
+ const matchValue_1 = oa.TermAccessionOntobeeUrl;
1209
+ const newC = ResizeArray_appendSingleton(LDPropertyValue.createComponent(matchValue, "Empty Component Value", undefined, matchValue_1), LDLabProtocol.getLabEquipments(p));
1210
+ LDLabProtocol.setLabEquipments(p, newC);
1211
+ }
1212
+ return p;
1213
+ }, LDLabProtocol.create(createMissingIdentifier(), this$.Name), source)));
1214
+ }
1215
+ else {
1216
+ return List_distinct(initialize(this$.RowCount, (i) => {
1217
+ let row;
1218
+ const source_2 = this$.GetRow(i, true);
1219
+ row = zip(this$.Headers, source_2);
1220
+ return CompositeRow_toProtocol(this$.Name, row);
1221
+ }), {
1222
+ Equals: equals,
1223
+ GetHashCode: safeHash,
1224
+ });
1225
+ }
1226
+ }
1227
+
1228
+ /**
1229
+ * Returns the list of processes specidified in this ArcTable
1230
+ */
1231
+ export function ARCtrl_ArcTable__ArcTable_GetProcesses(this$) {
1232
+ if (this$.RowCount === 0) {
1233
+ return singleton_2(LDLabProcess.create(this$.Name));
1234
+ }
1235
+ else {
1236
+ const getter = ProcessConversion_getProcessGetter(this$.Name, this$.Headers);
1237
+ return toList(delay(() => map_1((i) => getter(this$.Values)(i), rangeDouble(0, 1, this$.RowCount - 1))));
1238
+ }
1239
+ }
1240
+
1241
+ /**
1242
+ * Create a new table from a list of processes
1243
+ *
1244
+ * The name will be used as the sheet name
1245
+ *
1246
+ * The processes SHOULD have the same headers, or even execute the same protocol
1247
+ */
1248
+ export function ARCtrl_ArcTable__ArcTable_fromProcesses_Static_Z3575FB5F(name, ps, graph, context) {
1249
+ const tupledArg = Unchecked_alignByHeaders(true, collect((p) => ofSeq(ProcessConversion_processToRows_Z6839B9E8(p, unwrap(graph), unwrap(context))), ps));
1250
+ return ArcTable.create(name, tupledArg[0], tupledArg[1]);
1251
+ }
1252
+
1253
+ /**
1254
+ * Return a list of all the processes in all the tables.
1255
+ */
1256
+ export function ARCtrl_ArcTables__ArcTables_GetProcesses(this$) {
1257
+ return collect(ARCtrl_ArcTable__ArcTable_GetProcesses, toList(this$.Tables));
1258
+ }
1259
+
1260
+ /**
1261
+ * Create a collection of tables from a list of processes.
1262
+ *
1263
+ * For this, the processes are grouped by nameroot ("nameroot_1", "nameroot_2" ...) or exectued protocol if no name exists
1264
+ *
1265
+ * Then each group is converted to a table with this nameroot as sheetname
1266
+ */
1267
+ export function ARCtrl_ArcTables__ArcTables_fromProcesses_Static_Z27F0B586(ps, graph, context) {
1268
+ let collection;
1269
+ return new ArcTables((collection = map_2((tupledArg) => {
1270
+ const tupledArg_1 = Unchecked_alignByHeaders(true, collect((p) => ofSeq(ProcessConversion_processToRows_Z6839B9E8(p, unwrap(graph), unwrap(context))), tupledArg[1]));
1271
+ return ArcTable.create(tupledArg[0], tupledArg_1[0], tupledArg_1[1]);
1272
+ }, ProcessConversion_groupProcesses_Z27F0B586(ps, unwrap(graph), unwrap(context))), Array.from(collection)));
1273
+ }
1274
+
1275
+ export class DatamapConversion {
1276
+ constructor() {
1277
+ }
1278
+ }
1279
+
1280
+ export function DatamapConversion_$reflection() {
1281
+ return class_type("ARCtrl.Conversion.DatamapConversion", undefined, DatamapConversion);
1282
+ }
1283
+
1284
+ export function DatamapConversion_composeFragmentDescriptors_Z8923FA3(datamap) {
1285
+ return ResizeArray_map(BaseTypes_composeFragmentDescriptor_Z4C0BEF62, DataMap__get_DataContexts(datamap));
1286
+ }
1287
+
1288
+ export function DatamapConversion_decomposeFragmentDescriptors_Z6E59645F(fragmentDescriptors, graph, context) {
1289
+ return DataMap_$ctor_4E3220A7(ResizeArray_map((fd) => BaseTypes_decomposeFragmentDescriptor_Z6839B9E8(fd, unwrap(graph), unwrap(context)), fragmentDescriptors));
1290
+ }
1291
+
1292
+ export class PersonConversion {
1293
+ constructor() {
1294
+ }
1295
+ }
1296
+
1297
+ export function PersonConversion_$reflection() {
1298
+ return class_type("ARCtrl.Conversion.PersonConversion", undefined, PersonConversion);
1299
+ }
1300
+
1301
+ export function PersonConversion_get_orcidKey() {
1302
+ return "ORCID";
1303
+ }
1304
+
1305
+ export function PersonConversion_composeAffiliation_Z721C83C5(affiliation) {
1306
+ try {
1307
+ const matchValue = fromString(decoder_1, affiliation);
1308
+ if (matchValue.tag === 1) {
1309
+ throw new Error(toText(printf("Error decoding string: %O"))(matchValue.fields[0]));
1310
+ }
1311
+ else {
1312
+ return matchValue.fields[0];
1313
+ }
1314
+ }
1315
+ catch (matchValue_1) {
1316
+ return LDOrganization.create(affiliation);
1317
+ }
1318
+ }
1319
+
1320
+ export function PersonConversion_decomposeAffiliation_Z2F770004(affiliation, context) {
1321
+ if (isEmpty(filter((n) => (n !== LDOrganization.name), affiliation.GetPropertyNames(unwrap(context))))) {
1322
+ return LDOrganization.getNameAsString(affiliation, unwrap(context));
1323
+ }
1324
+ else {
1325
+ return toString(0, encoder(affiliation));
1326
+ }
1327
+ }
1328
+
1329
+ export function PersonConversion_composeAddress_Z721C83C5(address) {
1330
+ let matchValue;
1331
+ try {
1332
+ return (matchValue = fromString(decoder_1, address), (matchValue.tag === 1) ? (() => {
1333
+ throw new Error(toText(printf("Error decoding string: %O"))(matchValue.fields[0]));
1334
+ })() : matchValue.fields[0]);
1335
+ }
1336
+ catch (matchValue_1) {
1337
+ return address;
1338
+ }
1339
+ }
1340
+
1341
+ export function PersonConversion_decomposeAddress_4E60E31B(address) {
1342
+ if (typeof address === "string") {
1343
+ return address;
1344
+ }
1345
+ else if (address instanceof LDNode) {
1346
+ return toString(0, encoder(address));
1347
+ }
1348
+ else {
1349
+ throw new Error("Address must be a string or a Json.LDNode");
1350
+ }
1351
+ }
1352
+
1353
+ export function PersonConversion_composePerson_Z64D846DC(person) {
1354
+ let givenName;
1355
+ const matchValue = person.FirstName;
1356
+ if (matchValue == null) {
1357
+ throw new Error("Person must have a given name");
1358
+ }
1359
+ else {
1360
+ givenName = matchValue;
1361
+ }
1362
+ const jobTitles = Option_fromSeq(ResizeArray_map(BaseTypes_composeDefinedTerm_ZDED3A0F, person.Roles));
1363
+ const disambiguatingDescriptions = Option_fromSeq(ResizeArray_map(toString_1, person.Comments));
1364
+ const address_1 = map(PersonConversion_composeAddress_Z721C83C5, person.Address);
1365
+ const affiliation_1 = map(PersonConversion_composeAffiliation_Z721C83C5, person.Affiliation);
1366
+ return LDPerson.create(givenName, unwrap(person.ORCID), undefined, unwrap(affiliation_1), unwrap(person.EMail), unwrap(person.LastName), undefined, unwrap(jobTitles), unwrap(person.MidInitials), address_1, unwrap(disambiguatingDescriptions), unwrap(person.Fax), unwrap(person.Phone));
1367
+ }
1368
+
1369
+ export function PersonConversion_decomposePerson_Z6839B9E8(person, graph, context) {
1370
+ const orcid = tryGetOrcidNumber(person.Id);
1371
+ let address;
1372
+ const matchValue = LDPerson.tryGetAddressAsString(person, unwrap(context));
1373
+ if (matchValue == null) {
1374
+ const matchValue_1 = LDPerson.tryGetAddressAsPostalAddress(person, unwrap(graph), unwrap(context));
1375
+ address = ((matchValue_1 == null) ? undefined : PersonConversion_decomposeAddress_4E60E31B(matchValue_1));
1376
+ }
1377
+ else {
1378
+ address = matchValue;
1379
+ }
1380
+ const roles = ResizeArray_map((r) => BaseTypes_decomposeDefinedTerm_Z2F770004(r, unwrap(context)), LDPerson.getJobTitlesAsDefinedTerm(person, unwrap(graph), unwrap(context)));
1381
+ const comments = ResizeArray_map((s_1) => Comment$.fromString(s_1), LDPerson.getDisambiguatingDescriptionsAsString(person, unwrap(context)));
1382
+ const affiliation = map((a_3) => PersonConversion_decomposeAffiliation_Z2F770004(a_3, unwrap(context)), LDPerson.tryGetAffiliation(person, unwrap(graph), unwrap(context)));
1383
+ return Person.create(unwrap(orcid), unwrap(LDPerson.tryGetFamilyNameAsString(person, unwrap(context))), LDPerson.getGivenNameAsString(person, unwrap(context)), unwrap(LDPerson.tryGetAdditionalNameAsString(person, unwrap(context))), unwrap(LDPerson.tryGetEmailAsString(person, unwrap(context))), unwrap(LDPerson.tryGetTelephoneAsString(person, unwrap(context))), unwrap(LDPerson.tryGetFaxNumberAsString(person, unwrap(context))), unwrap(address), unwrap(affiliation), roles, comments);
1384
+ }
1385
+
1386
+ export class ScholarlyArticleConversion {
1387
+ constructor() {
1388
+ }
1389
+ }
1390
+
1391
+ export function ScholarlyArticleConversion_$reflection() {
1392
+ return class_type("ARCtrl.Conversion.ScholarlyArticleConversion", undefined, ScholarlyArticleConversion);
1393
+ }
1394
+
1395
+ export function ScholarlyArticleConversion_composeAuthor_Z721C83C5(author) {
1396
+ try {
1397
+ const matchValue = fromString(decoder_1, author);
1398
+ if (matchValue.tag === 1) {
1399
+ throw new Error(toText(printf("Error decoding string: %O"))(matchValue.fields[0]));
1400
+ }
1401
+ else {
1402
+ return matchValue.fields[0];
1403
+ }
1404
+ }
1405
+ catch (matchValue_1) {
1406
+ return LDPerson.create(author);
1407
+ }
1408
+ }
1409
+
1410
+ export function ScholarlyArticleConversion_splitAuthors_Z721C83C5(a) {
1411
+ let bracketCount = 0;
1412
+ const authors = [];
1413
+ const sb = StringBuilder_$ctor();
1414
+ const enumerator = getEnumerator(a.split(""));
1415
+ try {
1416
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
1417
+ const c = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
1418
+ switch (c) {
1419
+ case "{": {
1420
+ bracketCount = ((bracketCount + 1) | 0);
1421
+ StringBuilder__Append_244C7CD6(sb, c);
1422
+ break;
1423
+ }
1424
+ case "}": {
1425
+ bracketCount = ((bracketCount - 1) | 0);
1426
+ StringBuilder__Append_244C7CD6(sb, c);
1427
+ break;
1428
+ }
1429
+ default:
1430
+ if ((c === ",") && (bracketCount === 0)) {
1431
+ void (authors.push(toString_1(sb)));
1432
+ StringBuilder__Clear(sb);
1433
+ }
1434
+ else {
1435
+ StringBuilder__Append_244C7CD6(sb, c);
1436
+ }
1437
+ }
1438
+ }
1439
+ }
1440
+ finally {
1441
+ disposeSafe(enumerator);
1442
+ }
1443
+ void (authors.push(toString_1(sb)));
1444
+ return authors;
1445
+ }
1446
+
1447
+ export function ScholarlyArticleConversion_composeAuthors_Z721C83C5(authors) {
1448
+ const collection = map_1(ScholarlyArticleConversion_composeAuthor_Z721C83C5, ScholarlyArticleConversion_splitAuthors_Z721C83C5(authors));
1449
+ return Array.from(collection);
1450
+ }
1451
+
1452
+ export function ScholarlyArticleConversion_decomposeAuthor_Z2F770004(author, context) {
1453
+ if (isEmpty(filter((n) => (n !== LDPerson.givenName), author.GetPropertyNames(unwrap(context))))) {
1454
+ return LDPerson.getGivenNameAsString(author, unwrap(context));
1455
+ }
1456
+ else {
1457
+ return toString(0, encoder(author));
1458
+ }
1459
+ }
1460
+
1461
+ export function ScholarlyArticleConversion_decomposeAuthors_1AAAE9A5(authors, context) {
1462
+ return join(",", ResizeArray_map((a) => ScholarlyArticleConversion_decomposeAuthor_Z2F770004(a, unwrap(context)), authors));
1463
+ }
1464
+
1465
+ export function ScholarlyArticleConversion_composeScholarlyArticle_D324A6D(publication) {
1466
+ let title;
1467
+ const matchValue = publication.Title;
1468
+ if (matchValue == null) {
1469
+ throw new Error("Publication must have a title");
1470
+ }
1471
+ else {
1472
+ title = matchValue;
1473
+ }
1474
+ const authors_1 = map(ScholarlyArticleConversion_composeAuthors_Z721C83C5, publication.Authors);
1475
+ const comments = Option_fromSeq(ResizeArray_map(BaseTypes_composeComment_Z13201A7E, publication.Comments));
1476
+ const identifiers = Array.from(toList(delay(() => append(((publication.DOI != null) && (value_4(publication.DOI) !== "")) ? singleton(LDPropertyValue.createDOI(value_4(publication.DOI))) : empty_1(), delay(() => (((publication.PubMedID != null) && (value_4(publication.PubMedID) !== "")) ? singleton(LDPropertyValue.createPubMedID(value_4(publication.PubMedID))) : empty_1()))))));
1477
+ const status = map(BaseTypes_composeDefinedTerm_ZDED3A0F, publication.Status);
1478
+ return LDScholarlyArticle.create(title, identifiers, undefined, unwrap(authors_1), undefined, unwrap(status), unwrap(comments));
1479
+ }
1480
+
1481
+ export function ScholarlyArticleConversion_decomposeScholarlyArticle_Z6839B9E8(sa, graph, context) {
1482
+ const title = LDScholarlyArticle.getHeadlineAsString(sa, unwrap(context));
1483
+ const authors = map((a) => ScholarlyArticleConversion_decomposeAuthors_1AAAE9A5(a, unwrap(context)), Option_fromSeq(LDScholarlyArticle.getAuthors(sa, unwrap(graph), unwrap(context))));
1484
+ const comments = ResizeArray_map((c) => BaseTypes_decomposeComment_Z2F770004(c, unwrap(context)), LDScholarlyArticle.getComments(sa, unwrap(graph), unwrap(context)));
1485
+ const status = map((s) => BaseTypes_decomposeDefinedTerm_Z2F770004(s, unwrap(context)), LDScholarlyArticle.tryGetCreativeWorkStatus(sa, unwrap(graph), unwrap(context)));
1486
+ const identifiers = LDScholarlyArticle.getIdentifiersAsPropertyValue(sa, unwrap(graph), unwrap(context));
1487
+ let doi;
1488
+ const _arg = ResizeArray_tryPick((i) => LDPropertyValue.tryGetAsDOI(i, unwrap(context)), identifiers);
1489
+ doi = ((_arg == null) ? LDScholarlyArticle.tryGetSameAsAsString(sa, unwrap(context)) : _arg);
1490
+ let pubMedID;
1491
+ const _arg_1 = ResizeArray_tryPick((i_1) => LDPropertyValue.tryGetAsPubMedID(i_1, unwrap(context)), identifiers);
1492
+ pubMedID = ((_arg_1 == null) ? LDScholarlyArticle.tryGetUrlAsString(sa, unwrap(context)) : _arg_1);
1493
+ return Publication.create(unwrap(pubMedID), unwrap(doi), unwrap(authors), title, unwrap(status), comments);
1494
+ }
1495
+
1496
+ export class AssayConversion {
1497
+ constructor() {
1498
+ }
1499
+ }
1500
+
1501
+ export function AssayConversion_$reflection() {
1502
+ return class_type("ARCtrl.Conversion.AssayConversion", undefined, AssayConversion);
1503
+ }
1504
+
1505
+ export function AssayConversion_getDataFilesFromProcesses_6BABD1B0(processes, fragmentDescriptors, graph, context) {
1506
+ const data = ResizeArray_distinct(ResizeArray_append(ResizeArray_choose((df) => LDPropertyValue.tryGetSubjectOf(df, unwrap(graph), unwrap(context)), defaultArg(fragmentDescriptors, [])), ResizeArray_collect((p) => ResizeArray_append(LDLabProcess.getObjectsAsData(p, unwrap(graph), unwrap(context)), LDLabProcess.getResultsAsData(p, unwrap(graph), unwrap(context))), processes)));
1507
+ const files = ResizeArray_filter((d) => (DataAux_pathAndSelectorFromName(d.Id)[1] == null), data);
1508
+ return ResizeArray_append(files, ResizeArray_map((tupledArg) => {
1509
+ const path = tupledArg[0];
1510
+ const fragments = tupledArg[1];
1511
+ let file;
1512
+ const matchValue = ResizeArray_tryFind((d_3) => (d_3.Id === path), files);
1513
+ if (matchValue == null) {
1514
+ const comments = Option_fromSeq(LDFile.getComments(fragments[0], unwrap(graph), unwrap(context)));
1515
+ file = LDFile.create(path, path, unwrap(comments), unwrap(LDFile.tryGetDisambiguatingDescriptionAsString(fragments[0], unwrap(context))), unwrap(LDFile.tryGetEncodingFormatAsString(fragments[0], unwrap(context))), undefined, unwrap(fragments[0].TryGetContext()));
1516
+ }
1517
+ else {
1518
+ file = matchValue;
1519
+ }
1520
+ LDDataset.setHasParts(file, fragments, unwrap(context));
1521
+ return file;
1522
+ }, ResizeArray_groupBy((d_2) => DataAux_pathAndSelectorFromName(d_2.Id)[0], ResizeArray_filter((d_1) => (DataAux_pathAndSelectorFromName(d_1.Id)[1] != null), data))));
1523
+ }
1524
+
1525
+ export function AssayConversion_composeAssay_1501C0F8(assay) {
1526
+ let collection, fds_1, vm_1, fds, vm;
1527
+ const measurementMethod = map(BaseTypes_composeDefinedTerm_ZDED3A0F, assay.TechnologyType);
1528
+ const measurementTechnique = map(BaseTypes_composeDefinedTerm_ZDED3A0F, assay.TechnologyPlatform);
1529
+ const variableMeasured = map(BaseTypes_composePropertyValueFromOA_ZDED3A0F, assay.MeasurementType);
1530
+ const creators = Option_fromSeq(ResizeArray_map(PersonConversion_composePerson_Z64D846DC, assay.Performers));
1531
+ const processSequence = Option_fromSeq((collection = ARCtrl_ArcTables__ArcTables_GetProcesses(new ArcTables(assay.Tables)), Array.from(collection)));
1532
+ const fragmentDescriptors = map(DatamapConversion_composeFragmentDescriptors_Z8923FA3, assay.DataMap);
1533
+ const dataFiles = map((ps) => AssayConversion_getDataFilesFromProcesses_6BABD1B0(ps, unwrap(fragmentDescriptors)), processSequence);
1534
+ const variableMeasureds = (variableMeasured == null) ? ((fragmentDescriptors == null) ? undefined : ((fds_1 = fragmentDescriptors, fds_1))) : ((fragmentDescriptors == null) ? ((vm_1 = variableMeasured, ResizeArray_singleton(vm_1))) : ((fds = fragmentDescriptors, (vm = variableMeasured, ResizeArray_appendSingleton(vm, fds)))));
1535
+ const comments = Option_fromSeq(ResizeArray_map(BaseTypes_composeComment_Z13201A7E, assay.Comments));
1536
+ return LDDataset.createAssay(assay.Identifier, undefined, undefined, unwrap(creators), unwrap(dataFiles), unwrap(measurementMethod), unwrap(measurementTechnique), unwrap(variableMeasureds), unwrap(processSequence), unwrap(comments));
1537
+ }
1538
+
1539
+ export function AssayConversion_decomposeAssay_Z6839B9E8(assay, graph, context) {
1540
+ const measurementMethod = map((m) => BaseTypes_decomposeDefinedTerm_Z2F770004(m, unwrap(context)), LDDataset.tryGetMeasurementMethodAsDefinedTerm(assay, unwrap(graph), unwrap(context)));
1541
+ const measurementTechnique = map((m_1) => BaseTypes_decomposeDefinedTerm_Z2F770004(m_1, unwrap(context)), LDDataset.tryGetMeasurementTechniqueAsDefinedTerm(assay, unwrap(graph), unwrap(context)));
1542
+ const variableMeasured = map((v) => BaseTypes_decomposePropertyValueToOA_Z2F770004(v, unwrap(context)), LDDataset.tryGetVariableMeasuredAsMeasurementType(assay, unwrap(graph), unwrap(context)));
1543
+ const perfomers = ResizeArray_map((c) => PersonConversion_decomposePerson_Z6839B9E8(c, unwrap(graph), unwrap(context)), LDDataset.getCreators(assay, unwrap(graph), unwrap(context)));
1544
+ let dataMap;
1545
+ const v_1 = DatamapConversion_decomposeFragmentDescriptors_Z6E59645F(LDDataset.getVariableMeasuredAsFragmentDescriptors(assay, unwrap(graph), unwrap(context)), unwrap(graph), unwrap(context));
1546
+ dataMap = Option_fromValueWithDefault(DataMap_init(), v_1);
1547
+ const tables = ARCtrl_ArcTables__ArcTables_fromProcesses_Static_Z27F0B586(ofSeq(LDDataset.getAboutsAsLabProcess(assay, unwrap(graph), unwrap(context))), unwrap(graph), unwrap(context));
1548
+ const comments = ResizeArray_map((c_1) => BaseTypes_decomposeComment_Z2F770004(c_1, unwrap(context)), LDDataset.getComments(assay, unwrap(graph), unwrap(context)));
1549
+ return ArcAssay.create(LDDataset.getIdentifierAsString(assay, unwrap(context)), unwrap(variableMeasured), unwrap(measurementMethod), unwrap(measurementTechnique), tables.Tables, unwrap(dataMap), perfomers, comments);
1550
+ }
1551
+
1552
+ export class StudyConversion {
1553
+ constructor() {
1554
+ }
1555
+ }
1556
+
1557
+ export function StudyConversion_$reflection() {
1558
+ return class_type("ARCtrl.Conversion.StudyConversion", undefined, StudyConversion);
1559
+ }
1560
+
1561
+ export function StudyConversion_composeStudy_1680536E(study) {
1562
+ let collection;
1563
+ const dateCreated = bind(DateTime_tryFromString, study.SubmissionDate);
1564
+ const datePublished = bind(DateTime_tryFromString, study.PublicReleaseDate);
1565
+ const dateModified = now();
1566
+ const publications = Option_fromSeq(ResizeArray_map(ScholarlyArticleConversion_composeScholarlyArticle_D324A6D, study.Publications));
1567
+ const creators = Option_fromSeq(ResizeArray_map(PersonConversion_composePerson_Z64D846DC, study.Contacts));
1568
+ const processSequence = Option_fromSeq((collection = ARCtrl_ArcTables__ArcTables_GetProcesses(new ArcTables(study.Tables)), Array.from(collection)));
1569
+ const fragmentDescriptors = map(DatamapConversion_composeFragmentDescriptors_Z8923FA3, study.DataMap);
1570
+ const dataFiles = map((ps) => AssayConversion_getDataFilesFromProcesses_6BABD1B0(ps, unwrap(fragmentDescriptors)), processSequence);
1571
+ const comments = Option_fromSeq(ResizeArray_map(BaseTypes_composeComment_Z13201A7E, study.Comments));
1572
+ return LDDataset.createStudy(study.Identifier, undefined, unwrap(creators), unwrap(dateCreated), unwrap(datePublished), dateModified, unwrap(study.Description), unwrap(dataFiles), unwrap(study.Title), unwrap(publications), unwrap(fragmentDescriptors), unwrap(comments), undefined, unwrap(processSequence));
1573
+ }
1574
+
1575
+ export function StudyConversion_decomposeStudy_Z6839B9E8(study, graph, context) {
1576
+ const dateCreated = map(DateTime_toString, LDDataset.tryGetDateCreatedAsDateTime(study, unwrap(context)));
1577
+ const datePublished = map(DateTime_toString, LDDataset.tryGetDatePublishedAsDateTime(study, unwrap(context)));
1578
+ const publications = ResizeArray_map((p) => ScholarlyArticleConversion_decomposeScholarlyArticle_Z6839B9E8(p, unwrap(graph), unwrap(context)), LDDataset.getCitations(study, unwrap(graph), unwrap(context)));
1579
+ const creators = ResizeArray_map((c) => PersonConversion_decomposePerson_Z6839B9E8(c, unwrap(graph), unwrap(context)), LDDataset.getCreators(study, unwrap(graph), unwrap(context)));
1580
+ let dataMap;
1581
+ const v = DatamapConversion_decomposeFragmentDescriptors_Z6E59645F(LDDataset.getVariableMeasuredAsFragmentDescriptors(study, unwrap(graph), unwrap(context)), unwrap(graph), unwrap(context));
1582
+ dataMap = Option_fromValueWithDefault(DataMap_init(), v);
1583
+ const tables = ARCtrl_ArcTables__ArcTables_fromProcesses_Static_Z27F0B586(ofSeq(LDDataset.getAboutsAsLabProcess(study, unwrap(graph), unwrap(context))), unwrap(graph), unwrap(context));
1584
+ const comments = ResizeArray_map((c_1) => BaseTypes_decomposeComment_Z2F770004(c_1, unwrap(context)), LDDataset.getComments(study, unwrap(graph), unwrap(context)));
1585
+ return ArcStudy.create(LDDataset.getIdentifierAsString(study, unwrap(context)), unwrap(LDDataset.tryGetNameAsString(study, unwrap(context))), unwrap(LDDataset.tryGetDescriptionAsString(study, unwrap(context))), unwrap(dateCreated), unwrap(datePublished), publications, creators, undefined, tables.Tables, unwrap(dataMap), undefined, comments);
1586
+ }
1587
+
1588
+ export class InvestigationConversion {
1589
+ constructor() {
1590
+ }
1591
+ }
1592
+
1593
+ export function InvestigationConversion_$reflection() {
1594
+ return class_type("ARCtrl.Conversion.InvestigationConversion", undefined, InvestigationConversion);
1595
+ }
1596
+
1597
+ export function InvestigationConversion_composeInvestigation_Z720BD3FF(investigation) {
1598
+ let b;
1599
+ let name;
1600
+ const matchValue = investigation.Title;
1601
+ if (matchValue == null) {
1602
+ throw new Error("Investigation must have a title");
1603
+ }
1604
+ else {
1605
+ name = matchValue;
1606
+ }
1607
+ const dateCreated = bind(DateTime_tryFromString, investigation.SubmissionDate);
1608
+ const datePublished = defaultArg(bind(DateTime_tryFromString, investigation.PublicReleaseDate), now());
1609
+ const publications = Option_fromSeq(ResizeArray_map(ScholarlyArticleConversion_composeScholarlyArticle_D324A6D, investigation.Publications));
1610
+ const creators = Option_fromSeq(ResizeArray_map(PersonConversion_composePerson_Z64D846DC, investigation.Contacts));
1611
+ const comments = Option_fromSeq(ResizeArray_map(BaseTypes_composeComment_Z13201A7E, investigation.Comments));
1612
+ const hasParts = Option_fromSeq((b = ResizeArray_map(AssayConversion_composeAssay_1501C0F8, investigation.Assays), ResizeArray_append(ResizeArray_map(StudyConversion_composeStudy_1680536E, investigation.Studies), b)));
1613
+ const mentions = Option_fromSeq([]);
1614
+ return LDDataset.createInvestigation(investigation.Identifier, name, undefined, unwrap(creators), unwrap(dateCreated), datePublished, undefined, unwrap(investigation.Description), unwrap(hasParts), unwrap(publications), unwrap(comments), unwrap(mentions));
1615
+ }
1616
+
1617
+ export function InvestigationConversion_decomposeInvestigation_Z6839B9E8(investigation, graph, context) {
1618
+ let title;
1619
+ const matchValue = LDDataset.tryGetNameAsString(investigation, unwrap(context));
1620
+ title = ((matchValue == null) ? LDDataset.tryGetHeadlineAsString(investigation, unwrap(context)) : matchValue);
1621
+ const dateCreated = map(DateTime_toString, LDDataset.tryGetDateCreatedAsDateTime(investigation, unwrap(context)));
1622
+ const datePublished = map(DateTime_toString, LDDataset.tryGetDatePublishedAsDateTime(investigation, unwrap(context)));
1623
+ const publications = ResizeArray_map((p) => ScholarlyArticleConversion_decomposeScholarlyArticle_Z6839B9E8(p, unwrap(graph), unwrap(context)), LDDataset.getCitations(investigation, unwrap(graph), unwrap(context)));
1624
+ const creators = ResizeArray_map((c) => PersonConversion_decomposePerson_Z6839B9E8(c, unwrap(graph), unwrap(context)), LDDataset.getCreators(investigation, unwrap(graph), unwrap(context)));
1625
+ const datasets = LDDataset.getHasPartsAsDataset(investigation, unwrap(graph), unwrap(context));
1626
+ const studies = ResizeArray_map((d_3) => StudyConversion_decomposeStudy_Z6839B9E8(d_3, unwrap(graph), unwrap(context)), ResizeArray_filter((d_2) => LDDataset.validateStudy(d_2, unwrap(context)), datasets));
1627
+ const assays = ResizeArray_map((d_5) => AssayConversion_decomposeAssay_Z6839B9E8(d_5, unwrap(graph), unwrap(context)), ResizeArray_filter((d_4) => LDDataset.validateAssay(d_4, unwrap(context)), datasets));
1628
+ const comments = ResizeArray_map((c_1) => BaseTypes_decomposeComment_Z2F770004(c_1, unwrap(context)), LDDataset.getComments(investigation, unwrap(graph), unwrap(context)));
1629
+ return ArcInvestigation.create(LDDataset.getIdentifierAsString(investigation, unwrap(context)), unwrap(title), unwrap(LDDataset.tryGetDescriptionAsString(investigation, unwrap(context))), unwrap(dateCreated), unwrap(datePublished), undefined, publications, creators, assays, studies, undefined, comments);
1630
+ }
1631
+
1632
+ export function ARCtrl_ArcAssay__ArcAssay_ToROCrateAssay(this$) {
1633
+ return AssayConversion_composeAssay_1501C0F8(this$);
1634
+ }
1635
+
1636
+ export function ARCtrl_ArcAssay__ArcAssay_fromROCrateAssay_Static_Z6839B9E8(a, graph, context) {
1637
+ return AssayConversion_decomposeAssay_Z6839B9E8(a, unwrap(graph), unwrap(context));
1638
+ }
1639
+
1640
+ export function ARCtrl_ArcStudy__ArcStudy_ToROCrateStudy(this$) {
1641
+ return StudyConversion_composeStudy_1680536E(this$);
1642
+ }
1643
+
1644
+ export function ARCtrl_ArcStudy__ArcStudy_fromROCrateStudy_Static_Z6839B9E8(a, graph, context) {
1645
+ return StudyConversion_decomposeStudy_Z6839B9E8(a, unwrap(graph), unwrap(context));
1646
+ }
1647
+
1648
+ export function ARCtrl_ArcInvestigation__ArcInvestigation_ToROCrateInvestigation(this$) {
1649
+ return InvestigationConversion_composeInvestigation_Z720BD3FF(this$);
1650
+ }
1651
+
1652
+ export function ARCtrl_ArcInvestigation__ArcInvestigation_fromROCrateInvestigation_Static_Z6839B9E8(a, graph, context) {
1653
+ return InvestigationConversion_decomposeInvestigation_Z6839B9E8(a, unwrap(graph), unwrap(context));
1654
+ }
1655
+
1656
+ export function ARCtrl_ROCrate_Dataset__Dataset_toArcAssay_Static_Z6839B9E8(a, graph, context) {
1657
+ return AssayConversion_decomposeAssay_Z6839B9E8(a, unwrap(graph), unwrap(context));
1658
+ }
1659
+
1660
+ export function ARCtrl_ROCrate_Dataset__Dataset_fromArcAssay_Static_1501C0F8(a) {
1661
+ return AssayConversion_composeAssay_1501C0F8(a);
1662
+ }
1663
+
1664
+ export function ARCtrl_ROCrate_Dataset__Dataset_toArcStudy_Static_Z6839B9E8(a, graph, context) {
1665
+ return StudyConversion_decomposeStudy_Z6839B9E8(a, unwrap(graph), unwrap(context));
1666
+ }
1667
+
1668
+ export function ARCtrl_ROCrate_Dataset__Dataset_fromArcStudy_Static_1680536E(a) {
1669
+ return StudyConversion_composeStudy_1680536E(a);
1670
+ }
1671
+
1672
+ export function ARCtrl_ROCrate_Dataset__Dataset_toArcInvestigation_Static_Z6839B9E8(a, graph, context) {
1673
+ return InvestigationConversion_decomposeInvestigation_Z6839B9E8(a, unwrap(graph), unwrap(context));
1674
+ }
1675
+
1676
+ export function ARCtrl_ROCrate_Dataset__Dataset_fromArcInvestigation_Static_Z720BD3FF(a) {
1677
+ return InvestigationConversion_composeInvestigation_Z720BD3FF(a);
1678
+ }
1679
+