@graphty/graph-io 0.3.19 → 0.3.21

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 (201) hide show
  1. package/README.md +49 -4
  2. package/dist/chunks/{escape-CWExcecC.js → escape-B-tkk_Cl.js} +74 -16
  3. package/dist/chunks/escape-B-tkk_Cl.js.map +1 -0
  4. package/dist/chunks/{writer-DQiKgQJc.js → export-Bh60Dv-n.js} +5 -79
  5. package/dist/chunks/export-Bh60Dv-n.js.map +1 -0
  6. package/dist/chunks/{exporter-CbMZyVt-.js → exporter-BGrsWamJ.js} +7 -6
  7. package/dist/chunks/{exporter-CbMZyVt-.js.map → exporter-BGrsWamJ.js.map} +1 -1
  8. package/dist/chunks/exporter-DIeGJXAZ.js +834 -0
  9. package/dist/chunks/exporter-DIeGJXAZ.js.map +1 -0
  10. package/dist/chunks/{importer-BNFuV1-K.js → importer-BWY2FFc5.js} +28 -7
  11. package/dist/chunks/importer-BWY2FFc5.js.map +1 -0
  12. package/dist/chunks/importer-DD-xv9_Y.js +1471 -0
  13. package/dist/chunks/importer-DD-xv9_Y.js.map +1 -0
  14. package/dist/chunks/{importer-BAP4PrxR.js → importer-DET1tg6s.js} +30 -20
  15. package/dist/chunks/importer-DET1tg6s.js.map +1 -0
  16. package/dist/chunks/{importer-ByPGO-09.js → importer-DEcKhsmQ.js} +2 -2
  17. package/dist/chunks/{importer-ByPGO-09.js.map → importer-DEcKhsmQ.js.map} +1 -1
  18. package/dist/chunks/{importer-BW-Ft2ps.js → importer-DIrbbnAf.js} +6 -5
  19. package/dist/chunks/{importer-BW-Ft2ps.js.map → importer-DIrbbnAf.js.map} +1 -1
  20. package/dist/chunks/importer-D_e7e7LX.js +3055 -0
  21. package/dist/chunks/importer-D_e7e7LX.js.map +1 -0
  22. package/dist/chunks/{importer-Bm1_5vPS.js → importer-eUREhBGj.js} +11 -8
  23. package/dist/chunks/importer-eUREhBGj.js.map +1 -0
  24. package/dist/chunks/{importer-DOepkgnG.js → importer-vi3bSdtw.js} +4 -4
  25. package/dist/chunks/{importer-DOepkgnG.js.map → importer-vi3bSdtw.js.map} +1 -1
  26. package/dist/chunks/{importer-BVGtU1NA.js → importer-zGLo8Dg_.js} +6 -5
  27. package/dist/chunks/{importer-BVGtU1NA.js.map → importer-zGLo8Dg_.js.map} +1 -1
  28. package/dist/chunks/{json-elements-CZY1wiZh.js → json-elements-DDS8N2Dd.js} +2 -2
  29. package/dist/chunks/{json-elements-CZY1wiZh.js.map → json-elements-DDS8N2Dd.js.map} +1 -1
  30. package/dist/chunks/{records-BzNicMsf.js → records-dbRkxwaq.js} +2 -2
  31. package/dist/chunks/{records-BzNicMsf.js.map → records-dbRkxwaq.js.map} +1 -1
  32. package/dist/chunks/{report-BcWboivV.js → report-B1z4WT9e.js} +143 -111
  33. package/dist/chunks/{report-BcWboivV.js.map → report-B1z4WT9e.js.map} +1 -1
  34. package/dist/chunks/{weights-CwISIpCP.js → weights-Dzba96G3.js} +5 -5
  35. package/dist/chunks/{weights-CwISIpCP.js.map → weights-Dzba96G3.js.map} +1 -1
  36. package/dist/chunks/writer-C7flM-Ih.js +77 -0
  37. package/dist/chunks/writer-C7flM-Ih.js.map +1 -0
  38. package/dist/csv.js +6 -5
  39. package/dist/csv.js.map +1 -1
  40. package/dist/cx.js +1 -1
  41. package/dist/cx2.js +2 -2
  42. package/dist/cys.d.ts +1 -0
  43. package/dist/cys.js +6 -0
  44. package/dist/cys.js.map +1 -0
  45. package/dist/dot.js +1 -1
  46. package/dist/gexf.js +5 -4
  47. package/dist/gexf.js.map +1 -1
  48. package/dist/gml.js +12 -14
  49. package/dist/gml.js.map +1 -1
  50. package/dist/graph-io.js +288 -141
  51. package/dist/graph-io.js.map +1 -1
  52. package/dist/graphml.js +1 -1
  53. package/dist/json.js +1 -1
  54. package/dist/neo4j.js +6 -5
  55. package/dist/neo4j.js.map +1 -1
  56. package/dist/obo.js +1 -1
  57. package/dist/pajek.js +1 -1
  58. package/dist/src/common/cell-budget.d.ts +84 -0
  59. package/dist/src/common/cell-budget.d.ts.map +1 -0
  60. package/dist/src/common/cell-budget.js +138 -0
  61. package/dist/src/common/cell-budget.js.map +1 -0
  62. package/dist/src/common/input.d.ts +10 -0
  63. package/dist/src/common/input.d.ts.map +1 -1
  64. package/dist/src/common/input.js +39 -0
  65. package/dist/src/common/input.js.map +1 -1
  66. package/dist/src/common/options.d.ts +6 -0
  67. package/dist/src/common/options.d.ts.map +1 -1
  68. package/dist/src/common/options.js +1 -1
  69. package/dist/src/common/options.js.map +1 -1
  70. package/dist/src/common/xml.d.ts +37 -3
  71. package/dist/src/common/xml.d.ts.map +1 -1
  72. package/dist/src/common/xml.js +86 -6
  73. package/dist/src/common/xml.js.map +1 -1
  74. package/dist/src/common/zip.d.ts +92 -0
  75. package/dist/src/common/zip.d.ts.map +1 -0
  76. package/dist/src/common/zip.js +399 -0
  77. package/dist/src/common/zip.js.map +1 -0
  78. package/dist/src/formats/cx/importer.d.ts.map +1 -1
  79. package/dist/src/formats/cx/importer.js +26 -17
  80. package/dist/src/formats/cx/importer.js.map +1 -1
  81. package/dist/src/formats/cys/constants.d.ts +68 -0
  82. package/dist/src/formats/cys/constants.d.ts.map +1 -0
  83. package/dist/src/formats/cys/constants.js +76 -0
  84. package/dist/src/formats/cys/constants.js.map +1 -0
  85. package/dist/src/formats/cys/importer.d.ts +38 -0
  86. package/dist/src/formats/cys/importer.d.ts.map +1 -0
  87. package/dist/src/formats/cys/importer.js +830 -0
  88. package/dist/src/formats/cys/importer.js.map +1 -0
  89. package/dist/src/formats/cys/index.d.ts +7 -0
  90. package/dist/src/formats/cys/index.d.ts.map +1 -0
  91. package/dist/src/formats/cys/index.js +7 -0
  92. package/dist/src/formats/cys/index.js.map +1 -0
  93. package/dist/src/formats/cys/session.d.ts +132 -0
  94. package/dist/src/formats/cys/session.d.ts.map +1 -0
  95. package/dist/src/formats/cys/session.js +315 -0
  96. package/dist/src/formats/cys/session.js.map +1 -0
  97. package/dist/src/formats/cys/tables.d.ts +90 -0
  98. package/dist/src/formats/cys/tables.d.ts.map +1 -0
  99. package/dist/src/formats/cys/tables.js +293 -0
  100. package/dist/src/formats/cys/tables.js.map +1 -0
  101. package/dist/src/formats/dot/exporter.d.ts +2 -0
  102. package/dist/src/formats/dot/exporter.d.ts.map +1 -1
  103. package/dist/src/formats/dot/exporter.js +12 -0
  104. package/dist/src/formats/dot/exporter.js.map +1 -1
  105. package/dist/src/formats/dot/importer.js +6 -2
  106. package/dist/src/formats/dot/importer.js.map +1 -1
  107. package/dist/src/formats/gexf/importer.d.ts +2 -2
  108. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  109. package/dist/src/formats/gexf/importer.js +1 -1
  110. package/dist/src/formats/gexf/importer.js.map +1 -1
  111. package/dist/src/formats/gml/exporter.d.ts +0 -8
  112. package/dist/src/formats/gml/exporter.d.ts.map +1 -1
  113. package/dist/src/formats/gml/exporter.js +7 -17
  114. package/dist/src/formats/gml/exporter.js.map +1 -1
  115. package/dist/src/formats/json/exporter.d.ts.map +1 -1
  116. package/dist/src/formats/json/exporter.js +3 -1
  117. package/dist/src/formats/json/exporter.js.map +1 -1
  118. package/dist/src/formats/json/importer.d.ts.map +1 -1
  119. package/dist/src/formats/json/importer.js +3 -2
  120. package/dist/src/formats/json/importer.js.map +1 -1
  121. package/dist/src/formats/xgmml/columns.d.ts +152 -0
  122. package/dist/src/formats/xgmml/columns.d.ts.map +1 -0
  123. package/dist/src/formats/xgmml/columns.js +593 -0
  124. package/dist/src/formats/xgmml/columns.js.map +1 -0
  125. package/dist/src/formats/xgmml/constants.d.ts +196 -0
  126. package/dist/src/formats/xgmml/constants.d.ts.map +1 -0
  127. package/dist/src/formats/xgmml/constants.js +197 -0
  128. package/dist/src/formats/xgmml/constants.js.map +1 -0
  129. package/dist/src/formats/xgmml/document.d.ts +361 -0
  130. package/dist/src/formats/xgmml/document.d.ts.map +1 -0
  131. package/dist/src/formats/xgmml/document.js +695 -0
  132. package/dist/src/formats/xgmml/document.js.map +1 -0
  133. package/dist/src/formats/xgmml/emit.d.ts +341 -0
  134. package/dist/src/formats/xgmml/emit.d.ts.map +1 -0
  135. package/dist/src/formats/xgmml/emit.js +1275 -0
  136. package/dist/src/formats/xgmml/emit.js.map +1 -0
  137. package/dist/src/formats/xgmml/exporter.d.ts +24 -0
  138. package/dist/src/formats/xgmml/exporter.d.ts.map +1 -0
  139. package/dist/src/formats/xgmml/exporter.js +999 -0
  140. package/dist/src/formats/xgmml/exporter.js.map +1 -0
  141. package/dist/src/formats/xgmml/importer.d.ts +58 -0
  142. package/dist/src/formats/xgmml/importer.d.ts.map +1 -0
  143. package/dist/src/formats/xgmml/importer.js +360 -0
  144. package/dist/src/formats/xgmml/importer.js.map +1 -0
  145. package/dist/src/formats/xgmml/index.d.ts +8 -0
  146. package/dist/src/formats/xgmml/index.d.ts.map +1 -0
  147. package/dist/src/formats/xgmml/index.js +8 -0
  148. package/dist/src/formats/xgmml/index.js.map +1 -0
  149. package/dist/src/formats/xgmml/values.d.ts +60 -0
  150. package/dist/src/formats/xgmml/values.d.ts.map +1 -0
  151. package/dist/src/formats/xgmml/values.js +148 -0
  152. package/dist/src/formats/xgmml/values.js.map +1 -0
  153. package/dist/src/index.d.ts +2 -0
  154. package/dist/src/index.d.ts.map +1 -1
  155. package/dist/src/index.js +2 -0
  156. package/dist/src/index.js.map +1 -1
  157. package/dist/src/registry.d.ts +7 -0
  158. package/dist/src/registry.d.ts.map +1 -1
  159. package/dist/src/registry.js +25 -10
  160. package/dist/src/registry.js.map +1 -1
  161. package/dist/src/sniff.d.ts +1 -1
  162. package/dist/src/sniff.d.ts.map +1 -1
  163. package/dist/src/sniff.js +2 -0
  164. package/dist/src/sniff.js.map +1 -1
  165. package/dist/xgmml.d.ts +1 -0
  166. package/dist/xgmml.js +9 -0
  167. package/dist/xgmml.js.map +1 -0
  168. package/package.json +15 -2
  169. package/src/common/cell-budget.ts +170 -0
  170. package/src/common/input.ts +40 -0
  171. package/src/common/options.ts +1 -1
  172. package/src/common/xml.ts +127 -6
  173. package/src/common/zip.ts +472 -0
  174. package/src/formats/cx/importer.ts +27 -19
  175. package/src/formats/cys/constants.ts +99 -0
  176. package/src/formats/cys/importer.ts +1100 -0
  177. package/src/formats/cys/index.ts +7 -0
  178. package/src/formats/cys/session.ts +428 -0
  179. package/src/formats/cys/tables.ts +400 -0
  180. package/src/formats/dot/exporter.ts +17 -0
  181. package/src/formats/dot/importer.ts +6 -2
  182. package/src/formats/gexf/importer.ts +0 -1
  183. package/src/formats/gml/exporter.ts +7 -18
  184. package/src/formats/json/exporter.ts +3 -1
  185. package/src/formats/json/importer.ts +3 -2
  186. package/src/formats/xgmml/columns.ts +747 -0
  187. package/src/formats/xgmml/constants.ts +265 -0
  188. package/src/formats/xgmml/document.ts +975 -0
  189. package/src/formats/xgmml/emit.ts +1563 -0
  190. package/src/formats/xgmml/exporter.ts +1215 -0
  191. package/src/formats/xgmml/importer.ts +491 -0
  192. package/src/formats/xgmml/index.ts +8 -0
  193. package/src/formats/xgmml/values.ts +183 -0
  194. package/src/index.ts +9 -0
  195. package/src/registry.ts +41 -15
  196. package/src/sniff.ts +5 -1
  197. package/dist/chunks/escape-CWExcecC.js.map +0 -1
  198. package/dist/chunks/importer-BAP4PrxR.js.map +0 -1
  199. package/dist/chunks/importer-BNFuV1-K.js.map +0 -1
  200. package/dist/chunks/importer-Bm1_5vPS.js.map +0 -1
  201. package/dist/chunks/writer-DQiKgQJc.js.map +0 -1
