@nfdi4plants/arctrl 2.3.1 → 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 (90) 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/Core/Table/ArcTable.js +6 -0
  18. package/Core/Table/CompositeHeader.js +4 -0
  19. package/Json/Assay.js +1 -1
  20. package/Json/Decode.js +3 -3
  21. package/Json/Encode.js +9 -0
  22. package/Json/Investigation.js +5 -4
  23. package/Json/OntologySourceReference.js +4 -4
  24. package/Json/ROCrate/LDContext.js +121 -0
  25. package/Json/ROCrate/LDGraph.js +87 -0
  26. package/Json/{LDObject.js → ROCrate/LDNode.js} +55 -46
  27. package/Json/ROCrate/LDRef.js +25 -0
  28. package/Json/ROCrate/LDValue.js +66 -0
  29. package/Json/Study.js +5 -4
  30. package/Json/context/rocrate/isa_investigation_context.js +2 -2
  31. package/Json/context/rocrate/isa_study_context.js +15 -11
  32. package/Json/context/rocrate/rocrate_context.js +1 -1
  33. package/JsonIO/LDObject.js +30 -5
  34. package/README.md +12 -3
  35. package/ROCrate/ArcROCrateMetadata.js +14 -13
  36. package/ROCrate/Generic/Comment.js +115 -0
  37. package/ROCrate/Generic/Dataset.js +669 -0
  38. package/ROCrate/Generic/DefinedTerm.js +115 -0
  39. package/ROCrate/Generic/File.js +200 -0
  40. package/ROCrate/Generic/LabProcess.js +238 -0
  41. package/ROCrate/Generic/LabProtocol.js +275 -0
  42. package/ROCrate/Generic/Organization.js +71 -0
  43. package/ROCrate/Generic/Person.js +411 -0
  44. package/ROCrate/Generic/PostalAddress.js +159 -0
  45. package/ROCrate/Generic/PropertyValue.js +548 -0
  46. package/ROCrate/Generic/Sample.js +139 -0
  47. package/ROCrate/Generic/ScholarlyArticle.js +187 -0
  48. package/ROCrate/Helper.js +6 -0
  49. package/ROCrate/ISAProfile/Assay.js +3 -3
  50. package/ROCrate/ISAProfile/Data.js +7 -7
  51. package/ROCrate/ISAProfile/Dataset.js +7 -6
  52. package/ROCrate/ISAProfile/Investigation.js +3 -3
  53. package/ROCrate/ISAProfile/LabProcess.js +7 -7
  54. package/ROCrate/ISAProfile/LabProtocol.js +7 -7
  55. package/ROCrate/ISAProfile/Person.js +7 -7
  56. package/ROCrate/ISAProfile/PropertyValue.js +7 -7
  57. package/ROCrate/ISAProfile/Sample.js +7 -7
  58. package/ROCrate/ISAProfile/ScholarlyArticle.js +7 -7
  59. package/ROCrate/ISAProfile/Study.js +3 -3
  60. package/ROCrate/LDContext.js +283 -0
  61. package/ROCrate/LDObject.js +902 -36
  62. package/ROCrate/ROCrateContext.js +44 -0
  63. package/ROCrateIO.js +62 -0
  64. package/Spreadsheet/DataMap.js +11 -3
  65. package/Spreadsheet/DataMapTable/DataMapHeader.js +3 -2
  66. package/Xlsx.js +21 -8
  67. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynObj.fs +31 -1
  68. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynObj.fs.js +30 -1
  69. package/fable_modules/DynamicObj.7.0.1/DynamicObj.fs +1025 -0
  70. package/fable_modules/DynamicObj.7.0.1/DynamicObj.fs.js +433 -0
  71. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FableJS.fs +16 -0
  72. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FablePy.fs +14 -0
  73. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/HashCodes.fs +15 -0
  74. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/HashCodes.fs.js +4 -0
  75. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Debug/netstandard2.0/DynamicObj.AssemblyInfo.fs +1 -1
  76. package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Release/netstandard2.0/DynamicObj.AssemblyInfo.fs +3 -3
  77. package/fable_modules/project_cracked.json +1 -1
  78. package/package.json +1 -1
  79. package/Json/ARC.js +0 -31
  80. package/JsonIO/ARC.js +0 -31
  81. package/fable_modules/DynamicObj.4.0.3/DynamicObj.fs +0 -310
  82. package/fable_modules/DynamicObj.4.0.3/DynamicObj.fs.js +0 -166
  83. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynamicObj.fableproj +0 -0
  84. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FableJS.fs.js +0 -0
  85. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/PropertyHelper.fs +0 -0
  86. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/PropertyHelper.fs.js +0 -0
  87. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/ReflectionUtils.fs +0 -0
  88. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/ReflectionUtils.fs.js +0 -0
  89. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
  90. /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
@@ -1,27 +1,254 @@
1
- import { DynamicObj_$reflection, DynamicObj } from "../fable_modules/DynamicObj.4.0.3/DynamicObj.fs.js";
1
+ import { isArrayLike, structuralHash, curry2, getEnumerator, defaultOf, stringHash, identityHash, equals, isIterable } from "../fable_modules/fable-library-js.4.24.0/Util.js";
2
+ import { mergeHashes } from "../fable_modules/DynamicObj.7.0.1/HashCodes.fs.js";
3
+ import { map, some, value as value_3, unwrap, defaultArg } from "../fable_modules/fable-library-js.4.24.0/Option.js";
2
4
  import { class_type } from "../fable_modules/fable-library-js.4.24.0/Reflection.js";
