@nfdi4plants/arctrl 2.0.0-alpha.7 → 2.0.0-alpha.8

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/Json/Assay.js CHANGED
@@ -13,17 +13,18 @@ import { Decode_objectNoAdditionalProperties, Decode_resizeArray } from "./Decod
13
13
  import { toFail, printf, toText, replace } from "../fable_modules/fable-library-js.4.16.0/String.js";
14
14
  import { Assay_tryIdentifierFromFileName, createMissingIdentifier, Assay_fileNameFromIdentifier } from "../Core/Helper/Identifier.js";
15
15
  import { JsonTypes_decomposeTechnologyPlatform, JsonTypes_composeTechnologyPlatform, ARCtrl_ArcTables__ArcTables_fromProcesses_Static_62A3309D, ARCtrl_ArcTables__ArcTables_GetProcesses } from "../Core/Conversion.js";
16
- import { getUnits, getCharacteristics, getData } from "../Core/Process/ProcessSequence.js";
16
+ import { getCharacteristics, getUnits, getData } from "../Core/Process/ProcessSequence.js";
17
17
  import { list as list_1 } from "../fable_modules/Thoth.Json.Core.0.2.1/Encode.fs.js";
18
18
  import { Data_ISAJson_encoder, Data_ROCrate_encoder } from "./Process/Data.js";
19
19
  import { Process_ISAJson_decoder, Process_ISAJson_encoder, Process_ROCrate_decoder, Process_ROCrate_encoder } from "./Process/Process.js";
20
20
  import { context_jsonvalue } from "./context/rocrate/isa_assay_context.js";
21
- import { encoder } from "./Process/AssayMaterials.js";
22
- import { Option_fromValueWithDefault } from "../Core/Helper/Collections.js";
23
21
  import { MaterialAttribute_ISAJson_encoder } from "./Process/MaterialAttribute.js";
22
+ import { encoder as encoder_3 } from "./Process/AssayMaterials.js";
23
+ import { Option_fromValueWithDefault } from "../Core/Helper/Collections.js";
24
+ import { encode } from "./IDTable.js";
24
25
  import { fromString } from "../fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs.js";
25
26
  import { toString } from "../fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js";
26
- import { encode, decode } from "./Table/Compression.js";
27
+ import { encode as encode_1, decode } from "./Table/Compression.js";
27
28
 
