@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.
- package/ARC.js +103 -12
- package/CWL/CWLTypes.js +2 -2
- package/CWL/Decode.js +2 -2
- package/CWL/Inputs.js +2 -2
- package/CWL/Outputs.js +2 -2
- package/CWL/Requirements.js +2 -2
- package/CWL/ToolDescription.js +1 -1
- package/CWL/WorkflowDescription.js +1 -1
- package/CWL/WorkflowSteps.js +1 -1
- package/ColumnIndex.js +258 -0
- package/Conversion.js +1679 -0
- package/Core/Data.js +28 -3
- package/Core/DataFile.js +19 -3
- package/Core/Helper/Collections.js +107 -4
- package/Core/Helper/DateTime.js +17 -0
- package/Core/Helper/ORCID.js +39 -0
- package/Json/Decode.js +3 -3
- package/Json/Encode.js +9 -0
- package/Json/OntologySourceReference.js +4 -4
- package/Json/ROCrate/LDContext.js +121 -0
- package/Json/ROCrate/LDGraph.js +87 -0
- package/Json/{LDObject.js → ROCrate/LDNode.js} +55 -46
- package/Json/ROCrate/LDRef.js +25 -0
- package/Json/ROCrate/LDValue.js +66 -0
- package/JsonIO/LDObject.js +30 -5
- package/ROCrate/ArcROCrateMetadata.js +14 -13
- package/ROCrate/Generic/Comment.js +115 -0
- package/ROCrate/Generic/Dataset.js +669 -0
- package/ROCrate/Generic/DefinedTerm.js +115 -0
- package/ROCrate/Generic/File.js +200 -0
- package/ROCrate/Generic/LabProcess.js +238 -0
- package/ROCrate/Generic/LabProtocol.js +275 -0
- package/ROCrate/Generic/Organization.js +71 -0
- package/ROCrate/Generic/Person.js +411 -0
- package/ROCrate/Generic/PostalAddress.js +159 -0
- package/ROCrate/Generic/PropertyValue.js +548 -0
- package/ROCrate/Generic/Sample.js +139 -0
- package/ROCrate/Generic/ScholarlyArticle.js +187 -0
- package/ROCrate/Helper.js +6 -0
- package/ROCrate/ISAProfile/Assay.js +3 -3
- package/ROCrate/ISAProfile/Data.js +7 -7
- package/ROCrate/ISAProfile/Dataset.js +7 -6
- package/ROCrate/ISAProfile/Investigation.js +3 -3
- package/ROCrate/ISAProfile/LabProcess.js +7 -7
- package/ROCrate/ISAProfile/LabProtocol.js +7 -7
- package/ROCrate/ISAProfile/Person.js +7 -7
- package/ROCrate/ISAProfile/PropertyValue.js +7 -7
- package/ROCrate/ISAProfile/Sample.js +7 -7
- package/ROCrate/ISAProfile/ScholarlyArticle.js +7 -7
- package/ROCrate/ISAProfile/Study.js +3 -3
- package/ROCrate/LDContext.js +283 -0
- package/ROCrate/LDObject.js +902 -36
- package/ROCrate/ROCrateContext.js +44 -0
- package/ROCrateIO.js +62 -0
- package/Spreadsheet/DataMapTable/DataMapHeader.js +3 -2
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynObj.fs +31 -1
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynObj.fs.js +30 -1
- package/fable_modules/DynamicObj.7.0.1/DynamicObj.fs +1025 -0
- package/fable_modules/DynamicObj.7.0.1/DynamicObj.fs.js +433 -0
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FableJS.fs +16 -0
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FablePy.fs +14 -0
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/HashCodes.fs +15 -0
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/HashCodes.fs.js +4 -0
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Debug/netstandard2.0/DynamicObj.AssemblyInfo.fs +1 -1
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Release/netstandard2.0/DynamicObj.AssemblyInfo.fs +3 -3
- package/fable_modules/project_cracked.json +1 -1
- package/package.json +1 -1
- package/Json/ARC.js +0 -31
- package/JsonIO/ARC.js +0 -31
- package/fable_modules/DynamicObj.4.0.3/DynamicObj.fs +0 -310
- package/fable_modules/DynamicObj.4.0.3/DynamicObj.fs.js +0 -166
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynamicObj.fableproj +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FableJS.fs.js +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/PropertyHelper.fs +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/PropertyHelper.fs.js +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/ReflectionUtils.fs +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/ReflectionUtils.fs.js +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
- /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
|
|
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 [
|
|
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 "
|
|
34
|
+
return "Derived Data File";
|
|
35
35
|
case 2:
|
|
36
|
-
return "
|
|
36
|
+
return "Image File";
|
|
37
37
|
default:
|
|
38
|
-
return "
|
|
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 {
|
|
4
|
-
import {
|
|
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 (!
|
|
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
|
+
|
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
|
|
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
|
|
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
|
+
|
|
@@ -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 {
|
|
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 =
|
|
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 =
|
|
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
|
+
|