@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
package/Core/Data.js CHANGED
@@ -1,4 +1,4 @@
1
- import { printf, toText } from "../fable_modules/fable-library-js.4.24.0/String.js";
1
+ import { trimStart, trim, printf, toText } from "../fable_modules/fable-library-js.4.24.0/String.js";
2
2
  import { item } from "../fable_modules/fable-library-js.4.24.0/Array.js";
3
3
  import { defaultArg, unwrap } from "../fable_modules/fable-library-js.4.24.0/Option.js";
4
4
  import { ResizeArray_map } from "./Helper/Collections.js";
@@ -12,12 +12,13 @@ export function DataAux_nameFromPathAndSelector(path, selector) {
12
12
  }
13
13
 
14
14
  export function DataAux_pathAndSelectorFromName(name) {
15
- const parts = name.split("#");
15
+ const name_1 = trim(name, "#");
16
+ const parts = name_1.split("#");
16
17
  if (parts.length === 2) {
17
18
  return [item(0, parts), item(1, parts)];
18
19
  }
19
20
  else {
20
- return [name, undefined];
21
+ return [name_1, undefined];
21
22
  }
22
23
  }
23
24
 
@@ -125,6 +126,30 @@ export class Data {
125
126
  const this$ = this;
126
127
  return defaultArg(this$.Name, "");
127
128
  }