@@ -0,0 +1,593 @@
1
+ /**
2
+ * The attribute columns of one XGMML (or `.cys`) import: every att and every untyped XML
3
+ * attribute is parsed by its own declared kind when it is read, then each column's dtype is
4
+ * decided once over all its values (design section 5.1 widening: int and long to f64, numbers
5
+ * and booleans to string, lists and scalars to json), and only then declared on the sink, so a
6
+ * column is never re-typed after rows were written and a caller's sink needs no widening call.
7
+ */
8
+ import { declareResolved, DictHeuristic, uniqueColumnName } from "../../common/attributes.js";
9
+ import { inferTextDtype, parseTextCell } from "../../common/text.js";
10
+ import { CYTOSCAPE_ORIGIN_NAMESPACE, FORMAT, XGMML_ISSUE } from "./constants.js";
11
+ import { isListLike } from "./document.js";
12
+ import { attType, elementKind, parseScalar, widenScalar } from "./values.js";
13
+ /** The dtype of each scalar kind. */
14
+ const DTYPES = {
15
+ bool: "bool",
16
+ int: "i32",
17
+ long: "f64",
18
+ real: "f64",
19
+ string: "string",
20
+ };
21
+ /**
22
+ * Collects the attribute values of one table, then declares and writes the columns.
23
+ */
24
+ export class ColumnSet {
25
+ /**
26
+ * Create a column set.
27
+ * @param domain - the table
28
+ * @param report - the report
29
+ * @param options - the options
30
+ */
31
+ constructor(domain, report, options) {
32
+ this.plans = new Map();
33
+ this.domain = domain;
34
+ this.report = report;
35
+ this.options = options;
36
+ }
37
+ /**
38
+ * Whether a column of that name (any namespace) was collected.
39
+ * @param name - the name
40
+ * @returns true when some row has a value or the column was declared
41
+ */
42
+ has(name) {
43
+ return this.plans.has(key(null, name));
44
+ }
45
+ /**
46
+ * Add one att of a row: parse it by its declared kind (E_BAD_VALUE for a value that does not
47
+ * parse; the cell stays unset). A second value of the same column on one row wins with
48
+ * W_DUPLICATE_ATTRIBUTE.
49
+ * @param row - the row
50
+ * @param att - the att
51
+ * @param where - the element, for issues
52
+ */
53
+ addAtt(row, att, where) {
54
+ const { name } = att;
55
+ if (name === null || name.length === 0) {
56
+ this.badAtt("an <att> without a name was skipped", att, "name");
57
+ return;
58
+ }
59
+ const plan = this.plan(name, att.namespace ?? null);
60
+ const type = attType(att);
61
+ plan.hidden || (plan.hidden = att.hidden);
62
+ plan.suid || (plan.suid = name.endsWith(".SUID"));
63
+ if (type.declared !== null) {
64
+ plan.declaredType ?? (plan.declaredType = type.declared);
65
+ }
66
+ const at = { line: att.line, element: where.element ?? name };
67
+ if (type.unknown !== null) {
68
+ this.report.warnOnce("unsupported", XGMML_ISSUE.UNKNOWN_ATTR_TYPE, `att type "${type.unknown}" of "${name}" is not an XGMML or Cytoscape type; its values are kept as text`, at, `${XGMML_ISSUE.UNKNOWN_ATTR_TYPE}:${this.domain}:${name}`);
69
+ }
70
+ let cell;
71
+ if (att.equation) {
72
+ plan.equation = true;
73
+ this.report.warnOnce("unsupported", XGMML_ISSUE.EQUATION_AS_TEXT, `"${name}" holds Cytoscape formulas; each is kept as its text, never evaluated`, at, `${XGMML_ISSUE.EQUATION_AS_TEXT}:${this.domain}:${name}`);
74
+ cell = att.value === null ? null : scalarCell("string", att.value, att.value, true);
75
+ if (cell !== null) {
76
+ plan.declared.add("string");
77
+ }
78
+ }
79
+ else if (type.kind === "list") {
80
+ cell = this.listCell(att, name, plan, at);
81
+ plan.declared.add("list");
82
+ }
83
+ else if (type.kind === "map") {
84
+ cell = jsonCell(recordOf(att));
85
+ this.recordList(`"${name}" is a 2.x map; it is kept as a json record`, at);
86
+ plan.declared.add("json");
87
+ }
88
+ else {
89
+ cell = this.scalarAtt(att, type.kind, plan, at);
90
+ }
91
+ if (cell !== null) {
92
+ this.set(plan, row, cell, at);
93
+ }
94
+ }
95
+ /**
96
+ * Add one value read by the 5.1 text grammar (an XML attribute of an element).
97
+ * @param row - the row
98
+ * @param name - the column name
99
+ * @param text - the text
100
+ * @param where - the element, for issues
101
+ */
102
+ addText(row, name, text, where) {
103
+ const plan = this.plan(name, null);
104
+ const value = parseTextCell(text);
105
+ const kind = textKind(inferTextDtype(text));
106
+ this.set(plan, row, { kind, value, text, items: [], itemKind: null, typed: false }, where);
107
+ }
108
+ /**
109
+ * Add one value of a known kind (a typed table cell of a session).
110
+ * @param row - the row
111
+ * @param name - the column name
112
+ * @param value - the value
113
+ * @param where - the element, for issues
114
+ */
115
+ addJson(row, name, value, where) {
116
+ this.set(this.plan(name, null), row, jsonCell(value), where);
117
+ }
118
+ /**
119
+ * Declare every collected column on the sink and write its values.
120
+ * @param sink - the sink
121
+ * @param rowIndex - the sink index of a row (node or edge index), or -1 when the row was not added
122
+ */
123
+ write(sink, rowIndex) {
124
+ const taken = new Set(this.options.reserved);
125
+ const ordered = [...this.plans.values()].sort((a, b) => Number(a.namespace !== null) - Number(b.namespace !== null));
126
+ for (const plan of ordered) {
127
+ let { name } = plan;
128
+ if (taken.has(name)) {
129
+ name = uniqueColumnName(plan.name, plan.namespace, (n) => taken.has(n));
130
+ this.report.warning("coercion", XGMML_ISSUE.COLUMN_RENAMED, `${this.domain} attribute "${plan.name}" renamed to "${name}": the name was taken`, { element: plan.name });
131
+ }
132
+ taken.add(name);
133
+ this.writePlan(sink, plan, name, rowIndex);
134
+ }
135
+ }
136
+ // ------------------------------------------------------------------ cells
137
+ /**
138
+ * The plan of a column, created on first use.
139
+ * @param name - the attribute name
140
+ * @param namespace - the table namespace, or null
141
+ * @returns the plan
142
+ */
143
+ plan(name, namespace) {
144
+ const k = key(namespace, name);
145
+ let plan = this.plans.get(k);
146
+ if (plan === undefined) {
147
+ plan = {
148
+ name,
149
+ namespace,
150
+ cells: new Map(),
151
+ declared: new Set(),
152
+ lines: new Map(),
153
+ declaredType: null,
154
+ hidden: false,
155
+ equation: false,
156
+ suid: false,
157
+ overflow: false,
158
+ precision: false,
159
+ };
160
+ this.plans.set(k, plan);
161
+ }
162
+ return plan;
163
+ }
164
+ /**
165
+ * Store a cell, reporting a second value on the same row.
166
+ * @param plan - the column
167
+ * @param row - the row
168
+ * @param cell - the cell
169
+ * @param where - the location
170
+ */
171
+ set(plan, row, cell, where) {
172
+ if (plan.cells.has(row)) {
173
+ this.report.warning("validation-error", XGMML_ISSUE.DUPLICATE_ATTRIBUTE, `"${plan.name}" is given twice on one ${this.domain}; the later value is kept`, { line: where.line ?? null, element: where.element ?? plan.name });
174
+ }
175
+ plan.cells.set(row, cell);
176
+ if (where.line !== undefined && where.line !== null) {
177
+ plan.lines.set(row, where.line);
178
+ }
179
+ }
180
+ /**
181
+ * Parse a scalar att.
182
+ * @param att - the att
183
+ * @param kind - the declared kind
184
+ * @param plan - the column
185
+ * @param at - the location
186
+ * @returns the cell, or null when unset or invalid
187
+ */
188
+ scalarAtt(att, kind, plan, at) {
189
+ if (att.children.length > 0) {
190
+ this.badAtt(`the ${kind} att "${att.name ?? ""}" holds child atts; they are ignored`, att, "children");
191
+ }
192
+ if (att.xml !== null) {
193
+ this.recordList(`"${att.name ?? ""}" holds foreign XML; it is kept as text in a json column`, at);
194
+ plan.declared.add("json");
195
+ return jsonCell(att.xml);
196
+ }
197
+ if (att.value === null) {
198
+ plan.declared.add(kind);
199
+ return null;
200
+ }
201
+ const parsed = parseScalar(att.value, kind, this.options.unescape);
202
+ if (parsed === null || (parsed.overflow !== undefined && kind === "int" && exactInteger(att.cyType))) {
203
+ this.badValue(att.value, kind, at);
204
+ return null;
205
+ }
206
+ plan.declared.add(kind);
207
+ if (parsed.overflow === "i32") {
208
+ plan.overflow = true;
209
+ }
210
+ else if (parsed.overflow === "precision") {
211
+ plan.precision = true;
212
+ plan.overflow || (plan.overflow = kind === "int");
213
+ }
214
+ return scalarCell(kind, parsed.value, att.value, true);
215
+ }
216
+ /**
217
+ * Parse a list att: items by `cy:elementType`, else by the widened kinds of the children.
218
+ * A list of lists, a list with records, or a list of named fields is a json value.
219
+ * @param att - the att
220
+ * @param name - the column name
221
+ * @param plan - the column (an item beyond i32 widens it, as a scalar does)
222
+ * @param at - the location
223
+ * @returns the cell
224
+ */
225
+ listCell(att, name, plan, at) {
226
+ if (att.value !== null) {
227
+ this.badAtt(`the list att "${name}" has a value; it is ignored`, att, "list-value");
228
+ }
229
+ const { children } = att;
230
+ const names = new Set(children.map((c) => c.name).filter((n) => n !== null && n !== name));
231
+ if (names.size > 1 || children.some((c) => c.children.length > 0 || c.xml !== null)) {
232
+ this.recordList(`"${name}" is a record or a list of lists; it is kept as json`, at);
233
+ return jsonCell(names.size > 1 ? recordOf(att) : children.map(jsonOfAtt));
234
+ }
235
+ let itemKind = elementKind(att.elementType);
236
+ if (itemKind === null) {
237
+ const kinds = new Set();
238
+ for (const child of children) {
239
+ const type = attType(child);
240
+ const kind = type.kind === "list" || type.kind === "map" ? "string" : type.kind;
241
+ kinds.add(kind);
242
+ itemKind = itemKind === null ? kind : widenScalar(itemKind, kind);
243
+ }
244
+ if (kinds.size > 1) {
245
+ this.report.warnOnce("coercion", XGMML_ISSUE.WIDENED, `the items of list "${name}" declare different types; they are read as ${itemKind ?? "string"}`, at, `${XGMML_ISSUE.WIDENED}:${this.domain}:${name}`);
246
+ }
247
+ }
248
+ const items = [];
249
+ for (const child of children) {
250
+ if (child.value === null) {
251
+ continue;
252
+ }
253
+ const parsed = parseScalar(child.value, itemKind ?? "string", this.options.unescape);
254
+ const exact = exactInteger(att.elementType) || exactInteger(child.cyType);
255
+ if (parsed === null || (parsed.overflow !== undefined && itemKind === "int" && exact)) {
256
+ this.badValue(child.value, itemKind ?? "string", { line: child.line, element: at.element });
257
+ continue;
258
+ }
259
+ if (parsed.overflow === "i32") {
260
+ plan.overflow = true;
261
+ }
262
+ else if (parsed.overflow === "precision") {
263
+ plan.precision = true;
264
+ plan.overflow || (plan.overflow = itemKind === "int");
265
+ }
266
+ items.push({ value: parsed.value, text: child.value });
267
+ }
268
+ return { kind: "list", value: null, text: "", items, itemKind, typed: true };
269
+ }
270
+ // ------------------------------------------------------------------ decision and writing
271
+ /**
272
+ * Decide one column's dtype, declare it and write its values.
273
+ * @param sink - the sink
274
+ * @param plan - the column
275
+ * @param name - the name to declare it under
276
+ * @param rowIndex - the row to sink index map
277
+ */
278
+ writePlan(sink, plan, name, rowIndex) {
279
+ const cells = [...plan.cells.values()];
280
+ const decision = this.decide(plan, cells);
281
+ const decl = {
282
+ name,
283
+ dtype: decision.dtype,
284
+ nullable: true,
285
+ origin: {
286
+ format: FORMAT,
287
+ id: null,
288
+ title: name === plan.name ? null : plan.name,
289
+ type: originType(plan, decision),
290
+ namespace: plan.namespace ?? (plan.hidden ? CYTOSCAPE_ORIGIN_NAMESPACE : null),
291
+ },
292
+ };
293
+ if (decision.itemDtype !== null) {
294
+ decl.itemDtype = decision.itemDtype;
295
+ }
296
+ const extra = {};
297
+ if (plan.hidden) {
298
+ extra.hidden = true;
299
+ }
300
+ if (plan.suid) {
301
+ extra.suidReference = true;
302
+ }
303
+ if (plan.equation) {
304
+ extra.equation = true;
305
+ }
306
+ if (Object.keys(extra).length > 0) {
307
+ decl.extra = extra;
308
+ }
309
+ const where = { element: name };
310
+ if (this.domain === "graph") {
311
+ const cell = plan.cells.get(0);
312
+ try {
313
+ sink.setGraphValue(name, cell === undefined ? undefined : convert(cell, decision), decl);
314
+ }
315
+ catch (err) {
316
+ this.report.recordError(err, where);
317
+ }
318
+ return;
319
+ }
320
+ let handle;
321
+ try {
322
+ ({ handle } = declareResolved(sink, this.domain, decl, this.report, where));
323
+ }
324
+ catch (err) {
325
+ this.report.recordError(err, where);
326
+ return;
327
+ }
328
+ for (const [row, cell] of plan.cells) {
329
+ const index = rowIndex(row);
330
+ if (index < 0) {
331
+ continue;
332
+ }
333
+ const value = convert(cell, decision);
334
+ try {
335
+ if (this.domain === "node") {
336
+ sink.setNodeValue(handle, index, value);
337
+ }
338
+ else {
339
+ sink.setEdgeValue(handle, index, value);
340
+ }
341
+ }
342
+ catch (err) {
343
+ this.report.recordError(err, { line: plan.lines.get(row) ?? null, element: name });
344
+ }
345
+ }
346
+ }
347
+ /**
348
+ * The dtype of a column from its cells, with the widening and precision warnings.
349
+ * @param plan - the column
350
+ * @param cells - its cells
351
+ * @returns the decision
352
+ */
353
+ decide(plan, cells) {
354
+ const where = { element: plan.name };
355
+ const typedKinds = new Set(cells.filter((c) => c.typed).map((c) => c.kind));
356
+ let widened = typedKinds.size > 1 || plan.declared.size > 1;
357
+ let decision;
358
+ if (cells.some((c) => c.kind === "json") ||
359
+ (cells.some((c) => c.kind === "list") && cells.some((c) => c.kind !== "list"))) {
360
+ decision = { dtype: "json", itemDtype: null, scalar: null, item: null, long: false };
361
+ }
362
+ else if (cells.length > 0 && cells.every((c) => c.kind === "list")) {
363
+ let item = null;
364
+ for (const cell of cells) {
365
+ if (cell.itemKind !== null) {
366
+ widened || (widened = item !== null && item !== cell.itemKind);
367
+ item = item === null ? cell.itemKind : widenScalar(item, cell.itemKind);
368
+ }
369
+ }
370
+ if (item === null) {
371
+ this.report.warnOnce("coercion", XGMML_ISSUE.EMPTY_LIST_TYPE, `list "${plan.name}" has no element type and no items; it is a list of strings`, where, `${XGMML_ISSUE.EMPTY_LIST_TYPE}:${this.domain}:${plan.name}`);
372
+ item = "string";
373
+ }
374
+ if (plan.overflow && item === "int") {
375
+ item = "real";
376
+ widened = true;
377
+ }
378
+ decision = { dtype: "list", itemDtype: DTYPES[item], scalar: null, item, long: item === "long" };
379
+ }
380
+ else {
381
+ decision = this.decideScalar(plan, cells);
382
+ widened || (widened = plan.overflow && decision.scalar === "real" && plan.declared.has("int"));
383
+ }
384
+ if (widened) {
385
+ this.report.warnOnce("coercion", XGMML_ISSUE.WIDENED, `${this.domain} column "${plan.name}" was widened to ${decision.dtype}: its values or declared types disagree`, where, `${XGMML_ISSUE.WIDENED}:${this.domain}:${plan.name}`);
386
+ }
387
+ if (plan.precision) {
388
+ this.report.warnOnce("precision", XGMML_ISSUE.PRECISION, `values of "${plan.name}" beyond what a double holds exactly are stored as the nearest double (or infinity)`, where, `${XGMML_ISSUE.PRECISION}:${this.domain}:${plan.name}`);
389
+ }
390
+ return decision;
391
+ }
392
+ /**
393
+ * The scalar decision of a column.
394
+ * @param plan - the column
395
+ * @param cells - its cells
396
+ * @returns the decision
397
+ */
398
+ decideScalar(plan, cells) {
399
+ let scalar = null;
400
+ for (const cell of cells) {
401
+ const kind = cell.kind;
402
+ scalar = scalar === null ? kind : widenScalar(scalar, kind);
403
+ }
404
+ if (scalar === null) {
405
+ const declared = [...plan.declared].find((k) => k in DTYPES);
406
+ scalar = declared ?? "string";
407
+ }
408
+ if (scalar === "int" && plan.overflow) {
409
+ scalar = "real";
410
+ }
411
+ const long = scalar === "long";
412
+ if (long && this.options.long === "string") {
413
+ return { dtype: "string", itemDtype: null, scalar: "string", item: null, long: true };
414
+ }
415
+ let dtype = DTYPES[scalar];
416
+ if (scalar === "string") {
417
+ const heuristic = new DictHeuristic();
418
+ for (const cell of cells) {
419
+ if (heuristic.observe(cell.text)) {
420
+ break;
421
+ }
422
+ }
423
+ dtype = heuristic.decide();
424
+ }
425
+ return { dtype, itemDtype: null, scalar, item: null, long };
426
+ }
427
+ /**
428
+ * Report a malformed att, once per kind of defect.
429
+ * @param message - the message
430
+ * @param att - the att
431
+ * @param kind - the defect, for the once key
432
+ */
433
+ badAtt(message, att, kind) {
434
+ this.report.warnOnce("parse-error", XGMML_ISSUE.BAD_ATT, message, { line: att.line, element: att.name }, `${XGMML_ISSUE.BAD_ATT}:${kind}`);
435
+ }
436
+ /**
437
+ * Report a value that does not parse as its declared kind (an error; the cell stays unset).
438
+ * @param text - the value
439
+ * @param kind - the kind
440
+ * @param at - the location
441
+ */
442
+ badValue(text, kind, at) {
443
+ this.report.error("validation-error", XGMML_ISSUE.BAD_VALUE, `value ${JSON.stringify(text)} is not a valid ${KIND_NAMES[kind]}; the cell is left unset`, at);
444
+ }
445
+ /**
446
+ * Report a record list, list of lists, map or foreign XML kept as json, once.
447
+ * @param message - the message
448
+ * @param at - the location
449
+ */
450
+ recordList(message, at) {
451
+ this.report.warnOnce("coercion", XGMML_ISSUE.RECORD_LIST, message, at);
452
+ }
453
+ }
454
+ /**
455
+ * Whether a Cytoscape type names Java's Integer exactly (`cy:type="Integer"`, a CyCSV
456
+ * `java.lang.Integer` column): a value beyond i32 is then not an Integer at all (Cytoscape cannot
457
+ * write one), where the XGMML `integer` of pre-3.3 Cytoscape also carried Longs and widens.
458
+ * @param cyType - the Cytoscape type, or null
459
+ * @returns true for Integer
460
+ */
461
+ function exactInteger(cyType) {
462
+ return cyType?.trim().toLowerCase() === "integer";
463
+ }
464
+ /**
465
+ * The `origin.type` of a column: "equation" for formulas, "long" for a declared long, else the
466
+ * declared type text.
467
+ * @param plan - the column
468
+ * @param decision - its decision
469
+ * @returns the type text, or null
470
+ */
471
+ function originType(plan, decision) {
472
+ if (plan.equation) {
473
+ return "equation";
474
+ }
475
+ return decision.long ? "long" : plan.declaredType;
476
+ }
477
+ /** How a kind is named in messages. */
478
+ const KIND_NAMES = {
479
+ bool: "boolean (1, 0, true, false, yes, no)",
480
+ int: "integer",
481
+ long: "long integer",
482
+ real: "real number",
483
+ string: "string",
484
+ };
485
+ /**
486
+ * The plans key of a column.
487
+ * @param namespace - the namespace, or null
488
+ * @param name - the name
489
+ * @returns the key
490
+ */
491
+ function key(namespace, name) {
492
+ return namespace === null ? name : `${namespace}\u0000${name}`;
493
+ }
494
+ /**
495
+ * The scalar kind of a text grammar dtype.
496
+ * @param dtype - the dtype
497
+ * @returns the kind
498
+ */
499
+ function textKind(dtype) {
500
+ switch (dtype) {
501
+ case "bool":
502
+ return "bool";
503
+ case "i32":
504
+ return "int";
505
+ case "f64":
506
+ return "real";
507
+ default:
508
+ return "string";
509
+ }
510
+ }
511
+ /**
512
+ * A scalar cell.
513
+ * @param kind - its kind
514
+ * @param value - its value
515
+ * @param text - its text as written
516
+ * @param typed - whether a declared type gave the kind
517
+ * @returns the cell
518
+ */
519
+ function scalarCell(kind, value, text, typed) {
520
+ return { kind, value, text, items: [], itemKind: null, typed };
521
+ }
522
+ /**
523
+ * A json cell.
524
+ * @param value - the value
525
+ * @returns the cell
526
+ */
527
+ function jsonCell(value) {
528
+ return { kind: "json", value, text: JSON.stringify(value), items: [], itemKind: null, typed: true };
529
+ }
530
+ /**
531
+ * An att with named children as a record of name to value.
532
+ * @param att - the att
533
+ * @returns the record
534
+ */
535
+ function recordOf(att) {
536
+ const out = {};
537
+ for (const child of att.children) {
538
+ out[child.name ?? ""] = jsonOfAtt(child);
539
+ }
540
+ return out;
541
+ }
542
+ /**
543
+ * An att as a json value: its value text, its children as an array or a record, or its XML.
544
+ * @param att - the att
545
+ * @returns the value
546
+ */
547
+ function jsonOfAtt(att) {
548
+ if (att.xml !== null) {
549
+ return att.xml;
550
+ }
551
+ if (att.children.length === 0) {
552
+ return att.value;
553
+ }
554
+ return isListLike(att) ? att.children.map(jsonOfAtt) : recordOf(att);
555
+ }
556
+ /**
557
+ * A cell as the value its column's dtype stores.
558
+ * @param cell - the cell
559
+ * @param decision - the column's decision
560
+ * @returns the value
561
+ */
562
+ function convert(cell, decision) {
563
+ if (decision.dtype === "json") {
564
+ if (cell.kind === "json") {
565
+ return cell.value;
566
+ }
567
+ return cell.kind === "list" ? cell.items.map((i) => i.value) : cell.value;
568
+ }
569
+ if (decision.dtype === "list") {
570
+ return cell.items.map((item) => convertScalar(item.value, item.text, decision.item ?? "string"));
571
+ }
572
+ return convertScalar(cell.value, cell.text, decision.long && decision.dtype === "string" ? "string" : (decision.scalar ?? "string"));
573
+ }
574
+ /**
575
+ * A scalar as the kind its column stores.
576
+ * @param value - the parsed value
577
+ * @param text - its text as written
578
+ * @param kind - the column's kind
579
+ * @returns the value
580
+ */
581
+ function convertScalar(value, text, kind) {
582
+ switch (kind) {
583
+ case "bool":
584
+ return value;
585
+ case "int":
586
+ case "long":
587
+ case "real":
588
+ return Number(value);
589
+ default:
590
+ return typeof value === "string" ? value : text;
591
+ }
592
+ }
593
+ //# sourceMappingURL=columns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columns.js","sourceRoot":"","sources":["../../../../src/formats/xgmml/columns.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAe,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAmB,WAAW,EAAE,MAAM,aAAa,CAAC;AAoD9F,qCAAqC;AACrC,MAAM,M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