28
29
  export function Assay_encoder(assay) {
29
30
  return new Json(5, [choose((tupledArg) => {
@@ -97,21 +98,32 @@ export const Assay_ROCrate_decoder = object((get$) => {
97
98
  return new ArcAssay(identifier, unwrap((objectArg_2 = get$.Optional, objectArg_2.Field("measurementType", OntologyAnnotation_ROCrate_decoderPropertyValue))), unwrap((objectArg_3 = get$.Optional, objectArg_3.Field("technologyType", OntologyAnnotation_ROCrate_decoderDefinedTerm))), unwrap((objectArg_4 = get$.Optional, objectArg_4.Field("technologyPlatform", OntologyAnnotation_ROCrate_decoderDefinedTerm))), unwrap(tables), void 0, unwrap((arg_12 = Decode_resizeArray(Person_ROCrate_decoder), (objectArg_5 = get$.Optional, objectArg_5.Field("performers", arg_12)))), unwrap((arg_14 = Decode_resizeArray(Comment_ROCrate_decoder), (objectArg_6 = get$.Optional, objectArg_6.Field("comments", arg_14)))));
98
99
  });
99
100
 
100
- export function Assay_ISAJson_encoder(a) {
101
- const fileName = Assay_fileNameFromIdentifier(a.Identifier);
102
- const processes = ARCtrl_ArcTables__ArcTables_GetProcesses(a);
103
- const dataFiles = getData(processes);
104
- const characteristics = getCharacteristics(processes);
105
- const units = getUnits(processes);
106
- return new Json(5, [choose((tupledArg) => {
107
- const v = tupledArg[1];
108
- if (equals(v, new Json(3, []))) {
109
- return void 0;
110
- }
111
- else {
112
- return [tupledArg[0], v];
113
- }
114
- }, ofArray([["filename", new Json(0, [fileName])], tryInclude("measurementType", OntologyAnnotation_ISAJson_encoder, a.MeasurementType), tryInclude("technologyType", OntologyAnnotation_ISAJson_encoder, a.TechnologyType), tryInclude("technologyPlatform", (value_1) => (new Json(0, [value_1])), map(JsonTypes_composeTechnologyPlatform, a.TechnologyPlatform)), tryIncludeList("dataFiles", Data_ISAJson_encoder, dataFiles), tryInclude("materials", encoder, Option_fromValueWithDefault(empty(), processes)), tryIncludeList("characteristicCategories", MaterialAttribute_ISAJson_encoder, characteristics), tryIncludeList("unitCategories", OntologyAnnotation_ISAJson_encoder, units), tryIncludeList("processSequence", Process_ISAJson_encoder, processes), tryIncludeSeq("comments", Comment_ISAJson_encoder, a.Comments)]))]);
101
+ export function Assay_ISAJson_encoder(studyName, idMap, a) {
102
+ const f = (a_1) => {
103
+ let assayName;
104
+ const fileName = Assay_fileNameFromIdentifier(a_1.Identifier);
105
+ const processes = ARCtrl_ArcTables__ArcTables_GetProcesses(a_1);
106
+ const encodedUnits = tryIncludeList("unitCategories", (oa) => OntologyAnnotation_ISAJson_encoder(idMap, oa), getUnits(processes));
107
+ const encodedCharacteristics = tryIncludeList("characteristicCategories", (value_1) => MaterialAttribute_ISAJson_encoder(idMap, value_1), getCharacteristics(processes));
108
+ const encodedMaterials = tryInclude("materials", (ps) => encoder_3(idMap, ps), Option_fromValueWithDefault(empty(), processes));
109
+ const encocedDataFiles = tryIncludeList("dataFiles", (oa_1) => Data_ISAJson_encoder(idMap, oa_1), getData(processes));
110
+ const units = getUnits(processes);
111
+ return new Json(5, [choose((tupledArg) => {
112
+ const v = tupledArg[1];
113
+ if (equals(v, new Json(3, []))) {
114
+ return void 0;
115
+ }
116
+ else {
117
+ return [tupledArg[0], v];
118
+ }
119
+ }, ofArray([["filename", new Json(0, [fileName])], tryInclude("@id", (value_5) => (new Json(0, [value_5])), Assay_ROCrate_genID(a_1)), tryInclude("measurementType", (oa_2) => OntologyAnnotation_ISAJson_encoder(idMap, oa_2), a_1.MeasurementType), tryInclude("technologyType", (oa_3) => OntologyAnnotation_ISAJson_encoder(idMap, oa_3), a_1.TechnologyType), tryInclude("technologyPlatform", (value_7) => (new Json(0, [value_7])), map(JsonTypes_composeTechnologyPlatform, a_1.TechnologyPlatform)), encocedDataFiles, encodedMaterials, encodedCharacteristics, encodedUnits, tryIncludeList("processSequence", (assayName = a_1.Identifier, (oa_4) => Process_ISAJson_encoder(studyName, assayName, idMap, oa_4)), processes), tryIncludeSeq("comments", (comment) => Comment_ISAJson_encoder(idMap, comment), a_1.Comments)]))]);
120
+ };
121
+ if (idMap != null) {
122
+ return encode(Assay_ROCrate_genID, f, a, idMap);
123
+ }
124
+ else {
125
+ return f(a);
126
+ }
115
127
  }
116
128
 
117
129
  export const Assay_ISAJson_allowedFields = ofArray(["@id", "filename", "measurementType", "technologyType", "technologyPlatform", "dataFiles", "materials", "characteristicCategories", "unitCategories", "processSequence", "comments", "@type", "@context"]);
@@ -164,7 +176,7 @@ export function ARCtrl_ArcAssay__ArcAssay_fromCompressedJsonString_Static_Z721C8
164
176
  }
165
177
 
166
178
  export function ARCtrl_ArcAssay__ArcAssay_toCompressedJsonString_Static_71136F3F(spaces) {
167
- return (obj) => toString(defaultArg(spaces, 0), encode(Assay_encoderCompressed, obj));
179
+ return (obj) => toString(defaultArg(spaces, 0), encode_1(Assay_encoderCompressed, obj));
168
180
  }
169
181
 
170
182
  export function ARCtrl_ArcAssay__ArcAssay_ToCompressedJsonString_71136F3F(this$, spaces) {
@@ -195,9 +207,10 @@ export function ARCtrl_ArcAssay__ArcAssay_ToROCrateJsonString_5CABCA47(this$, st
195
207
  return ARCtrl_ArcAssay__ArcAssay_toROCrateJsonString_Static_5CABCA47(unwrap(studyName), unwrap(spaces))(this$);
196
208
  }
197
209
 
198
- export function ARCtrl_ArcAssay__ArcAssay_toISAJsonString_Static_71136F3F(spaces) {
210
+ export function ARCtrl_ArcAssay__ArcAssay_toISAJsonString_Static_Z3B036AA(spaces, useIDReferencing) {
211
+ const idMap = defaultArg(useIDReferencing, false) ? (new Map([])) : void 0;
199
212
  return (obj) => {
200
- const value = Assay_ISAJson_encoder(obj);
213
+ const value = Assay_ISAJson_encoder(void 0, idMap, obj);
201
214
  return toString(defaultSpaces(spaces), value);
202
215
  };
203
216
  }
@@ -212,7 +225,7 @@ export function ARCtrl_ArcAssay__ArcAssay_fromISAJsonString_Static_Z721C83C5(s)
212
225
  }
213
226
  }
214
227
 
215
- export function ARCtrl_ArcAssay__ArcAssay_ToISAJsonString_71136F3F(this$, spaces) {
216
- return ARCtrl_ArcAssay__ArcAssay_toISAJsonString_Static_71136F3F(unwrap(spaces))(this$);
228
+ export function ARCtrl_ArcAssay__ArcAssay_ToISAJsonString_Z3B036AA(this$, spaces, useIDReferencing) {
229
+ return ARCtrl_ArcAssay__ArcAssay_toISAJsonString_Static_Z3B036AA(unwrap(spaces), unwrap(useIDReferencing))(this$);
217
230
  }
218
231
 
package/Json/Comment.js CHANGED
@@ -9,6 +9,7 @@ import { printf, toText, replace } from "../fable_modules/fable-library-js.4.16.
9
9
  import { context_jsonvalue } from "./context/rocrate/isa_comment_context.js";
10
10
  import { toString } from "../fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js";
11
11
  import { fromString } from "../fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs.js";
12
+ import { encode } from "./IDTable.js";
12
13
 
13
14
  export function Comment_encoder(comment) {
14
15
  return new Json(5, [choose((tupledArg) => {
@@ -70,7 +71,23 @@ export const Comment_ROCrate_decoderDisambiguatingDescription = map((s) => {
70
71
  }
71
72
  }, string);
72
73
 
73
- export const Comment_ISAJson_encoder = Comment_encoder;
74
+ export function Comment_ISAJson_encoder(idMap, comment) {
75
+ const f = (comment_1) => (new Json(5, [choose((tupledArg) => {
76
+ const v = tupledArg[1];
77
+ if (equals(v, new Json(3, []))) {
78
+ return void 0;
79
+ }
80
+ else {
81
+ return [tupledArg[0], v];
82
+ }
83
+ }, ofArray([tryInclude("@id", (value) => (new Json(0, [value])), Comment_ROCrate_genID(comment_1)), tryInclude("name", (value_2) => (new Json(0, [value_2])), comment_1.Name), tryInclude("value", (value_4) => (new Json(0, [value_4])), comment_1.Value)]))]));
84
+ if (idMap == null) {
85
+ return f(comment);
86
+ }
87
+ else {
88
+ return encode(Comment_ROCrate_genID, f, comment, idMap);
89
+ }
90
+ }
74
91
 
75
92
  export const Comment_ISAJson_decoder = Comment_decoder;
76
93
 
@@ -131,7 +148,7 @@ export function ARCtrl_Comment__Comment_fromISAJsonString_Static_Z721C83C5(s) {
131
148
 
132
149
  export function ARCtrl_Comment__Comment_toISAJsonString_Static_71136F3F(spaces) {
133
150
  return (c) => {
134
- const value = Comment_ISAJson_encoder(c);
151
+ const value = Comment_ISAJson_encoder(void 0, c);
135
152
  return toString(defaultSpaces(spaces), value);
136
153
  };
137
154
  }
@@ -0,0 +1,19 @@
1
+ import { Json } from "../fable_modules/Thoth.Json.Core.0.2.1/Types.fs.js";
2
+ import { addToDict } from "../fable_modules/fable-library-js.4.16.0/MapUtil.js";
3
+
4
+ export function encodeID(id) {
5
+ return new Json(5, [[["@id", new Json(0, [id])]]]);
6
+ }
7
+
8
+ export function encode(genID, encoder, value, table) {
9
+ const id = genID(value);
10
+ if (table.has(id)) {
11
+ return encodeID(id);
12
+ }
13
+ else {
14
+ const v = encoder(value);
15
+ addToDict(table, genID(value), v);
16
+ return v;
17
+ }
18
+ }
19
+
@@ -110,7 +110,7 @@ export function Investigation_ROCrate_encodeRoCrate(oa) {
110
110
 
111
111
  export const Investigation_ISAJson_allowedFields = ofArray(["@id", "filename", "identifier", "title", "description", "submissionDate", "publicReleaseDate", "ontologySourceReferences", "publications", "people", "studies", "comments", "@type", "@context"]);
112
112
 
113
- export function Investigation_ISAJson_encoder(inv) {
113
+ export function Investigation_ISAJson_encoder(idMap, inv) {
114
114
  return new Json(5, [choose((tupledArg) => {
115
115
  const v = tupledArg[1];
116
116
  if (equals(v, new Json(3, []))) {
@@ -119,7 +119,7 @@ export function Investigation_ISAJson_encoder(inv) {
119
119
  else {
120
120
  return [tupledArg[0], v];
121
121
  }
122
- }, ofArray([["filename", new Json(0, [ArcInvestigation.FileName])], ["identifier", new Json(0, [inv.Identifier])], tryInclude("title", (value_2) => (new Json(0, [value_2])), inv.Title), tryInclude("description", (value_4) => (new Json(0, [value_4])), inv.Description), tryInclude("submissionDate", (value_6) => (new Json(0, [value_6])), inv.SubmissionDate), tryInclude("publicReleaseDate", (value_8) => (new Json(0, [value_8])), inv.PublicReleaseDate), tryIncludeSeq("ontologySourceReferences", OntologySourceReference_ISAJson_encoder, inv.OntologySourceReferences), tryIncludeSeq("publications", Publication_ISAJson_encoder, inv.Publications), tryIncludeSeq("people", Person_ISAJson_encoder, inv.Contacts), tryIncludeSeq("studies", (s) => Study_ISAJson_encoder(void 0, s), inv.Studies), tryIncludeSeq("comments", Comment_ISAJson_encoder, inv.Comments)]))]);
122
+ }, ofArray([["@id", new Json(0, [Investigation_ROCrate_genID(inv)])], ["filename", new Json(0, [ArcInvestigation.FileName])], ["identifier", new Json(0, [inv.Identifier])], tryInclude("title", (value_3) => (new Json(0, [value_3])), inv.Title), tryInclude("description", (value_5) => (new Json(0, [value_5])), inv.Description), tryInclude("submissionDate", (value_7) => (new Json(0, [value_7])), inv.SubmissionDate), tryInclude("publicReleaseDate", (value_9) => (new Json(0, [value_9])), inv.PublicReleaseDate), tryIncludeSeq("ontologySourceReferences", (osr) => OntologySourceReference_ISAJson_encoder(idMap, osr), inv.OntologySourceReferences), tryIncludeSeq("publications", (oa) => Publication_ISAJson_encoder(idMap, oa), inv.Publications), tryIncludeSeq("people", (person) => Person_ISAJson_encoder(idMap, person), inv.Contacts), tryIncludeSeq("studies", (s) => Study_ISAJson_encoder(idMap, void 0, s), inv.Studies), tryIncludeSeq("comments", (comment) => Comment_ISAJson_encoder(idMap, comment), inv.Comments)]))]);
123
123
  }
124
124
 
125
125
  export const Investigation_ISAJson_decoder = Decode_objectNoAdditionalProperties(Investigation_ISAJson_allowedFields, (get$) => {
@@ -213,9 +213,10 @@ export function ARCtrl_ArcInvestigation__ArcInvestigation_ToROCrateJsonString_71
213
213
  return ARCtrl_ArcInvestigation__ArcInvestigation_toROCrateJsonString_Static_71136F3F(unwrap(spaces))(this$);
214
214
  }
215
215
 
216
- export function ARCtrl_ArcInvestigation__ArcInvestigation_toISAJsonString_Static_71136F3F(spaces) {
216
+ export function ARCtrl_ArcInvestigation__ArcInvestigation_toISAJsonString_Static_Z3B036AA(spaces, useIDReferencing) {
217
+ const idMap = defaultArg(useIDReferencing, false) ? (new Map([])) : void 0;
217
218
  return (obj) => {
218
- const value = Investigation_ISAJson_encoder(obj);
219
+ const value = Investigation_ISAJson_encoder(idMap, obj);
219
220
  return toString(defaultSpaces(spaces), value);
220
221
  };
221
222
  }
@@ -230,7 +231,7 @@ export function ARCtrl_ArcInvestigation__ArcInvestigation_fromISAJsonString_Stat
230
231
  }
231
232
  }
232
233
 
233
- export function ARCtrl_ArcInvestigation__ArcInvestigation_ToISAJsonString_71136F3F(this$, spaces) {
234
- return ARCtrl_ArcInvestigation__ArcInvestigation_toISAJsonString_Static_71136F3F(unwrap(spaces))(this$);
234
+ export function ARCtrl_ArcInvestigation__ArcInvestigation_ToISAJsonString_Z3B036AA(this$, spaces, useIDReferencing) {
235
+ return ARCtrl_ArcInvestigation__ArcInvestigation_toISAJsonString_Static_Z3B036AA(unwrap(spaces), unwrap(useIDReferencing))(this$);
235
236
  }
236
237
 
@@ -12,6 +12,9 @@ import { printf, toText, replace } from "../fable_modules/fable-library-js.4.16.
12
12
  import { URIModule_toString } from "../Core/URI.js";
13
13
  import { context_jsonvalue } from "./context/rocrate/isa_ontology_annotation_context.js";
14
14
  import { context_jsonvalue as context_jsonvalue_1 } from "./context/rocrate/property_value_context.js";
15
+ import { filter } from "../fable_modules/fable-library-js.4.16.0/Seq.js";
16
+ import { orderName } from "../Core/Process/ColumnIndex.js";
17
+ import { encode } from "./IDTable.js";
15
18
  import { fromString } from "../fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs.js";
16
19
  import { toString } from "../fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js";
17
20
 
@@ -109,7 +112,47 @@ export const OntologyAnnotation_ROCrate_decoderPropertyValue = object((get$) =>
109
112
  return OntologyAnnotation.create(unwrap((objectArg = get$.Optional, objectArg.Field("category", string))), void 0, unwrap((objectArg_1 = get$.Optional, objectArg_1.Field("categoryCode", string))), unwrap((arg_5 = Decode_resizeArray(Comment_ROCrate_decoderDisambiguatingDescription), (objectArg_2 = get$.Optional, objectArg_2.Field("comments", arg_5)))));
110
113
  });
111
114
 
112
- export const OntologyAnnotation_ISAJson_encoder = OntologyAnnotation_encoder;
115
+ export function OntologyAnnotation_ISAJson_encoder(idMap, oa) {
116
+ const f = (oa_1) => {
117
+ const comments = filter((c) => {
118
+ const matchValue = c.Name;
119
+ let matchResult, n_1;
120
+ if (matchValue != null) {
121
+ if (matchValue === orderName) {
122
+ matchResult = 0;
123
+ n_1 = matchValue;
124
+ }
125
+ else {
126
+ matchResult = 1;
127
+ }
128
+ }
129
+ else {
130
+ matchResult = 1;
131
+ }
132
+ switch (matchResult) {
133
+ case 0:
134
+ return false;
135
+ default:
136
+ return true;
137
+ }
138
+ }, oa_1.Comments);
139
+ return new Json(5, [choose((tupledArg) => {
140
+ const v = tupledArg[1];
141
+ if (equals(v, new Json(3, []))) {
142
+ return void 0;
143
+ }
144
+ else {
145
+ return [tupledArg[0], v];
146
+ }
147
+ }, ofArray([tryInclude("@id", (value) => (new Json(0, [value])), OntologyAnnotation_ROCrate_genID(oa_1)), tryInclude("annotationValue", (value_2) => (new Json(0, [value_2])), oa_1.Name), tryInclude("termSource", (value_4) => (new Json(0, [value_4])), oa_1.TermSourceREF), tryInclude("termAccession", (value_6) => (new Json(0, [value_6])), oa_1.TermAccessionNumber), tryIncludeSeq("comments", Comment_encoder, comments)]))]);
148
+ };
149
+ if (idMap != null) {
150
+ return encode(OntologyAnnotation_ROCrate_genID, f, oa, idMap);
151
+ }
152
+ else {
153
+ return f(oa);
154
+ }
155
+ }
113
156
 
114
157
  export const OntologyAnnotation_ISAJson_decoder = OntologyAnnotation_decoder;
115
158
 
@@ -170,7 +213,7 @@ export function ARCtrl_OntologyAnnotation__OntologyAnnotation_fromISAJsonString_
170
213
 
171
214
  export function ARCtrl_OntologyAnnotation__OntologyAnnotation_toISAJsonString_Static_71136F3F(spaces) {
172
215
  return (obj) => {
173
- const value = OntologyAnnotation_ISAJson_encoder(obj);
216
+ const value = OntologyAnnotation_ISAJson_encoder(void 0, obj);
174
217
  return toString(defaultSpaces(spaces), value);
175
218
  };
176
219
  }
@@ -2,7 +2,7 @@ import { ofArray, choose } from "../fable_modules/fable-library-js.4.16.0/List.j
2
2
  import { equals } from "../fable_modules/fable-library-js.4.16.0/Util.js";
3
3
  import { Json } from "../fable_modules/Thoth.Json.Core.0.2.1/Types.fs.js";
4
4
  import { defaultSpaces, tryIncludeSeq, tryInclude } from "./Encode.js";
5
- import { Comment_decoder, Comment_encoder } from "./Comment.js";
5
+ import { Comment_ISAJson_encoder, Comment_decoder, Comment_encoder } from "./Comment.js";
6
6
  import { string, object } from "../fable_modules/Thoth.Json.Core.0.2.1/Decode.fs.js";
7
7
  import { OntologySourceReference } from "../Core/OntologySourceReference.js";
8
8
  import { unwrap } from "../fable_modules/fable-library-js.4.16.0/Option.js";
@@ -62,7 +62,17 @@ export const OntologySourceReference_ROCrate_decoder = object((get$) => {
62
62
  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(Comment_decoder), (objectArg_4 = get$.Optional, objectArg_4.Field("comments", arg_9)))));
63
63
  });
64
64
 
65
- export const OntologySourceReference_ISAJson_encoder = OntologySourceReference_encoder;
65
+ export function OntologySourceReference_ISAJson_encoder(idMap, osr) {
66
+ return new Json(5, [choose((tupledArg) => {
67
+ const v = tupledArg[1];
68
+ if (equals(v, new Json(3, []))) {
69
+ return void 0;
70
+ }
71
+ else {
72
+ return [tupledArg[0], v];
73
+ }
74
+ }, ofArray([tryInclude("description", (value) => (new Json(0, [value])), osr.Description), tryInclude("file", (value_2) => (new Json(0, [value_2])), osr.File), tryInclude("name", (value_4) => (new Json(0, [value_4])), osr.Name), tryInclude("version", (value_6) => (new Json(0, [value_6])), osr.Version), tryIncludeSeq("comments", (comment) => Comment_ISAJson_encoder(idMap, comment), osr.Comments)]))]);
75
+ }
66
76
 
67
77
  export const OntologySourceReference_ISAJson_decoder = OntologySourceReference_decoder;
68
78
 
@@ -123,7 +133,7 @@ export function ARCtrl_OntologySourceReference__OntologySourceReference_fromISAJ
123
133
 
124
134
  export function ARCtrl_OntologySourceReference__OntologySourceReference_toISAJsonString_Static_71136F3F(spaces) {
125
135
  return (obj) => {
126
- const value = OntologySourceReference_ISAJson_encoder(obj);
136
+ const value = OntologySourceReference_ISAJson_encoder(void 0, obj);
127
137
  return toString(defaultSpaces(spaces), value);
128
138
  };
129
139
  }
package/Json/Person.js CHANGED
@@ -14,6 +14,7 @@ import { context_jsonvalue } from "./context/rocrate/isa_organization_context.js
14
14
  import { contextMinimal_jsonValue, context_jsonvalue as context_jsonvalue_1 } from "./context/rocrate/isa_person_context.js";
15
15
  import { map } from "../fable_modules/fable-library-js.4.16.0/Array.js";
16
16
  import { Person_setOrcidFromComments, Person_setCommentFromORCID } from "../Core/Conversion.js";
17
+ import { encode } from "./IDTable.js";
17
18
  import { fromString } from "../fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs.js";
18
19
  import { toString } from "../fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js";
19
20
 
@@ -176,17 +177,25 @@ export const Person_ROCrate_decodeAuthorListString = map_1((v) => join(", ", v),
176
177
 
177
178
  export const Person_ISAJson_allowedFields = ofArray(["@id", "firstName", "lastName", "midInitials", "email", "phone", "fax", "address", "affiliation", "roles", "comments", "@type", "@context"]);
178
179
 
179
- export function Person_ISAJson_encoder(person) {
180
- const person_1 = Person_setCommentFromORCID(person);
181
- return new Json(5, [choose((tupledArg) => {
182
- const v = tupledArg[1];
183
- if (equals(v, new Json(3, []))) {
184
- return void 0;
185
- }
186
- else {
187
- return [tupledArg[0], v];
188
- }
189
- }, ofArray([tryInclude("firstName", (value) => (new Json(0, [value])), person_1.FirstName), tryInclude("lastName", (value_2) => (new Json(0, [value_2])), person_1.LastName), tryInclude("midInitials", (value_4) => (new Json(0, [value_4])), person_1.MidInitials), tryInclude("email", (value_6) => (new Json(0, [value_6])), person_1.EMail), tryInclude("phone", (value_8) => (new Json(0, [value_8])), person_1.Phone), tryInclude("fax", (value_10) => (new Json(0, [value_10])), person_1.Fax), tryInclude("address", (value_12) => (new Json(0, [value_12])), person_1.Address), tryInclude("affiliation", (value_14) => (new Json(0, [value_14])), person_1.Affiliation), tryIncludeSeq("roles", OntologyAnnotation_encoder, person_1.Roles), tryIncludeSeq("comments", Comment_encoder, person_1.Comments)]))]);
180
+ export function Person_ISAJson_encoder(idMap, person) {
181
+ const f = (person_1) => {
182
+ const person_2 = Person_setCommentFromORCID(person_1);
183
+ return new Json(5, [choose((tupledArg) => {
184
+ const v = tupledArg[1];
185
+ if (equals(v, new Json(3, []))) {
186
+ return void 0;
187
+ }
188
+ else {
189
+ return [tupledArg[0], v];
190
+ }
191
+ }, ofArray([tryInclude("@id", (value) => (new Json(0, [value])), Person_ROCrate_genID(person_2)), tryInclude("firstName", (value_2) => (new Json(0, [value_2])), person_2.FirstName), tryInclude("lastName", (value_4) => (new Json(0, [value_4])), person_2.LastName), tryInclude("midInitials", (value_6) => (new Json(0, [value_6])), person_2.MidInitials), tryInclude("email", (value_8) => (new Json(0, [value_8])), person_2.EMail), tryInclude("phone", (value_10) => (new Json(0, [value_10])), person_2.Phone), tryInclude("fax", (value_12) => (new Json(0, [value_12])), person_2.Fax), tryInclude("address", (value_14) => (new Json(0, [value_14])), person_2.Address), tryInclude("affiliation", (value_16) => (new Json(0, [value_16])), person_2.Affiliation), tryIncludeSeq("roles", OntologyAnnotation_encoder, person_2.Roles), tryIncludeSeq("comments", Comment_encoder, person_2.Comments)]))]);
192
+ };
193
+ if (idMap != null) {
194
+ return encode(Person_ROCrate_genID, f, person, idMap);
195
+ }
196
+ else {
197
+ return f(person);
198
+ }
190
199
  }
191
200
 
192
201
  export const Person_ISAJson_decoder = Decode_objectNoAdditionalProperties(Person_ISAJson_allowedFields, (get$) => {
@@ -249,14 +258,15 @@ export function ARCtrl_Person__Person_fromISAJsonString_Static_Z721C83C5(s) {
249
258
  }
250
259
  }
251
260
 
252
- export function ARCtrl_Person__Person_toISAJsonString_Static_71136F3F(spaces) {
261
+ export function ARCtrl_Person__Person_toISAJsonString_Static_Z3B036AA(spaces, useIDReferencing) {
262
+ const idMap = defaultArg(useIDReferencing, false) ? (new Map([])) : void 0;
253
263
  return (obj) => {
254
- const value = Person_ISAJson_encoder(obj);
264
+ const value = Person_ISAJson_encoder(idMap, obj);
255
265
  return toString(defaultSpaces(spaces), value);
256
266
  };
257
267
  }
258
268
 
259
- export function ARCtrl_Person__Person_toISAJsonString_71136F3F(this$, spaces) {
260
- return ARCtrl_Person__Person_toISAJsonString_Static_71136F3F(unwrap(spaces))(this$);
269
+ export function ARCtrl_Person__Person_toISAJsonString_Z3B036AA(this$, spaces, useIDReferencing) {
270
+ return ARCtrl_Person__Person_toISAJsonString_Static_Z3B036AA(unwrap(spaces), unwrap(useIDReferencing))(this$);
261
271
  }
262
272
 
@@ -6,7 +6,7 @@ import { tryIncludeList } from "../Encode.js";
6
6
  import { Sample_ISAJson_encoder } from "./Sample.js";
7
7
  import { Material_ISAJson_encoder } from "./Material.js";
8
8
 
9
- export function encoder(ps) {
9
+ export function encoder(idMap, ps) {
10
10
  const samples = getSamples(ps);
11
11
  const materials = getMaterials(ps);
12
12
  return new Json(5, [choose((tupledArg) => {
@@ -17,6 +17,6 @@ export function encoder(ps) {
17
17
  else {
18
18
  return [tupledArg[0], v];
19
19
  }
20
- }, ofArray([tryIncludeList("samples", Sample_ISAJson_encoder, samples), tryIncludeList("otherMaterials", Material_ISAJson_encoder, materials)]))]);
20
+ }, ofArray([tryIncludeList("samples", (oa) => Sample_ISAJson_encoder(idMap, oa), samples), tryIncludeList("otherMaterials", (c) => Material_ISAJson_encoder(idMap, c), materials)]))]);
21
21
  }
22
22
 
@@ -1,4 +1,4 @@
1
- import { decoder as decoder_1, encoder } from "./PropertyValue.js";
1
+ import { genID, decoder as decoder_1, encoder } from "./PropertyValue.js";
2
2
  import { Component, Component_decomposeName_Z721C83C5, Component__get_ComponentName, Component_createAsPV } from "../../Core/Process/Component.js";
3
3
  import { ofArray, choose } from "../../fable_modules/fable-library-js.4.16.0/List.js";
4
4
  import { equals } from "../../fable_modules/fable-library-js.4.16.0/Util.js";
@@ -9,14 +9,18 @@ import { object } from "../../fable_modules/Thoth.Json.Core.0.2.1/Decode.fs.js";
9
9
  import { Decode_uri } from "../Decode.js";
10
10
  import { fromString } from "../../fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs.js";
11
11
  import { printf, toText } from "../../fable_modules/fable-library-js.4.16.0/String.js";
12
+ import { unwrap, defaultArg } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
12
13
  import { toString } from "../../fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js";
13
- import { unwrap } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
14
14
 
15
15
  export const Component_ROCrate_encoder = encoder;
16
16
 
17
17
  export const Component_ROCrate_decoder = decoder_1(Component_createAsPV);
18
18
 
19
- export function Component_ISAJson_encoder(c) {
19
+ export function Component_ISAJson_genID(c) {
20
+ return genID(c);
21
+ }
22
+
23
+ export function Component_ISAJson_encoder(idMap, c) {
20
24
  return new Json(5, [choose((tupledArg) => {
21
25
  const v = tupledArg[1];
22
26
  if (equals(v, new Json(3, []))) {
@@ -25,7 +29,7 @@ export function Component_ISAJson_encoder(c) {
25
29
  else {
26
30
  return [tupledArg[0], v];
27
31
  }
28
- }, ofArray([tryInclude("componentName", (value) => (new Json(0, [value])), Component__get_ComponentName(c)), tryInclude("componentType", OntologyAnnotation_ISAJson_encoder, c.ComponentType)]))]);
32
+ }, ofArray([tryInclude("componentName", (value) => (new Json(0, [value])), Component__get_ComponentName(c)), tryInclude("componentType", (oa) => OntologyAnnotation_ISAJson_encoder(idMap, oa), c.ComponentType)]))]);
29
33
  }
30
34
 
31
35
  export const Component_ISAJson_decoder = object((get$) => {
@@ -54,15 +58,16 @@ export function ARCtrl_Process_Component__Component_fromISAJsonString_Static_Z72
54
58
  }
55
59
  }
56
60
 
57
- export function ARCtrl_Process_Component__Component_toISAJsonString_Static_71136F3F(spaces) {
61
+ export function ARCtrl_Process_Component__Component_toISAJsonString_Static_Z3B036AA(spaces, useIDReferencing) {
62
+ const idMap = defaultArg(useIDReferencing, false) ? (new Map([])) : void 0;
58
63
  return (f) => {
59
- const value = Component_ISAJson_encoder(f);
64
+ const value = Component_ISAJson_encoder(idMap, f);
60
65
  return toString(defaultSpaces(spaces), value);
61
66
  };
62
67
  }
63
68
 
64
69
  export function ARCtrl_Process_Component__Component_toISAJsonString_71136F3F(this$, spaces) {
65
- return ARCtrl_Process_Component__Component_toISAJsonString_Static_71136F3F(unwrap(spaces))(this$);
70
+ return ARCtrl_Process_Component__Component_toISAJsonString_Static_Z3B036AA(spaces)(this$);
66
71
  }
67
72
 
68
73
  export function ARCtrl_Process_Component__Component_fromROCrateJsonString_Static_Z721C83C5(s) {
@@ -6,13 +6,14 @@ import { DataFile_ROCrate_decoder, DataFile_ROCrate_encoder, DataFile_ISAJson_de
6
6
  import { Comment_ISAJson_decoder, Comment_ISAJson_encoder, Comment_ROCrate_decoder, Comment_ROCrate_encoder, Comment_decoder, Comment_encoder } from "../Comment.js";
7
7
  import { string, object } from "../../fable_modules/Thoth.Json.Core.0.2.1/Decode.fs.js";
8
8
  import { Data } from "../../Core/Data.js";
9
- import { unwrap } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
9
+ import { defaultArg, unwrap } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
10
10
  import { Decode_objectNoAdditionalProperties, Decode_resizeArray, Decode_uri } from "../Decode.js";
11
11
  import { decodeString, encodeString } from "../StringTable.js";
12
12
  import { printf, toText, replace } from "../../fable_modules/fable-library-js.4.16.0/String.js";
13
13
  import { URIModule_toString } from "../../Core/URI.js";
14
14
  import { list as list_1 } from "../../fable_modules/Thoth.Json.Core.0.2.1/Encode.fs.js";
15
15
  import { context_jsonvalue } from "../context/rocrate/isa_data_context.js";
16
+ import { encode } from "../IDTable.js";
16
17
  import { fromString } from "../../fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs.js";
17
18
  import { toString } from "../../fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js";
18
19
 
@@ -85,8 +86,8 @@ export const Data_ROCrate_decoder = object((get$) => {
85
86
  return new Data(unwrap((objectArg = get$.Optional, objectArg.Field("@id", Decode_uri))), unwrap((objectArg_1 = get$.Optional, objectArg_1.Field("name", string))), unwrap((objectArg_2 = get$.Optional, objectArg_2.Field("type", DataFile_ROCrate_decoder))), unwrap((objectArg_3 = get$.Optional, objectArg_3.Field("encodingFormat", string))), unwrap((objectArg_4 = get$.Optional, objectArg_4.Field("usageInfo", Decode_uri))), unwrap((arg_11 = Decode_resizeArray(Comment_ROCrate_decoder), (objectArg_5 = get$.Optional, objectArg_5.Field("comments", arg_11)))));
86
87
  });
87
88
 
88
- export function Data_ISAJson_encoder(oa) {
89
- return new Json(5, [choose((tupledArg) => {
89
+ export function Data_ISAJson_encoder(idMap, oa) {
90
+ const f = (oa_1) => (new Json(5, [choose((tupledArg) => {
90
91
  const v = tupledArg[1];
91
92
  if (equals(v, new Json(3, []))) {
92
93
  return void 0;
@@ -94,7 +95,13 @@ export function Data_ISAJson_encoder(oa) {
94
95
  else {
95
96
  return [tupledArg[0], v];
96
97
  }
97
- }, ofArray([tryInclude("@id", (value) => (new Json(0, [value])), oa.ID), tryInclude("name", (value_2) => (new Json(0, [value_2])), oa.Name), tryInclude("type", DataFile_ISAJson_encoder, oa.DataType), tryIncludeSeq("comments", Comment_ISAJson_encoder, oa.Comments)]))]);
98
+ }, ofArray([tryInclude("@id", (value) => (new Json(0, [value])), Data_ROCrate_genID(oa_1)), tryInclude("name", (value_2) => (new Json(0, [value_2])), oa_1.Name), tryInclude("type", DataFile_ISAJson_encoder, oa_1.DataType), tryIncludeSeq("comments", (comment) => Comment_ISAJson_encoder(idMap, comment), oa_1.Comments)]))]));
99
+ if (idMap != null) {
100
+ return encode(Data_ROCrate_genID, f, oa, idMap);
101
+ }
102
+ else {
103
+ return f(oa);
104
+ }
98
105
  }
99
106
 
100
107
  export const Data_ISAJson_allowedFields = ofArray(["@id", "name", "type", "comments", "@type", "@context"]);
@@ -114,15 +121,16 @@ export function ARCtrl_Data__Data_fromISAJsonString_Static_Z721C83C5(s) {
114
121
  }
115
122
  }
116
123
 
117
- export function ARCtrl_Data__Data_toISAJsonString_Static_71136F3F(spaces) {
124
+ export function ARCtrl_Data__Data_toISAJsonString_Static_Z3B036AA(spaces, useIDReferencing) {
125
+ const idMap = defaultArg(useIDReferencing, false) ? (new Map([])) : void 0;
118
126
  return (f) => {
119
- const value = Data_ISAJson_encoder(f);
120
- return toString(defaultSpaces(spaces), value);
127
+ const value_1 = Data_ISAJson_encoder(idMap, f);
128
+ return toString(defaultSpaces(spaces), value_1);
121
129
  };
122
130
  }
123
131
 
124
- export function ARCtrl_Data__Data_toISAJsonString_71136F3F(this$, spaces) {
125
- return ARCtrl_Data__Data_toISAJsonString_Static_71136F3F(unwrap(spaces))(this$);
132
+ export function ARCtrl_Data__Data_toISAJsonString_Z3B036AA(this$, spaces, useIDReferencing) {
133
+ return ARCtrl_Data__Data_toISAJsonString_Static_Z3B036AA(unwrap(spaces), unwrap(useIDReferencing))(this$);
126
134
  }
127
135
 
128
136
  export function ARCtrl_Data__Data_fromROCrateJsonString_Static_Z721C83C5(s) {
@@ -1,10 +1,11 @@
1
+ import { OntologyAnnotation_ISAJson_decoder, OntologyAnnotation_ISAJson_encoder, OntologyAnnotation_ROCrate_genID } from "../OntologyAnnotation.js";
1
2
  import { ofArray, choose } from "../../fable_modules/fable-library-js.4.16.0/List.js";
2
3
  import { equals } from "../../fable_modules/fable-library-js.4.16.0/Util.js";
3
4
  import { Json } from "../../fable_modules/Thoth.Json.Core.0.2.1/Types.fs.js";
4
5
  import { defaultSpaces, tryIncludeSeq, tryInclude } from "../Encode.js";
5
- import { OntologyAnnotation_ISAJson_decoder, OntologyAnnotation_ISAJson_encoder } from "../OntologyAnnotation.js";
6
6
  import { Comment_ISAJson_decoder, Comment_ISAJson_encoder } from "../Comment.js";
7
7
  import { unwrap, defaultArg } from "../../fable_modules/fable-library-js.4.16.0/Option.js";
8
+ import { encode } from "../IDTable.js";
8
9
  import { string, object } from "../../fable_modules/Thoth.Json.Core.0.2.1/Decode.fs.js";
9
10
  import { Decode_resizeArray } from "../Decode.js";
10
11
  import { Factor } from "../../Core/Process/Factor.js";
@@ -12,8 +13,24 @@ import { fromString } from "../../fable_modules/Thoth.Json.JavaScript.0.1.0/Deco
12
13
  import { printf, toText } from "../../fable_modules/fable-library-js.4.16.0/String.js";
13
14
  import { toString } from "../../fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js";
14
15
 
15
- export function Factor_ISAJson_encoder(value) {
16
- return new Json(5, [choose((tupledArg) => {
16
+ export function Factor_ISAJson_genID(f) {
17
+ const matchValue = f.Name;
18
+ if (matchValue == null) {
19
+ const matchValue_1 = f.FactorType;
20
+ if (matchValue_1 == null) {
21
+ return "#EmptyFactor";
22
+ }
23
+ else {
24
+ return `#Factor/${OntologyAnnotation_ROCrate_genID(matchValue_1)}`;
25
+ }
26
+ }
27
+ else {
28
+ return `#Factor/${matchValue}`;
29
+ }
30
+ }
31
+
32
+ export function Factor_ISAJson_encoder(idMap, value) {
33
+ const f_1 = (value_1) => (new Json(5, [choose((tupledArg) => {
17
34
  const v = tupledArg[1];
18
35
  if (equals(v, new Json(3, []))) {
19
36
  return void 0;
@@ -21,7 +38,13 @@ export function Factor_ISAJson_encoder(value) {
21
38
  else {
22
39
  return [tupledArg[0], v];
23
40
  }
24
- }, ofArray([tryInclude("factorName", (value_1) => (new Json(0, [value_1])), value.Name), tryInclude("factorType", OntologyAnnotation_ISAJson_encoder, value.FactorType), tryIncludeSeq("comments", Comment_ISAJson_encoder, defaultArg(value.Comments, []))]))]);
41
+ }, ofArray([tryInclude("@id", (value_2) => (new Json(0, [value_2])), Factor_ISAJson_genID(value_1)), tryInclude("factorName", (value_4) => (new Json(0, [value_4])), value_1.Name), tryInclude("factorType", (oa) => OntologyAnnotation_ISAJson_encoder(idMap, oa), value_1.FactorType), tryIncludeSeq("comments", (comment) => Comment_ISAJson_encoder(idMap, comment), defaultArg(value_1.Comments, []))]))]));
42
+ if (idMap != null) {
43
+ return encode(Factor_ISAJson_genID, f_1, value, idMap);
44
+ }
45
+ else {
46
+ return f_1(value);
47
+ }
25
48
  }
26
49
 
27
50
  export const Factor_ISAJson_decoder = object((get$) => {
@@ -41,7 +64,7 @@ export function ARCtrl_Process_Factor__Factor_fromISAJsonString_Static_Z721C83C5
41
64
 
42
65
  export function ARCtrl_Process_Factor__Factor_toISAJsonString_Static_71136F3F(spaces) {
43
66
  return (f) => {
44
- const value = Factor_ISAJson_encoder(f);
67
+ const value = Factor_ISAJson_encoder(void 0, f);
45
68
  return toString(defaultSpaces(spaces), value);
46
69
  };
47
70
  }