129
+ GetAbsolutePathForAssay(assayIdentifier, checkExistenceFromRoot) {
130
+ const this$ = this;
131
+ const checkExistenceFromRoot_1 = defaultArg(checkExistenceFromRoot, (_arg) => false);
132
+ const matchValue = this$.FilePath;
133
+ if (matchValue == null) {
134
+ throw new Error("Data does not have a file path");
135
+ }
136
+ else {
137
+ const p = matchValue;
138
+ return ((((checkExistenceFromRoot_1(p) ? true : p.startsWith("assays/")) ? true : p.startsWith("studies/")) ? true : p.startsWith("http:")) ? true : p.startsWith("https:")) ? p : ((`assays/${assayIdentifier}/dataset/`) + trimStart(p, "/"));
139
+ }
140
+ }
141
+ GetAbsolutePathForStudy(studyIdentifier, checkExistenceFromRoot) {
142
+ const this$ = this;
143
+ const checkExistenceFromRoot_1 = defaultArg(checkExistenceFromRoot, (_arg) => false);
144
+ const matchValue = this$.FilePath;
145
+ if (matchValue == null) {
146
+ throw new Error("Data does not have a file path");
147
+ }
148
+ else {
149
+ const p = matchValue;
150
+ return ((((checkExistenceFromRoot_1(p) ? true : p.startsWith("assays/")) ? true : p.startsWith("studies/")) ? true : p.startsWith("http:")) ? true : p.startsWith("https:")) ? p : ((`studies/${studyIdentifier}/resources/`) + trimStart(p, "/"));
151
+ }
152
+ }
128
153
  Copy() {
129
154
  const this$ = this;
130
155
  const nextComments = ResizeArray_map((c) => c.Copy(), this$.Comments);
package/Core/DataFile.js CHANGED
@@ -31,11 +31,27 @@ export function DataFile_get_ImageFileJson() {
31
31
  export function DataFile__get_AsString(this$) {
32
32
  switch (this$.tag) {
33
33
  case 1:
34
- return "DerivedDataFileJson";
34
+ return "Derived Data File";
35
35
  case 2:
36
- return "ImageFileJson";
36
+ return "Image File";
37
37
  default:
38
- return "RawDataFileJson";
38
+ return "Raw Data File";
39
+ }
40
+ }
41
+
42
+ export function DataFile_fromString_Z721C83C5(dt) {
43
+ switch (dt) {
44
+ case "RawDataFileJson":
45
+ case "Raw Data File":
46
+ return new DataFile(0, []);
47
+ case "DerivedDataFileJson":
48
+ case "Derived Data File":
49
+ return new DataFile(1, []);
50
+ case "ImageFileJson":
51
+ case "Image File":
52
+ return new DataFile(2, []);
53
+ default:
54
+ throw new Error(`Invalid DataFile type: ${dt}`);
39
55
  }
40
56
  }
41
57
 
@@ -1,11 +1,13 @@
1
1
  import { disposeSafe, getEnumerator, defaultOf, structuralHash, equals } from "../../fable_modules/fable-library-js.4.24.0/Util.js";
2
2
  import { value as value_1, some } from "../../fable_modules/fable-library-js.4.24.0/Option.js";
3
- import { empty, singleton, append, head, tail, isEmpty } from "../../fable_modules/fable-library-js.4.24.0/List.js";
4
- import { Dictionary } from "../../fable_modules/fable-library-js.4.24.0/MutableMap.js";
5
- import { iterate } from "../../fable_modules/fable-library-js.4.24.0/Seq.js";
3
+ import { map, iterate, isEmpty } from "../../fable_modules/fable-library-js.4.24.0/Seq.js";
4
+ import { empty, singleton, append, head, tail, isEmpty as isEmpty_1 } from "../../fable_modules/fable-library-js.4.24.0/List.js";
6
5
  import { tryGetValue, addToDict } from "../../fable_modules/fable-library-js.4.24.0/MapUtil.js";
6
+ import { Dictionary } from "../../fable_modules/fable-library-js.4.24.0/MutableMap.js";
7
7
  import { FSharpRef } from "../../fable_modules/fable-library-js.4.24.0/Types.js";
8
8
  import { contains } from "../../fable_modules/fable-library-js.4.24.0/Array.js";
9
+ import { groupBy } from "../../fable_modules/fable-library-js.4.24.0/Seq2.js";
10
+ import { min } from "../../fable_modules/fable-library-js.4.24.0/Double.js";
9
11
 
10
12
  /**
11
13
  * If the value matches the default, a None is returned, else a Some is returned
@@ -38,12 +40,24 @@ export function Option_mapOrDefault(d, f, o) {
38
40
  }
39
41
  }
40
42
 
43
+ /**
44
+ * If the value matches the default, a None is returned, else a Some is returned
45
+ */
46
+ export function Option_fromSeq(v) {
47
+ if (isEmpty(v)) {
48
+ return undefined;
49
+ }
50
+ else {
51
+ return some(v);
52
+ }
53
+ }
54
+
41
55
  export function List_tryPickAndRemove(f, lst) {
42
56
  const loop = (newList_mut, remainingList_mut) => {
43
57
  loop:
44
58
  while (true) {
45
59
  const newList = newList_mut, remainingList = remainingList_mut;
46
- if (!isEmpty(remainingList)) {
60
+ if (!isEmpty_1(remainingList)) {
47
61
  const t = tail(remainingList);
48
62
  const h = head(remainingList);
49
63
  const matchValue = f(h);
@@ -65,6 +79,15 @@ export function List_tryPickAndRemove(f, lst) {
65
79
  return loop(empty(), lst);
66
80
  }
67
81
 
82
+ export function Dictionary_addOrUpdate(key, value, dict) {
83
+ if (dict.has(key)) {
84
+ dict.set(key, value);
85
+ }
86
+ else {
87
+ addToDict(dict, key, value);
88
+ }
89
+ }
90
+
68
91
  export function Dictionary_ofSeq(s) {
69
92
  const dict = new Dictionary([], {
70
93
  Equals: equals,
@@ -111,6 +134,22 @@ export function Dictionary_ofSeqWithMerge(merge, s) {
111
134
  return dict;
112
135
  }
113
136
 
137
+ export function ResizeArray_create(i, v) {
138
+ const a = [];
139
+ if (i > 0) {
140
+ for (let forLoopVar = 1; forLoopVar <= i; forLoopVar++) {
141
+ void (a.push(v));
142
+ }
143
+ }
144
+ return a;
145
+ }
146
+
147
+ export function ResizeArray_singleton(a) {
148
+ const b = [];
149
+ void (b.push(a));
150
+ return b;
151
+ }
152
+
114
153
  export function ResizeArray_map(f, a) {
115
154
  const b = [];
116
155
  let enumerator = getEnumerator(a);
@@ -316,3 +355,67 @@ export function ResizeArray_appendSingleton(b, a) {
316
355
  return c;
317
356
  }
318
357
 
358
+ export function ResizeArray_groupBy(f, a) {
359
+ const collection = map((tupledArg) => [tupledArg[0], Array.from(tupledArg[1])], groupBy(f, a, {
360
+ Equals: equals,
361
+ GetHashCode: structuralHash,
362
+ }));
363
+ return Array.from(collection);
364
+ }
365
+
366
+ export function ResizeArray_tryPick(f, a) {
367
+ const loop = (i_mut) => {
368
+ loop:
369
+ while (true) {
370
+ const i = i_mut;
371
+ if (i < a.length) {
372
+ const matchValue = f(a[i]);
373
+ if (matchValue == null) {
374
+ i_mut = (i + 1);
375
+ continue loop;
376
+ }
377
+ else {
378
+ return some(value_1(matchValue));
379
+ }
380
+ }
381
+ else {
382
+ return undefined;
383
+ }
384
+ break;
385
+ }
386
+ };
387
+ return loop(0);
388
+ }
389
+
390
+ export function ResizeArray_zip(a, b) {
391
+ const c = [];
392
+ const n = min(a.length, b.length) | 0;
393
+ for (let i = 0; i <= (n - 1); i++) {
394
+ void (c.push([a[i], b[i]]));
395
+ }
396
+ return c;
397
+ }
398
+
399
+ export function ResizeArray_tryFind(f, a) {
400
+ const loop = (i_mut) => {
401
+ loop:
402
+ while (true) {
403
+ const i = i_mut;
404
+ if (i < a.length) {
405
+ if (f(a[i])) {
406
+ return some(a[i]);
407
+ }
408
+ else {
409
+ i_mut = (i + 1);
410
+ continue loop;
411
+ }
412
+ }
413
+ else {
414
+ return undefined;
415
+ }
416
+ break;
417
+ }
418
+ };
419
+ return loop(0);
420
+ }
421
+
@@ -0,0 +1,17 @@
1
+ import { tryParse as tryParse_1, minValue } from "../../fable_modules/fable-library-js.4.24.0/Date.js";
2
+ import { FSharpRef } from "../../fable_modules/fable-library-js.4.24.0/Types.js";
3
+
4
+ export function tryParse(s) {
5
+ let matchValue;
6
+ let outArg = minValue();
7
+ matchValue = [tryParse_1(s, new FSharpRef(() => outArg, (v) => {
8
+ outArg = v;
9
+ })), outArg];
10
+ if (matchValue[0]) {
11
+ return matchValue[1];
12
+ }
13
+ else {
14
+ return undefined;
15
+ }
16
+ }
17
+
@@ -0,0 +1,39 @@
1
+ import { match } from "../../fable_modules/fable-library-js.4.24.0/RegExp.js";
2
+ import { ActivePatterns_$007CRegex$007C_$007C } from "./Regex.js";
3
+
4
+ export const orcidRegex = /[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]/gu;
5
+
6
+ export function tryGetOrcidNumber(orcid) {
7
+ const m = match(orcidRegex, orcid);
8
+ if (m != null) {
9
+ return m[0];
10
+ }
11
+ else {
12
+ return undefined;
13
+ }
14
+ }
15
+
16
+ export const orcidPrefix = "http://orcid.org/";
17
+
18
+ export function $007CORCID$007C_$007C(input) {
19
+ const activePatternResult = ActivePatterns_$007CRegex$007C_$007C("[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{3}[0-9X]", input);
20
+ if (activePatternResult != null) {
21
+ const r = activePatternResult;
22
+ return r[0];
23
+ }
24
+ else {
25
+ return undefined;
26
+ }
27
+ }
28
+
29
+ export function tryGetOrcidURL(orcid) {
30
+ const activePatternResult = $007CORCID$007C_$007C(orcid);
31
+ if (activePatternResult != null) {
32
+ const orcid_1 = activePatternResult;
33
+ return `${orcidPrefix}${orcid_1}`;
34
+ }
35
+ else {
36
+ return undefined;
37
+ }
38
+ }
39
+
@@ -83,10 +83,16 @@ export class ArcTable {
83
83
  const this$ = this;
84
84
  return getColumnCount(this$.Headers) | 0;
85
85
  }
86
+ static columnCount(table) {
87
+ return table.ColumnCount;
88
+ }
86
89
  get RowCount() {
87
90
  const this$ = this;
88
91
  return getRowCount(this$.Values) | 0;
89
92
  }
93
+ static rowCount(table) {
94
+ return table.RowCount;
95
+ }
90
96
  get Columns() {
91
97
  const this$ = this;
92
98
  return toArray(delay(() => map((i) => this$.GetColumn(i), rangeDouble(0, 1, this$.ColumnCount - 1))));
@@ -490,6 +490,10 @@ export class CompositeHeader extends Union {
490
490
  const this$ = this;
491
491
  return (this$.tag === 3) ? (new CompositeHeader(3, [this$.fields[0].Copy()])) : ((this$.tag === 2) ? (new CompositeHeader(2, [this$.fields[0].Copy()])) : ((this$.tag === 1) ? (new CompositeHeader(1, [this$.fields[0].Copy()])) : ((this$.tag === 0) ? (new CompositeHeader(0, [this$.fields[0].Copy()])) : this$)));
492
492
  }
493
+ TryGetTerm() {
494
+ const this$ = this;
495
+ return (this$.tag === 3) ? this$.fields[0] : ((this$.tag === 2) ? this$.fields[0] : ((this$.tag === 1) ? this$.fields[0] : ((this$.tag === 0) ? this$.fields[0] : undefined)));
496
+ }
493
497
  static component(oa) {
494
498
  return new CompositeHeader(0, [oa]);
495
499
  }
package/Json/Assay.js CHANGED
@@ -71,7 +71,7 @@ export function ROCrate_genID(a) {
71
71
  return "#EmptyAssay";
72
72
  }
73
73
  else {
74
- return `#assay/${replace(matchValue, " ", "_")}`;
74
+ return `assays/${replace(matchValue, " ", "_")}/`;
75
75
  }
76
76
  }
77
77
 
package/Json/Decode.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Getters$2__get_Errors, Getters$2_$ctor_Z4BE6C149, string } from "../fable_modules/Thoth.Json.Core.0.4.0/Decode.fs.js";
2
- import { FSharpResult$2 } from "../fable_modules/fable-library-js.4.24.0/Result.js";
2
+ import { Result_Map, FSharpResult$2 } from "../fable_modules/fable-library-js.4.24.0/Result.js";
3
3
  import { printf, toText } from "../fable_modules/fable-library-js.4.24.0/String.js";
4
4
  import { ErrorReason$1 } from "../fable_modules/Thoth.Json.Core.0.4.0/Types.fs.js";
5
5
  import { exists } from "../fable_modules/fable-library-js.4.24.0/Seq.js";
@@ -76,7 +76,7 @@ export function Decode_noAdditionalProperties(allowedProperties, decoder) {
76
76
  };
77
77
  }
78
78
 
79
- export function Decode_resizeArray(decoder) {
79
+ export function Decode_resizeArrayOrSingleton(decoder) {
80
80
  return {
81
81
  Decode(helpers, value) {
82
82
  if (helpers.isArray(value)) {
@@ -101,7 +101,7 @@ export function Decode_resizeArray(decoder) {
101
101
  }, new FSharpResult$2(0, [[]]), helpers.asArray(value));
102
102
  }
103
103
  else {
104
- return new FSharpResult$2(1, [["", new ErrorReason$1(0, ["an array", value])]]);
104
+ return Result_Map((x) => [x], decoder.Decode(helpers, value));
105
105
  }
106
106
  },
107
107
  };
package/Json/Encode.js CHANGED
@@ -63,3 +63,12 @@ export function addPropertyToObject(name, value, obj) {
63
63
  }
64
64
  }
65
65
 
66
+ export function resizeArrayOrSingleton(encoder, values) {
67
+ if (values.length === 1) {
68
+ return encoder(values[0]);
69
+ }
70
+ else {
71
+ return seq(map_1(encoder, values));
72
+ }
73
+ }
74
+
@@ -10,6 +10,7 @@ import { ISAJson_decoder as ISAJson_decoder_5, ISAJson_encoder as ISAJson_encode
10
10
  import { concat, map as map_1 } from "../fable_modules/fable-library-js.4.24.0/Seq.js";
11
11
  import { list as list_1, resizeArray, string, object } from "../fable_modules/Thoth.Json.Core.0.4.0/Decode.fs.js";
12
12
  import { ArcInvestigation } from "../Core/ArcTypes.js";
13
+ import { toString, today } from "../fable_modules/fable-library-js.4.24.0/Date.js";
13
14
  import { context_jsonvalue } from "./context/rocrate/isa_investigation_context.js";
14
15
  import { createMissingIdentifier } from "../Core/Helper/Identifier.js";
15
16
  import { distinctBy } from "../fable_modules/fable-library-js.4.24.0/Seq2.js";
@@ -104,7 +105,7 @@ export function ROCrate_genID(i) {
104
105
  }
105
106
 
106
107
  export function ROCrate_encoder(oa) {
107
- let value, value_3, value_4;
108
+ let value, value_3, value_4, value_12, copyOfStruct;
108
109
  const values = choose((tupledArg) => map((v_1) => [tupledArg[0], v_1], tupledArg[1]), ofArray([["@id", (value = ROCrate_genID(oa), {
109
110
  Encode(helpers) {
110
111
  return helpers.encodeString(value);
@@ -137,11 +138,11 @@ export function ROCrate_encoder(oa) {
137
138
  Encode(helpers_7) {
138
139
  return helpers_7.encodeString(value_9);
139
140
  },
140
- }), oa.SubmissionDate), tryInclude("publicReleaseDate", (value_11) => ({
141
+ }), oa.SubmissionDate), ["publicReleaseDate", (value_12 = defaultArg(oa.PublicReleaseDate, (copyOfStruct = today(), toString(copyOfStruct, "yyyy-MM-dd"))), {
141
142
  Encode(helpers_8) {
142
- return helpers_8.encodeString(value_11);
143
+ return helpers_8.encodeString(value_12);
143
144
  },
144
- }), oa.PublicReleaseDate), tryIncludeSeq("ontologySourceReferences", ROCrate_encoder_1, oa.OntologySourceReferences), tryIncludeSeq("publications", ROCrate_encoder_2, oa.Publications), tryIncludeSeq("people", ROCrate_encoder_3, oa.Contacts), tryIncludeSeq("studies", (s) => ROCrate_encoder_4(undefined, s), oa.Studies), tryIncludeSeq("comments", ROCrate_encoder_5, oa.Comments), ["@context", context_jsonvalue]]));
145
+ })], tryIncludeSeq("ontologySourceReferences", ROCrate_encoder_1, oa.OntologySourceReferences), tryIncludeSeq("publications", ROCrate_encoder_2, oa.Publications), tryIncludeSeq("people", ROCrate_encoder_3, oa.Contacts), tryIncludeSeq("studies", (s) => ROCrate_encoder_4(undefined, s), oa.Studies), tryIncludeSeq("comments", ROCrate_encoder_5, oa.Comments), ["@context", context_jsonvalue]]));
145
146
  return {
146
147
  Encode(helpers_9) {
147
148
  const arg = map_1((tupledArg_1) => [tupledArg_1[0], tupledArg_1[1].Encode(helpers_9)], values);
@@ -3,9 +3,9 @@ import { unwrap, map } from "../fable_modules/fable-library-js.4.24.0/Option.js"
3
3
  import { tryIncludeSeq, tryInclude } from "./Encode.js";
4
4
  import { ISAJson_encoder as ISAJson_encoder_1, decoder as decoder_1, encoder as encoder_1 } from "./Comment.js";
5
5
  import { map as map_1 } from "../fable_modules/fable-library-js.4.24.0/Seq.js";
6
- import { string, object } from "../fable_modules/Thoth.Json.Core.0.4.0/Decode.fs.js";
6
+ import { resizeArray, string, object } from "../fable_modules/Thoth.Json.Core.0.4.0/Decode.fs.js";
7
7
  import { OntologySourceReference } from "../Core/OntologySourceReference.js";
8
- import { Decode_resizeArray, Decode_uri } from "./Decode.js";
8
+ import { Decode_uri } from "./Decode.js";
9
9
  import { replace } from "../fable_modules/fable-library-js.4.24.0/String.js";
10
10
  import { context_jsonvalue } from "./context/rocrate/isa_ontology_source_reference_context.js";
11
11
 
@@ -37,7 +37,7 @@ export function encoder(osr) {
37
37
 
38
38
  export const decoder = object((get$) => {
39
39
  let objectArg, objectArg_1, objectArg_2, objectArg_3, arg_9, objectArg_4;
40
- return new OntologySourceReference(unwrap((objectArg = get$.Optional, objectArg.Field("description", Decode_uri))), unwrap((objectArg_1 = get$.Optional, objectArg_1.Field("file", string))), unwrap((objectArg_2 = get$.Optional, objectArg_2.Field("name", string))), unwrap((objectArg_3 = get$.Optional, objectArg_3.Field("version", string))), unwrap((arg_9 = Decode_resizeArray(decoder_1), (objectArg_4 = get$.Optional, objectArg_4.Field("comments", arg_9)))));
40
+ return new OntologySourceReference(unwrap((objectArg = get$.Optional, objectArg.Field("description", Decode_uri))), unwrap((objectArg_1 = get$.Optional, objectArg_1.Field("file", string))), unwrap((objectArg_2 = get$.Optional, objectArg_2.Field("name", string))), unwrap((objectArg_3 = get$.Optional, objectArg_3.Field("version", string))), unwrap((arg_9 = resizeArray(decoder_1), (objectArg_4 = get$.Optional, objectArg_4.Field("comments", arg_9)))));
41
41
  });
42
42
 
43
43
  export function ROCrate_genID(o) {
@@ -93,7 +93,7 @@ export function ROCrate_encoder(osr) {
93
93
 
94
94
  export const ROCrate_decoder = object((get$) => {
95
95
  let objectArg, objectArg_1, objectArg_2, objectArg_3, arg_9, objectArg_4;
96
- return new OntologySourceReference(unwrap((objectArg = get$.Optional, objectArg.Field("description", Decode_uri))), unwrap((objectArg_1 = get$.Optional, objectArg_1.Field("file", string))), unwrap((objectArg_2 = get$.Optional, objectArg_2.Field("name", string))), unwrap((objectArg_3 = get$.Optional, objectArg_3.Field("version", string))), unwrap((arg_9 = Decode_resizeArray(decoder_1), (objectArg_4 = get$.Optional, objectArg_4.Field("comments", arg_9)))));
96
+ return new OntologySourceReference(unwrap((objectArg = get$.Optional, objectArg.Field("description", Decode_uri))), unwrap((objectArg_1 = get$.Optional, objectArg_1.Field("file", string))), unwrap((objectArg_2 = get$.Optional, objectArg_2.Field("name", string))), unwrap((objectArg_3 = get$.Optional, objectArg_3.Field("version", string))), unwrap((arg_9 = resizeArray(decoder_1), (objectArg_4 = get$.Optional, objectArg_4.Field("comments", arg_9)))));
97
97
  });
98
98
 
99
99
  export function ISAJson_encoder(idMap, osr) {
@@ -0,0 +1,121 @@
1
+ import { resizeArray, Getters$2__get_Errors, string, Getters$2_$ctor_Z4BE6C149 } from "../../fable_modules/Thoth.Json.Core.0.4.0/Decode.fs.js";
2
+ import { LDContext } from "../../ROCrate/LDContext.js";
3
+ import { disposeSafe, getEnumerator } from "../../fable_modules/fable-library-js.4.24.0/Util.js";
4
+ import { head, length, isEmpty } from "../../fable_modules/fable-library-js.4.24.0/List.js";
5
+ import { ErrorReason$1 } from "../../fable_modules/Thoth.Json.Core.0.4.0/Types.fs.js";
6
+ import { FSharpResult$2 } from "../../fable_modules/fable-library-js.4.24.0/Result.js";
7
+ import { initV1_1, initV1_2DRAFT } from "../../ROCrate/ROCrateContext.js";
8
+ import { empty, singleton, delay, toList, append, map } from "../../fable_modules/fable-library-js.4.24.0/Seq.js";
9
+ import { seq } from "../../fable_modules/Thoth.Json.Core.0.4.0/Encode.fs.js";
10
+
11
+ export const decoder = {
12
+ Decode(helpers, value) {
13
+ let objectArg;
14
+ const this$ = this;
15
+ if (helpers.isObject(value)) {
16
+ const getters = Getters$2_$ctor_Z4BE6C149(helpers, value);
17
+ const properties = helpers.getProperties(value);
18
+ let result;
19
+ const o = new LDContext();
20
+ const enumerator = getEnumerator(properties);
21
+ try {
22
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
23
+ const property = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
24
+ if ((property !== "@id") && (property !== "@type")) {
25
+ o.AddMapping(property, (objectArg = getters.Required, objectArg.Field(property, string)));
26
+ }
27
+ }
28
+ }
29
+ finally {
30
+ disposeSafe(enumerator);
31
+ }
32
+ result = o;
33
+ const matchValue = Getters$2__get_Errors(getters);
34
+ if (!isEmpty(matchValue)) {
35
+ const errors = matchValue;
36
+ return (length(errors) > 1) ? (new FSharpResult$2(1, [["", new ErrorReason$1(7, [errors])]])) : (new FSharpResult$2(1, [head(matchValue)]));
37
+ }
38
+ else {
39
+ return new FSharpResult$2(0, [result]);
40
+ }
41
+ }
42
+ else if (helpers.isString(value)) {
43
+ const s = helpers.asString(value);
44
+ return (s === "https://w3id.org/ro/crate/1.2-DRAFT/context") ? (new FSharpResult$2(0, [initV1_2DRAFT()])) : ((s === "https://w3id.org/ro/crate/1.1/context") ? (new FSharpResult$2(0, [initV1_1()])) : (new FSharpResult$2(1, [["", new ErrorReason$1(0, ["an object", value])]])));
45
+ }
46
+ else if (helpers.isArray(value)) {
47
+ const matchValue_1 = resizeArray(this$).Decode(helpers, value);
48
+ return (matchValue_1.tag === 1) ? (new FSharpResult$2(1, [matchValue_1.fields[0]])) : (new FSharpResult$2(0, [new LDContext(undefined, matchValue_1.fields[0])]));
49
+ }
50
+ else {
51
+ return new FSharpResult$2(1, [["", new ErrorReason$1(0, ["an object", value])]]);
52
+ }
53
+ },
54
+ };
55
+
56
+ export function encoder(ctx_mut) {
57
+ let source_4;
58
+ encoder:
59
+ while (true) {
60
+ const ctx = ctx_mut;
61
+ const matchValue = ctx.Name;
62
+ let matchResult;
63
+ if (matchValue != null) {
64
+ switch (matchValue) {
65
+ case "https://w3id.org/ro/crate/1.2-DRAFT/context": {
66
+ matchResult = 0;
67
+ break;
68
+ }
69
+ case "https://w3id.org/ro/crate/1.1/context": {
70
+ matchResult = 1;
71
+ break;
72
+ }
73
+ default:
74
+ matchResult = 2;
75
+ }
76
+ }
77
+ else {
78
+ matchResult = 2;
79
+ }
80
+ switch (matchResult) {
81
+ case 0:
82
+ return {
83
+ Encode(helpers) {
84
+ return helpers.encodeString("https://w3id.org/ro/crate/1.2-DRAFT/context");
85
+ },
86
+ };
87
+ case 1:
88
+ return {
89
+ Encode(helpers_1) {
90
+ return helpers_1.encodeString("https://w3id.org/ro/crate/1.1/context");
91
+ },
92
+ };
93
+ default: {
94
+ let mappings;
95
+ const values = map((kv) => [kv[0], {
96
+ Encode(helpers_2) {
97
+ return helpers_2.encodeString(kv[1]);
98
+ },
99
+ }], ctx.Mappings);
100
+ mappings = {
101
+ Encode(helpers_3) {
102
+ const arg = map((tupledArg) => [tupledArg[0], tupledArg[1].Encode(helpers_3)], values);
103
+ return helpers_3.encodeObject(arg);
104
+ },
105
+ };
106
+ if (ctx.BaseContexts.length === 0) {
107
+ return mappings;
108
+ }
109
+ else if ((ctx.BaseContexts.length === 1) && (ctx.Mappings.size === 0)) {
110
+ ctx_mut = ctx.BaseContexts[0];
111
+ continue encoder;
112
+ }
113
+ else {
114
+ return seq((source_4 = map(encoder, ctx.BaseContexts), append(toList(delay(() => ((ctx.Mappings.size !== 0) ? singleton(mappings) : empty()))), source_4)));
115
+ }
116
+ }
117
+ }
118
+ break;
119
+ }
120
+ }
121
+
@@ -0,0 +1,87 @@
1
+ import { head, length, isEmpty, choose } from "../../fable_modules/fable-library-js.4.24.0/List.js";
2
+ import { unwrap, map } from "../../fable_modules/fable-library-js.4.24.0/Option.js";
3
+ import { map as map_1, empty, collect, singleton, append, delay, toList } from "../../fable_modules/fable-library-js.4.24.0/Seq.js";
4
+ import { tryInclude } from "../Encode.js";
5
+ import { decoder as decoder_1, encoder as encoder_1 } from "./LDContext.js";
6
+ import { genericDecoder, decoder as decoder_2, encoder as encoder_2, genericEncoder } from "./LDNode.js";
7
+ import { seq } from "../../fable_modules/Thoth.Json.Core.0.4.0/Encode.fs.js";
8
+ import { Getters$2__get_Errors, seq as seq_1, string, Getters$2_$ctor_Z4BE6C149 } from "../../fable_modules/Thoth.Json.Core.0.4.0/Decode.fs.js";
9
+ import { LDGraph } from "../../ROCrate/LDObject.js";
10
+ import { disposeSafe, getEnumerator } from "../../fable_modules/fable-library-js.4.24.0/Util.js";
11
+ import { ErrorReason$1 } from "../../fable_modules/Thoth.Json.Core.0.4.0/Types.fs.js";
12
+ import { FSharpResult$2 } from "../../fable_modules/fable-library-js.4.24.0/Result.js";
13
+
14
+ export function encoder(obj) {
15
+ const values_1 = choose((tupledArg) => map((v_1) => [tupledArg[0], v_1], tupledArg[1]), toList(delay(() => append(singleton(tryInclude("@id", (value) => ({
16
+ Encode(helpers) {
17
+ return helpers.encodeString(value);
18
+ },
19
+ }), obj.Id)), delay(() => append(singleton(tryInclude("@context", encoder_1, obj.TryGetContext())), delay(() => append(collect((kv) => {
20
+ const l = kv[0].toLocaleLowerCase();
21
+ return ((((l !== "id") && (l !== "@context")) && (l !== "nodes")) && (l !== "mappings")) ? singleton([kv[0], genericEncoder(kv[1])]) : empty();
22
+ }, obj.GetProperties(true)), delay(() => singleton(["@graph", seq(map_1(encoder_2, obj.Nodes))]))))))))));
23
+ return {
24
+ Encode(helpers_1) {
25
+ const arg = map_1((tupledArg_1) => [tupledArg_1[0], tupledArg_1[1].Encode(helpers_1)], values_1);
26
+ return helpers_1.encodeObject(arg);
27
+ },
28
+ };
29
+ }
30
+
31
+ export const decoder = {
32
+ Decode(helpers, value) {
33
+ let objectArg_3;
34
+ if (helpers.isObject(value)) {
35
+ const getters = Getters$2_$ctor_Z4BE6C149(helpers, value);
36
+ const properties = helpers.getProperties(value);
37
+ let result;
38
+ const get$ = getters;
39
+ let id;
40
+ const objectArg = get$.Optional;
41
+ id = objectArg.Field("@id", string);
42
+ let context;
43
+ const objectArg_1 = get$.Optional;
44
+ context = objectArg_1.Field("@context", decoder_1);
45
+ let nodes;
46
+ const arg_5 = seq_1(decoder_2);
47
+ const objectArg_2 = get$.Required;
48
+ nodes = objectArg_2.Field("@graph", arg_5);
49
+ const o = new LDGraph(unwrap(id), undefined, unwrap(context));
50
+ const enumerator = getEnumerator(properties);
51
+ try {
52
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
53
+ const property = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
54
+ if (((property !== "@id") && (property !== "@graph")) && (property !== "@context")) {
55
+ o.SetProperty(property, (objectArg_3 = get$.Required, objectArg_3.Field(property, genericDecoder)));
56
+ }
57
+ }
58
+ }
59
+ finally {
60
+ disposeSafe(enumerator);
61
+ }
62
+ const enumerator_1 = getEnumerator(nodes);
63
+ try {
64
+ while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
65
+ const node = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
66
+ o.AddNode(node);
67
+ }
68
+ }
69
+ finally {
70
+ disposeSafe(enumerator_1);
71
+ }
72
+ result = o;
73
+ const matchValue = Getters$2__get_Errors(getters);
74
+ if (!isEmpty(matchValue)) {
75
+ const errors = matchValue;
76
+ return (length(errors) > 1) ? (new FSharpResult$2(1, [["", new ErrorReason$1(7, [errors])]])) : (new FSharpResult$2(1, [head(matchValue)]));
77
+ }
78
+ else {
79
+ return new FSharpResult$2(0, [result]);
80
+ }
81
+ }
82
+ else {
83
+ return new FSharpResult$2(1, [["", new ErrorReason$1(0, ["an object", value])]]);
84
+ }
85
+ },
86
+ };
87
+