3
- import { value as value_1, unwrap } from "../fable_modules/fable-library-js.4.24.0/Option.js";
5
+ import { addToDict, tryGetValue, getItemFromDict } from "../fable_modules/fable-library-js.4.24.0/MapUtil.js";
6
+ import { FSharpRef } from "../fable_modules/fable-library-js.4.24.0/Types.js";
7
+ import { LDContext } from "./LDContext.js";
8
+ import { collect, append, enumerateFromFunctions, map as map_1, tryFind, empty, singleton as singleton_2, enumerateWhile, delay, toList, exists, choose, filter as filter_2, iterate } from "../fable_modules/fable-library-js.4.24.0/Seq.js";
9
+ import { DynamicObj_$reflection, DynamicObj } from "../fable_modules/DynamicObj.7.0.1/DynamicObj.fs.js";
10
+ import { ResizeArray_map } from "../Core/Helper/Collections.js";
11
+ import { List_distinctBy } from "../fable_modules/fable-library-js.4.24.0/Seq2.js";
4
12
 
5
- export class LDContext extends DynamicObj {
6
- constructor() {
13
+ export function ActivePattern_$007CNonStringEnumerable$007C_$007C(o) {
14
+ if (typeof o === "string") {
15
+ return undefined;
16
+ }
17
+ else if (isIterable(o)) {
18
+ return o;
19
+ }
20
+ else {
21
+ return undefined;
22
+ }
23
+ }
24
+
25
+ export function DynamicObj_DynamicObj__DynamicObj_HasProperty_Z721C83C5(this$, propertyName) {
26
+ return this$.TryGetPropertyValue(propertyName) != null;
27
+ }
28
+
29
+ export class LDValue {
30
+ constructor(value, valueType) {
31
+ this["valueType@54"] = defaultArg(valueType, "string");
32
+ this["value@55"] = value;
33
+ }
34
+ get Value() {
35
+ const this$ = this;
36
+ return this$["value@55"];
37
+ }
38
+ set Value(v) {
39
+ const this$ = this;
40
+ this$["value@55"] = v;
41
+ }
42
+ get ValueType() {
43
+ const this$ = this;
44
+ return this$["valueType@54"];
45
+ }
46
+ set ValueType(v) {
47
+ const this$ = this;
48
+ this$["valueType@54"] = v;
49
+ }
50
+ Equals(other) {
51
+ let other_1;
52
+ const this$ = this;
53
+ return (other instanceof LDValue) && ((other_1 = other, equals(this$.Value, other_1.Value)));
54
+ }
55
+ GetHashCode() {
56
+ const this$ = this;
57
+ return mergeHashes(123, identityHash(this$.Value)) | 0;
58
+ }
59
+ }
60
+
61
+ export function LDValue_$reflection() {
62
+ return class_type("ARCtrl.ROCrate.LDValue", undefined, LDValue);
63
+ }
64
+
65
+ export function LDValue_$ctor_77809003(value, valueType) {
66
+ return new LDValue(value, valueType);
67
+ }
68
+
69
+ export class LDRef {
70
+ constructor(id) {
71
+ this["id@75"] = id;
72
+ }
73
+ get Id() {
74
+ const this$ = this;
75
+ return this$["id@75"];
76
+ }
77
+ set Id(v) {
78
+ const this$ = this;
79
+ this$["id@75"] = v;
80
+ }
81
+ Equals(other) {
82
+ let other_1;
83
+ const this$ = this;
84
+ return (other instanceof LDRef) && ((other_1 = other, this$.Id === other_1.Id));
85
+ }
86
+ GetHashCode() {
87
+ const this$ = this;
88
+ return mergeHashes(123, stringHash(this$.Id)) | 0;
89
+ }
90
+ }
91
+
92
+ export function LDRef_$reflection() {
93
+ return class_type("ARCtrl.ROCrate.LDRef", undefined, LDRef);
94
+ }
95
+
96
+ export function LDRef_$ctor_Z721C83C5(id) {
97
+ return new LDRef(id);
98
+ }
99
+
100
+ export class LDGraph extends DynamicObj {
101
+ constructor(id, nodes, context) {
7
102
  super();
103
+ const this$ = new FSharpRef(defaultOf());
104
+ this$.contents = this;
105
+ this["id@94"] = id;
106
+ this.mappings = (new Map([]));
107
+ this["init@90"] = 1;
108
+ if (context == null) {
109
+ }
110
+ else {
111
+ const ctx = context;
112
+ this$.contents.SetContext(ctx);
113
+ }
114
+ if (nodes == null) {
115
+ }
116
+ else {
117
+ iterate((node) => {
118
+ addToDict(this.mappings, node.Id, node);
119
+ }, nodes);
120
+ }
121
+ }
122
+ get Id() {
123
+ const this$ = this;
124
+ return unwrap(this$["id@94"]);
125
+ }
126
+ set Id(v) {
127
+ const this$ = this;
128
+ this$["id@94"] = v;
129
+ }
130
+ get Nodes() {
131
+ const this$ = this;
132
+ const collection = this$.mappings.values();
133
+ return Array.from(collection);
134
+ }
135
+ ContainsNode(id) {
136
+ const this$ = this;
137
+ return this$.mappings.has(id);
138
+ }
139
+ GetNode(id) {
140
+ const this$ = this;
141
+ return getItemFromDict(this$.mappings, id);
142
+ }
143
+ TryGetNode(id) {
144
+ const this$ = this;
145
+ let matchValue;
146
+ let outArg = defaultOf();
147
+ matchValue = [tryGetValue(this$.mappings, id, new FSharpRef(() => outArg, (v) => {
148
+ outArg = v;
149
+ })), outArg];
150
+ return matchValue[0] ? matchValue[1] : undefined;
151
+ }
152
+ AddNode(node) {
153
+ const this$ = this;
154
+ const id = node.Id;
155
+ const matchValue = this$.TryGetNode(id);
156
+ if (matchValue == null) {
157
+ addToDict(this$.mappings, id, node);
158
+ }
159
+ else {
160
+ const existingNode = matchValue;
161
+ node.MergeAppendInto_InPlace(existingNode, this$);
162
+ }
163
+ }
164
+ Compact_InPlace(context) {
165
+ const this$ = this;
166
+ let context_1;
167
+ const specificContext = this$.TryGetContext();
168
+ context_1 = LDContext.tryCombineOptional(context, specificContext);
169
+ iterate((node) => {
170
+ node.Compact_InPlace(unwrap(context_1));
171
+ }, this$.Nodes);
172
+ }
173
+ SetContext(context) {
174
+ const this$ = this;
175
+ this$.SetProperty("@context", context);
176
+ }
177
+ static setContext(context) {
178
+ return (roc) => {
179
+ roc.SetContext(context);
180
+ };
181
+ }
182
+ TryGetContext() {
183
+ const this$ = this;
184
+ const matchValue = this$.TryGetPropertyValue("@context");
185
+ if (matchValue != null) {
186
+ const o = value_3(matchValue);
187
+ return (o instanceof LDContext) ? o : undefined;
188
+ }
189
+ else {
190
+ return undefined;
191
+ }
192
+ }
193
+ static tryGetContext() {
194
+ return (roc) => roc.TryGetContext();
195
+ }
196
+ RemoveContext() {
197
+ const this$ = this;
198
+ return this$.RemoveProperty("@context");
199
+ }
200
+ GetDynamicPropertyHelpers() {
201
+ const this$ = this;
202
+ return filter_2((ph) => !(ph.Name.startsWith("init@") ? true : (ph.Name === "mappings")), this$.GetPropertyHelpers(false));
203
+ }
204
+ GetDynamicPropertyNames(context) {
205
+ const this$ = this;
206
+ let context_1;
207
+ const specificContext = this$.TryGetContext();
208
+ context_1 = LDContext.tryCombineOptional(context, specificContext);
209
+ return choose((ph) => {
210
+ let name;
211
+ if (context_1 == null) {
212
+ name = ph.Name;
213
+ }
214
+ else {
215
+ const ctx = context_1;
216
+ const matchValue = ctx.TryResolveTerm(ph.Name);
217
+ name = ((matchValue == null) ? ph.Name : matchValue);
218
+ }
219
+ if (name === "@context") {
220
+ return undefined;
221
+ }
222
+ else {
223
+ return name;
224
+ }
225
+ }, this$.GetDynamicPropertyHelpers());
8
226
  }
9
227
  }
10
228
 
11
- export function LDContext_$reflection() {
12
- return class_type("ARCtrl.ROCrate.LDContext", undefined, LDContext, DynamicObj_$reflection());
229
+ export function LDGraph_$reflection() {
230
+ return class_type("ARCtrl.ROCrate.LDGraph", undefined, LDGraph, DynamicObj_$reflection());
13
231
  }
14
232
 
15
- export function LDContext_$ctor() {
16
- return new LDContext();
233
+ export function LDGraph_$ctor_5FC797DE(id, nodes, context) {
234
+ return new LDGraph(id, nodes, context);
17
235
  }
18
236
 
19
- export class LDObject extends DynamicObj {
20
- constructor(id, schemaType, additionalType) {
237
+ export class LDNode extends DynamicObj {
238
+ constructor(id, schemaType, additionalType, context) {
21
239
  super();
240
+ const this$ = new FSharpRef(defaultOf());
22
241
  this.id = id;
23
- this["schemaType@22"] = schemaType;
24
- this["additionalType@23"] = additionalType;
242
+ this$.contents = this;
243
+ this["schemaType@178"] = schemaType;
244
+ this["additionalType@179"] = defaultArg(additionalType, []);
245
+ this["init@175-1"] = 1;
246
+ if (context == null) {
247
+ }
248
+ else {
249
+ const ctx = context;
250
+ this$.contents.SetContext(ctx);
251
+ }
25
252
  }
26
253
  get Id() {
27
254
  const this$ = this;
@@ -29,19 +256,305 @@ export class LDObject extends DynamicObj {
29
256
  }
30
257
  get SchemaType() {
31
258
  const this$ = this;
32
- return this$["schemaType@22"];
259
+ return this$["schemaType@178"];
33
260
  }
34
261
  set SchemaType(value) {
35
262
  const this$ = this;
36
- this$["schemaType@22"] = value;
263
+ this$["schemaType@178"] = value;
37
264
  }
38
265
  get AdditionalType() {
39
266
  const this$ = this;
40
- return unwrap(this$["additionalType@23"]);
267
+ return this$["additionalType@179"];
41
268
  }
42
269
  set AdditionalType(value) {
43
270
  const this$ = this;
44
- this$["additionalType@23"] = value;
271
+ this$["additionalType@179"] = value;
272
+ }
273
+ HasType(schemaType, context) {
274
+ const this$ = this;
275
+ let context_1;
276
+ const specificContext = this$.TryGetContext();
277
+ context_1 = LDContext.tryCombineOptional(context, specificContext);
278
+ return exists((st) => {
279
+ if (st === schemaType) {
280
+ return true;
281
+ }
282
+ else if (context_1 == null) {
283
+ return false;
284
+ }
285
+ else {
286
+ const ctx = context_1;
287
+ const matchValue = ctx.TryResolveTerm(st);
288
+ const matchValue_1 = ctx.TryResolveTerm(schemaType);
289
+ if (matchValue == null) {
290
+ if (matchValue_1 != null) {
291
+ const schemaType_2 = matchValue_1;
292
+ return st === schemaType_2;
293
+ }
294
+ else {
295
+ return false;
296
+ }
297
+ }
298
+ else if (matchValue_1 == null) {
299
+ const st_2 = matchValue;
300
+ return st_2 === schemaType;
301
+ }
302
+ else {
303
+ const schemaType_1 = matchValue_1;
304
+ const st_1 = matchValue;
305
+ return st_1 === schemaType_1;
306
+ }
307
+ }
308
+ }, this$.SchemaType);
309
+ }
310
+ TryGetProperty(propertyName, context) {
311
+ const this$ = this;
312
+ const matchValue = this$.TryGetPropertyValue(propertyName);
313
+ if (matchValue == null) {
314
+ let matchValue_1;
315
+ const specificContext = this$.TryGetContext();
316
+ matchValue_1 = LDContext.tryCombineOptional(context, specificContext);
317
+ if (matchValue_1 == null) {
318
+ return undefined;
319
+ }
320
+ else {
321
+ const ctx = matchValue_1;
322
+ const matchValue_2 = ctx.TryResolveTerm(propertyName);
323
+ if (matchValue_2 == null) {
324
+ const matchValue_3 = ctx.TryGetTerm(propertyName);
325
+ if (matchValue_3 == null) {
326
+ return undefined;
327
+ }
328
+ else {
329
+ const term_1 = matchValue_3;
330
+ return this$.TryGetPropertyValue(term_1);
331
+ }
332
+ }
333
+ else {
334
+ const term = matchValue_2;
335
+ return this$.TryGetPropertyValue(term);
336
+ }
337
+ }
338
+ }
339
+ else {
340
+ return some(value_3(matchValue));
341
+ }
342
+ }
343
+ TryGetPropertyAsSingleton(propertyName, context) {
344
+ const this$ = this;
345
+ const matchValue = this$.TryGetProperty(propertyName, unwrap(context));
346
+ if (matchValue != null) {
347
+ if (typeof value_3(matchValue) === "string") {
348
+ const s = value_3(matchValue);
349
+ return some(s);
350
+ }
351
+ else if (isIterable(value_3(matchValue))) {
352
+ const e = value_3(matchValue);
353
+ const en = getEnumerator(e);
354
+ return en["System.Collections.IEnumerator.MoveNext"]() ? some(en["System.Collections.IEnumerator.get_Current"]()) : undefined;
355
+ }
356
+ else {
357
+ const o = value_3(matchValue);
358
+ return some(o);
359
+ }
360
+ }
361
+ else {
362
+ return undefined;
363
+ }
364
+ }
365
+ GetPropertyValues(propertyName, filter, context) {
366
+ const this$ = this;
367
+ const filter_1 = defaultArg(map(curry2, filter), (_arg) => ((_arg_1) => true));
368
+ const matchValue = this$.TryGetProperty(propertyName, unwrap(context));
369
+ let matchResult, s, e, o_1;
370
+ if (matchValue != null) {
371
+ if (typeof value_3(matchValue) === "string") {
372
+ matchResult = 0;
373
+ s = value_3(matchValue);
374
+ }
375
+ else if (isIterable(value_3(matchValue))) {
376
+ matchResult = 1;
377
+ e = value_3(matchValue);
378
+ }
379
+ else if (filter_1(value_3(matchValue))(context)) {
380
+ matchResult = 2;
381
+ o_1 = value_3(matchValue);
382
+ }
383
+ else {
384
+ matchResult = 3;
385
+ }
386
+ }
387
+ else {
388
+ matchResult = 3;
389
+ }
390
+ switch (matchResult) {
391
+ case 0:
392
+ return filter_1(s)(context) ? [s] : [];
393
+ case 1: {
394
+ const en = getEnumerator(e);
395
+ const collection = toList(delay(() => enumerateWhile(() => en["System.Collections.IEnumerator.MoveNext"](), delay(() => (filter_1(en["System.Collections.IEnumerator.get_Current"]())(context) ? singleton_2(en["System.Collections.IEnumerator.get_Current"]()) : empty())))));
396
+ return Array.from(collection);
397
+ }
398
+ case 2:
399
+ return [o_1];
400
+ default:
401
+ return [];
402
+ }
403
+ }
404
+ TryGetPropertyAsSingleNode(propertyName, graph, context) {
405
+ let r;
406
+ const this$ = this;
407
+ const matchValue = this$.TryGetPropertyAsSingleton(propertyName, unwrap(context));
408
+ let matchResult, n, r_1;
409
+ if (matchValue != null) {
410
+ if (value_3(matchValue) instanceof LDNode) {
411
+ matchResult = 0;
412
+ n = value_3(matchValue);
413
+ }
414
+ else if (value_3(matchValue) instanceof LDRef) {
415
+ if ((r = value_3(matchValue), graph != null)) {
416
+ matchResult = 1;
417
+ r_1 = value_3(matchValue);
418
+ }
419
+ else {
420
+ matchResult = 2;
421
+ }
422
+ }
423
+ else {
424
+ matchResult = 2;
425
+ }
426
+ }
427
+ else {
428
+ matchResult = 2;
429
+ }
430
+ switch (matchResult) {
431
+ case 0:
432
+ return n;
433
+ case 1: {
434
+ const matchValue_1 = value_3(graph).TryGetNode(r_1.Id);
435
+ return (matchValue_1 == null) ? undefined : matchValue_1;
436
+ }
437
+ default:
438
+ return undefined;
439
+ }
440
+ }
441
+ GetPropertyNodes(propertyName, filter, graph, context) {
442
+ const this$ = this;
443
+ let context_1;
444
+ const specificContext = this$.TryGetContext();
445
+ context_1 = LDContext.tryCombineOptional(context, specificContext);
446
+ const collection = choose((o) => {
447
+ let matchResult;
448
+ if (o instanceof LDRef) {
449
+ if (graph != null) {
450
+ matchResult = 0;
451
+ }
452
+ else {
453
+ matchResult = 2;
454
+ }
455
+ }
456
+ else if (o instanceof LDNode) {
457
+ matchResult = 1;
458
+ }
459
+ else {
460
+ matchResult = 2;
461
+ }
462
+ switch (matchResult) {
463
+ case 0: {
464
+ const matchValue = value_3(graph).TryGetNode(o.Id);
465
+ if (matchValue == null) {
466
+ return undefined;
467
+ }
468
+ else {
469
+ const n = matchValue;
470
+ if (filter == null) {
471
+ return n;
472
+ }
473
+ else if (filter(n, context_1)) {
474
+ const f_1 = map(curry2, filter);
475
+ return n;
476
+ }
477
+ else {
478
+ return undefined;
479
+ }
480
+ }
481
+ }
482
+ case 1: {
483
+ const n_1 = o;
484
+ if (filter == null) {
485
+ return n_1;
486
+ }
487
+ else if (filter(n_1, context_1)) {
488
+ const f_3 = map(curry2, filter);
489
+ return n_1;
490
+ }
491
+ else {
492
+ return undefined;
493
+ }
494
+ }
495
+ default:
496
+ return undefined;
497
+ }
498
+ }, this$.GetPropertyValues(propertyName, undefined, unwrap(context_1)));
499
+ return Array.from(collection);
500
+ }
501
+ GetDynamicPropertyHelpers() {
502
+ const this$ = this;
503
+ return filter_2((ph) => !(ph.Name.startsWith("init@") ? true : (ph.Name === "id")), this$.GetPropertyHelpers(false));
504
+ }
505
+ GetPropertyNames(context) {
506
+ const this$ = this;
507
+ let context_1;
508
+ const specificContext = this$.TryGetContext();
509
+ context_1 = LDContext.tryCombineOptional(context, specificContext);
510
+ return choose((ph) => {
511
+ let name;
512
+ if (context_1 == null) {
513
+ name = ph.Name;
514
+ }
515
+ else {
516
+ const ctx = context_1;
517
+ const matchValue = ctx.TryResolveTerm(ph.Name);
518
+ name = ((matchValue == null) ? ph.Name : matchValue);
519
+ }
520
+ if (name === "@context") {
521
+ return undefined;
522
+ }
523
+ else {
524
+ return name;
525
+ }
526
+ }, this$.GetDynamicPropertyHelpers());
527
+ }
528
+ SetProperty(propertyName, value, context) {
529
+ const this$ = this;
530
+ let context_1;
531
+ const specificContext = this$.TryGetContext();
532
+ context_1 = LDContext.tryCombineOptional(context, specificContext);
533
+ const propertyName_1 = defaultArg(tryFind((pn) => {
534
+ if (context_1 == null) {
535
+ return pn === propertyName;
536
+ }
537
+ else {
538
+ const c = context_1;
539
+ return c.PropertyNamesMatch(pn, propertyName);
540
+ }
541
+ }, this$.GetPropertyNames()), propertyName);
542
+ super.SetProperty(propertyName_1,value);
543
+ }
544
+ SetOptionalProperty(propertyName, value, context) {
545
+ const this$ = this;
546
+ if (value == null) {
547
+ }
548
+ else {
549
+ const v = value_3(value);
550
+ this$.SetProperty(propertyName, v, unwrap(context));
551
+ }
552
+ }
553
+ HasProperty(propertyName, context) {
554
+ let v_2, e;
555
+ const this$ = this;
556
+ const v = this$.TryGetProperty(propertyName, unwrap(context));
557
+ return (v != null) && (equals(value_3(v), defaultOf()) ? ((v_2 = value_3(v), false)) : (isIterable(value_3(v)) ? ((e = value_3(v), getEnumerator(e)["System.Collections.IEnumerator.MoveNext"]())) : true));
45
558
  }
46
559
  SetContext(context) {
47
560
  const this$ = this;
@@ -56,8 +569,8 @@ export class LDObject extends DynamicObj {
56
569
  const this$ = this;
57
570
  const matchValue = this$.TryGetPropertyValue("@context");
58
571
  if (matchValue != null) {
59
- const o = value_1(matchValue);
60
- return (o instanceof DynamicObj) ? o : undefined;
572
+ const o = value_3(matchValue);
573
+ return (o instanceof LDContext) ? o : undefined;
61
574
  }
62
575
  else {
63
576
  return undefined;
@@ -70,36 +583,389 @@ export class LDObject extends DynamicObj {
70
583
  const this$ = this;
71
584
  return this$.RemoveProperty("@context");
72
585
  }
73
- static removeContext() {
74
- return (roc) => roc.RemoveContext();
75
- }
76
- get SchemaType() {
586
+ MergeAppendInto_InPlace(other, flattenTo) {
77
587
  const this$ = this;
78
- return this$["schemaType@22"];
588
+ let flattenTo_Singleton;
589
+ if (flattenTo == null) {
590
+ flattenTo_Singleton = ((x) => x);
591
+ }
592
+ else {
593
+ const graph = flattenTo;
594
+ flattenTo_Singleton = ((o) => {
595
+ if (o instanceof LDNode) {
596
+ const n = o;
597
+ n.Flatten(graph);
598
+ return new LDRef(n.Id);
599
+ }
600
+ else {
601
+ return o;
602
+ }
603
+ });
604
+ }
605
+ let flattenTo_RA;
606
+ if (flattenTo == null) {
607
+ flattenTo_RA = ((x_1) => x_1);
608
+ }
609
+ else {
610
+ const graph_1 = flattenTo;
611
+ flattenTo_RA = ((a) => ResizeArray_map(flattenTo_Singleton, a));
612
+ }
613
+ let flattenToAny;
614
+ if (flattenTo == null) {
615
+ flattenToAny = ((x_2) => x_2);
616
+ }
617
+ else {
618
+ const graph_2 = flattenTo;
619
+ const f_2 = (o_1) => {
620
+ let collection;
621
+ if (o_1 instanceof LDNode) {
622
+ const n_1 = o_1;
623
+ n_1.Flatten(graph_2);
624
+ return new LDRef(n_1.Id);
625
+ }
626
+ else {
627
+ const activePatternResult = ActivePattern_$007CNonStringEnumerable$007C_$007C(o_1);
628
+ if (activePatternResult != null) {
629
+ const e = activePatternResult;
630
+ return (collection = toList(delay(() => map_1(f_2, enumerateFromFunctions(() => getEnumerator(e), (enumerator) => enumerator["System.Collections.IEnumerator.MoveNext"](), (enumerator_1) => enumerator_1["System.Collections.IEnumerator.get_Current"]())))), Array.from(collection));
631
+ }
632
+ else {
633
+ return o_1;
634
+ }
635
+ }
636
+ };
637
+ flattenToAny = f_2;
638
+ }
639
+ const toEqualitor = (o_2) => {
640
+ if (o_2 instanceof LDNode) {
641
+ return o_2.Id;
642
+ }
643
+ else if (o_2 instanceof LDRef) {
644
+ return o_2.Id;
645
+ }
646
+ else {
647
+ return o_2;
648
+ }
649
+ };
650
+ iterate((pn) => {
651
+ let collection_1;
652
+ const matchValue = other.TryGetProperty(pn);
653
+ if (matchValue == null) {
654
+ const v_3 = flattenToAny(value_3(this$.TryGetProperty(pn)));
655
+ other.SetProperty(pn, v_3);
656
+ }
657
+ else {
658
+ const otherVal = value_3(matchValue);
659
+ const thisVal = value_3(this$.TryGetProperty(pn));
660
+ let matchResult, e1, e2;
661
+ const activePatternResult_1 = ActivePattern_$007CNonStringEnumerable$007C_$007C(thisVal);
662
+ if (activePatternResult_1 != null) {
663
+ const activePatternResult_2 = ActivePattern_$007CNonStringEnumerable$007C_$007C(otherVal);
664
+ if (activePatternResult_2 != null) {
665
+ matchResult = 0;
666
+ e1 = activePatternResult_1;
667
+ e2 = activePatternResult_2;
668
+ }
669
+ else {
670
+ matchResult = 1;
671
+ }
672
+ }
673
+ else {
674
+ matchResult = 1;
675
+ }
676
+ switch (matchResult) {
677
+ case 0: {
678
+ const l = flattenTo_RA((collection_1 = List_distinctBy(toEqualitor, toList(delay(() => append(map_1((v_1) => v_1, enumerateFromFunctions(() => getEnumerator(e2), (enumerator_2) => enumerator_2["System.Collections.IEnumerator.MoveNext"](), (enumerator_3) => enumerator_3["System.Collections.IEnumerator.get_Current"]())), delay(() => map_1((v_2) => v_2, enumerateFromFunctions(() => getEnumerator(e1), (enumerator_4) => enumerator_4["System.Collections.IEnumerator.MoveNext"](), (enumerator_5) => enumerator_5["System.Collections.IEnumerator.get_Current"]())))))), {
679
+ Equals: equals,
680
+ GetHashCode: structuralHash,
681
+ }), Array.from(collection_1)));
682
+ other.SetProperty(pn, l);
683
+ break;
684
+ }
685
+ case 1: {
686
+ const activePatternResult_3 = ActivePattern_$007CNonStringEnumerable$007C_$007C(thisVal);
687
+ if (activePatternResult_3 != null) {
688
+ const theseVals = activePatternResult_3;
689
+ let isContained = false;
690
+ const l_1 = Array.from(toList(delay(() => collect((thisVal_1) => {
691
+ if (equals(toEqualitor(thisVal_1), toEqualitor(otherVal))) {
692
+ isContained = true;
693
+ return singleton_2(flattenTo_Singleton(thisVal_1));
694
+ }
695
+ else {
696
+ return singleton_2(thisVal_1);
697
+ }
698
+ }, enumerateFromFunctions(() => getEnumerator(theseVals), (enumerator_6) => enumerator_6["System.Collections.IEnumerator.MoveNext"](), (enumerator_7) => enumerator_7["System.Collections.IEnumerator.get_Current"]())))));
699
+ if (!isContained) {
700
+ void (l_1.push(otherVal));
701
+ other.SetProperty(pn, l_1);
702
+ }
703
+ }
704
+ else {
705
+ const activePatternResult_4 = ActivePattern_$007CNonStringEnumerable$007C_$007C(otherVal);
706
+ if (activePatternResult_4 != null) {
707
+ const otherVals = activePatternResult_4;
708
+ let isContained_1 = false;
709
+ const l_2 = Array.from(toList(delay(() => collect((otherVal_2) => append(equals(toEqualitor(thisVal), toEqualitor(otherVal_2)) ? ((isContained_1 = true, empty())) : empty(), delay(() => singleton_2(otherVal_2))), enumerateFromFunctions(() => getEnumerator(otherVals), (enumerator_8) => enumerator_8["System.Collections.IEnumerator.MoveNext"](), (enumerator_9) => enumerator_9["System.Collections.IEnumerator.get_Current"]())))));
710
+ if (!isContained_1) {
711
+ void (l_2.push(flattenTo_Singleton(thisVal)));
712
+ other.SetProperty(pn, l_2);
713
+ }
714
+ }
715
+ else if (equals(toEqualitor(thisVal), toEqualitor(otherVal))) {
716
+ }
717
+ else {
718
+ const l_3 = [flattenTo_Singleton(thisVal), otherVal];
719
+ other.SetProperty(pn, l_3);
720
+ }
721
+ }
722
+ break;
723
+ }
724
+ }
725
+ }
726
+ }, this$.GetPropertyNames());
79
727
  }
80
- set SchemaType(value) {
728
+ Compact_InPlace(context, setContext) {
81
729
  const this$ = this;
82
- this$["schemaType@22"] = value;
730
+ const setContext_1 = defaultArg(setContext, false);
731
+ let context_1;
732
+ const specificContext = this$.TryGetContext();
733
+ context_1 = LDContext.tryCombineOptional(context, specificContext);
734
+ if (context_1 != null) {
735
+ const context_2 = value_3(context_1);
736
+ if (setContext_1) {
737
+ this$.SetContext(context_2);
738
+ }
739
+ const newTypes = Array.from(toList(delay(() => collect((st) => {
740
+ const matchValue = context_2.TryGetTerm(st);
741
+ return (matchValue == null) ? singleton_2(st) : singleton_2(matchValue);
742
+ }, this$.SchemaType))));
743
+ this$.SchemaType = newTypes;
744
+ }
745
+ const compactValue_inPlace = (o) => {
746
+ let matchResult, n, s, e, v, x;
747
+ if (o instanceof LDNode) {
748
+ matchResult = 0;
749
+ n = o;
750
+ }
751
+ else if (typeof o === "string") {
752
+ matchResult = 1;
753
+ s = o;
754
+ }
755
+ else if (o instanceof LDValue) {
756
+ if (isIterable(o)) {
757
+ matchResult = 2;
758
+ e = o;
759
+ }
760
+ else {
761
+ matchResult = 3;
762
+ v = o;
763
+ }
764
+ }
765
+ else if (isIterable(o)) {
766
+ matchResult = 2;
767
+ e = o;
768
+ }
769
+ else {
770
+ matchResult = 4;
771
+ x = o;
772
+ }
773
+ switch (matchResult) {
774
+ case 0: {
775
+ n.Compact_InPlace(unwrap(context_1));
776
+ return n;
777
+ }
778
+ case 1:
779
+ return s;
780
+ case 2: {
781
+ const en = getEnumerator(e);
782
+ const l = Array.from(toList(delay(() => enumerateWhile(() => en["System.Collections.IEnumerator.MoveNext"](), delay(() => singleton_2(compactValue_inPlace(en["System.Collections.IEnumerator.get_Current"]())))))));
783
+ if (l.length === 1) {
784
+ return l[0];
785
+ }
786
+ else {
787
+ return l;
788
+ }
789
+ }
790
+ case 3:
791
+ return v.Value;
792
+ default:
793
+ return x;
794
+ }
795
+ };
796
+ iterate((ph) => {
797
+ let newKey;
798
+ if (context_1 == null) {
799
+ newKey = undefined;
800
+ }
801
+ else {
802
+ const ctx = context_1;
803
+ const matchValue_1 = ctx.TryGetTerm(ph.Name);
804
+ newKey = ((matchValue_1 == null) ? undefined : matchValue_1);
805
+ }
806
+ const newValue = compactValue_inPlace(ph.GetValue(this$));
807
+ let matchResult_1, key_1;
808
+ if (newKey != null) {
809
+ if (newKey !== ph.Name) {
810
+ matchResult_1 = 0;
811
+ key_1 = newKey;
812
+ }
813
+ else {
814
+ matchResult_1 = 1;
815
+ }
816
+ }
817
+ else {
818
+ matchResult_1 = 1;
819
+ }
820
+ switch (matchResult_1) {
821
+ case 0: {
822
+ this$.RemoveProperty(ph.Name);
823
+ this$.SetProperty(key_1, newValue);
824
+ break;
825
+ }
826
+ case 1: {
827
+ ph.SetValue(this$, newValue);
828
+ break;
829
+ }
830
+ }
831
+ }, this$.GetDynamicPropertyHelpers());
83
832
  }
84
- get Id() {
833
+ Flatten(graph) {
85
834
  const this$ = this;
86
- return this$.id;
835
+ const graph_1 = (graph == null) ? (new LDGraph(undefined, undefined, unwrap(this$.TryGetContext()))) : graph;
836
+ const flattenValue = (o) => {
837
+ if (o instanceof LDNode) {
838
+ o.Flatten(graph_1);
839
+ return new LDRef(o.Id);
840
+ }
841
+ else if (typeof o === "string") {
842
+ return o;
843
+ }
844
+ else if (isIterable(o)) {
845
+ const e = o;
846
+ const en = getEnumerator(e);
847
+ return Array.from(toList(delay(() => enumerateWhile(() => en["System.Collections.IEnumerator.MoveNext"](), delay(() => singleton_2(flattenValue(en["System.Collections.IEnumerator.get_Current"]())))))));
848
+ }
849
+ else {
850
+ return o;
851
+ }
852
+ };
853
+ iterate((ph) => {
854
+ ph.SetValue(this$, flattenValue(ph.GetValue(this$)));
855
+ }, this$.GetDynamicPropertyHelpers());
856
+ graph_1.AddNode(this$);
857
+ return graph_1;
87
858
  }
88
- get AdditionalType() {
859
+ Unflatten(graph) {
89
860
  const this$ = this;
90
- return unwrap(this$["additionalType@23"]);
861
+ const unflattenValue = (o) => {
862
+ if (o instanceof LDRef) {
863
+ const matchValue = graph.TryGetNode(o.Id);
864
+ if (matchValue == null) {
865
+ return o;
866
+ }
867
+ else {
868
+ return matchValue;
869
+ }
870
+ }
871
+ else if (o instanceof LDNode) {
872
+ o.Unflatten(graph);
873
+ return o;
874
+ }
875
+ else if (isIterable(o)) {
876
+ const e = o;
877
+ const en = getEnumerator(e);
878
+ return Array.from(toList(delay(() => enumerateWhile(() => en["System.Collections.IEnumerator.MoveNext"](), delay(() => singleton_2(unflattenValue(en["System.Collections.IEnumerator.get_Current"]())))))));
879
+ }
880
+ else {
881
+ return o;
882
+ }
883
+ };
884
+ iterate((ph) => {
885
+ ph.SetValue(this$, unflattenValue(ph.GetValue(this$)));
886
+ }, this$.GetDynamicPropertyHelpers());
91
887
  }
92
- set AdditionalType(value) {
93
- const this$ = this;
94
- this$["additionalType@23"] = value;
888
+ static removeContext() {
889
+ return (roc) => roc.RemoveContext();
890
+ }
891
+ static tryFromDynamicObj(dynObj) {
892
+ let matchValue_3, ra_1, singleton_1;
893
+ let original_id;
894
+ const matchValue = dynObj.TryGetPropertyValue("@id");
895
+ if (matchValue != null) {
896
+ const o = value_3(matchValue);
897
+ original_id = ((typeof o === "string") ? o : undefined);
898
+ }
899
+ else {
900
+ original_id = undefined;
901
+ }
902
+ let original_type;
903
+ const matchValue_1 = dynObj.TryGetPropertyValue("@type");
904
+ let matchResult, ra, singleton;
905
+ if (matchValue_1 != null) {
906
+ if (isArrayLike(value_3(matchValue_1))) {
907
+ matchResult = 0;
908
+ ra = value_3(matchValue_1);
909
+ }
910
+ else if (typeof value_3(matchValue_1) === "string") {
911
+ matchResult = 1;
912
+ singleton = value_3(matchValue_1);
913
+ }
914
+ else {
915
+ matchResult = 2;
916
+ }
917
+ }
918
+ else {
919
+ matchResult = 2;
920
+ }
921
+ switch (matchResult) {
922
+ case 0: {
923
+ original_type = ra;
924
+ break;
925
+ }
926
+ case 1: {
927
+ original_type = [singleton];
928
+ break;
929
+ }
930
+ default:
931
+ original_type = undefined;
932
+ }
933
+ let matchResult_1, id, st;
934
+ if (original_id != null) {
935
+ if (original_type != null) {
936
+ matchResult_1 = 0;
937
+ id = original_id;
938
+ st = original_type;
939
+ }
940
+ else {
941
+ matchResult_1 = 1;
942
+ }
943
+ }
944
+ else {
945
+ matchResult_1 = 1;
946
+ }
947
+ switch (matchResult_1) {
948
+ case 0: {
949
+ const roc = new LDNode(id, st, unwrap((matchValue_3 = dynObj.TryGetPropertyValue("additionalType"), (matchValue_3 != null) ? (isArrayLike(value_3(matchValue_3)) ? ((ra_1 = value_3(matchValue_3), ra_1)) : ((typeof value_3(matchValue_3) === "string") ? ((singleton_1 = value_3(matchValue_3), [singleton_1])) : undefined)) : undefined)));
950
+ dynObj.DeepCopyPropertiesTo(roc, undefined, false);
951
+ iterate((ph) => {
952
+ if (ph.IsDynamic && (((ph.Name === "@id") ? true : (ph.Name === "@type")) ? true : (ph.Name === "additionalType"))) {
953
+ ph.RemoveValue(roc);
954
+ }
955
+ }, roc.GetDynamicPropertyHelpers());
956
+ return roc;
957
+ }
958
+ default:
959
+ return undefined;
960
+ }
95
961
  }
96
962
  }
97
963
 
98
- export function LDObject_$reflection() {
99
- return class_type("ARCtrl.ROCrate.LDObject", undefined, LDObject, DynamicObj_$reflection());
964
+ export function LDNode_$reflection() {
965
+ return class_type("ARCtrl.ROCrate.LDNode", undefined, LDNode, DynamicObj_$reflection());
100
966
  }
101
967
 
102
- export function LDObject_$ctor_Z2FC25A28(id, schemaType, additionalType) {
103
- return new LDObject(id, schemaType, additionalType);
968
+ export function LDNode_$ctor_479BCDCF(id, schemaType, additionalType, context) {
969
+ return new LDNode(id, schemaType, additionalType, context);
104
970
  }
105
971