@graphty/graph-io 0.3.36 → 0.3.38
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/dist/chunks/{choose-494CpuXQ.js → choose-CsO24U-5.js} +2 -2
- package/dist/chunks/{choose-494CpuXQ.js.map → choose-CsO24U-5.js.map} +1 -1
- package/dist/chunks/{constants-BBK4rsQZ.js → constants-BPRiVyBu.js} +2 -2
- package/dist/chunks/{constants-BBK4rsQZ.js.map → constants-BPRiVyBu.js.map} +1 -1
- package/dist/chunks/{escape-wVIEtLv6.js → escape-BRcyzD77.js} +4 -4
- package/dist/chunks/{escape-wVIEtLv6.js.map → escape-BRcyzD77.js.map} +1 -1
- package/dist/chunks/{export-Cbt4h_0n.js → export-CTUlibzr.js} +4 -4
- package/dist/chunks/export-CTUlibzr.js.map +1 -0
- package/dist/chunks/{exporter-DMxRy-0l.js → exporter-Bf5tZA0X.js} +5 -5
- package/dist/chunks/exporter-Bf5tZA0X.js.map +1 -0
- package/dist/chunks/{exporter-CqnmKk-f.js → exporter-Bn4jdYfd.js} +5 -5
- package/dist/chunks/exporter-Bn4jdYfd.js.map +1 -0
- package/dist/chunks/{exporter-LZTIAzkS.js → exporter-D-qQuRcG.js} +9 -9
- package/dist/chunks/exporter-D-qQuRcG.js.map +1 -0
- package/dist/chunks/{exporter-CkPnJCXU.js → exporter-F0vT919P.js} +4 -4
- package/dist/chunks/exporter-F0vT919P.js.map +1 -0
- package/dist/chunks/{importer-DvPvd4Yy.js → importer-Bgb9sgZZ.js} +9 -9
- package/dist/chunks/importer-Bgb9sgZZ.js.map +1 -0
- package/dist/chunks/{importer-BTSvNJUB.js → importer-BuzbaFFY.js} +10 -4
- package/dist/chunks/importer-BuzbaFFY.js.map +1 -0
- package/dist/chunks/{importer-CSmH218L.js → importer-CEuUmyPe.js} +10 -10
- package/dist/chunks/importer-CEuUmyPe.js.map +1 -0
- package/dist/chunks/{importer-C1VMuEBQ.js → importer-CNMQnHDd.js} +11 -11
- package/dist/chunks/importer-CNMQnHDd.js.map +1 -0
- package/dist/chunks/{importer-DMgcD1wI.js → importer-DqMtyYLX.js} +11 -11
- package/dist/chunks/importer-DqMtyYLX.js.map +1 -0
- package/dist/chunks/{importer-BTbjwN10.js → importer-oIUx9u_g.js} +9 -9
- package/dist/chunks/importer-oIUx9u_g.js.map +1 -0
- package/dist/chunks/{importer-DtKPzhVp.js → importer-yWUPR_nU.js} +13 -13
- package/dist/chunks/importer-yWUPR_nU.js.map +1 -0
- package/dist/chunks/{json-elements-CxJF-Szz.js → json-elements-AkglPS3m.js} +4 -4
- package/dist/chunks/json-elements-AkglPS3m.js.map +1 -0
- package/dist/chunks/{ontology-export-p1PsPenq.js → ontology-export-DDoG3egY.js} +2 -2
- package/dist/chunks/{ontology-export-p1PsPenq.js.map → ontology-export-DDoG3egY.js.map} +1 -1
- package/dist/chunks/{records-BrfHycmg.js → records-ChmWZGuz.js} +2 -2
- package/dist/chunks/{records-BrfHycmg.js.map → records-ChmWZGuz.js.map} +1 -1
- package/dist/chunks/{text-BD-TzLNm.js → text-Btw3sBe_.js} +2 -2
- package/dist/chunks/{text-BD-TzLNm.js.map → text-Btw3sBe_.js.map} +1 -1
- package/dist/csv.js +4 -4
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +1 -1
- package/dist/gexf.js +30 -30
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +9 -9
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +28 -28
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +2 -2
- package/dist/json.js +1 -1
- package/dist/neo4j.js +8 -8
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/src/common/attributes.d.ts +1 -2
- package/dist/src/common/attributes.d.ts.map +1 -1
- package/dist/src/common/attributes.js +2 -2
- package/dist/src/common/attributes.js.map +1 -1
- package/dist/src/common/cx-export.d.ts +5 -2
- package/dist/src/common/cx-export.d.ts.map +1 -1
- package/dist/src/common/cx-export.js +11 -2
- package/dist/src/common/cx-export.js.map +1 -1
- package/dist/src/common/direction.d.ts +1 -2
- package/dist/src/common/direction.d.ts.map +1 -1
- package/dist/src/common/direction.js +2 -2
- package/dist/src/common/direction.js.map +1 -1
- package/dist/src/common/escape.js +1 -1
- package/dist/src/common/escape.js.map +1 -1
- package/dist/src/common/export.js +1 -1
- package/dist/src/common/export.js.map +1 -1
- package/dist/src/common/ids.d.ts +1 -2
- package/dist/src/common/ids.d.ts.map +1 -1
- package/dist/src/common/ids.js +1 -2
- package/dist/src/common/ids.js.map +1 -1
- package/dist/src/common/input.d.ts +1 -2
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +2 -2
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/json-elements.js +1 -1
- package/dist/src/common/json-elements.js.map +1 -1
- package/dist/src/common/options.d.ts +1 -2
- package/dist/src/common/options.d.ts.map +1 -1
- package/dist/src/common/options.js +1 -1
- package/dist/src/common/options.js.map +1 -1
- package/dist/src/common/xml.js +1 -1
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/formats/cx/exporter.js +1 -1
- package/dist/src/formats/cx/exporter.js.map +1 -1
- package/dist/src/formats/cx/importer.js +6 -6
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx2/exporter.js +1 -1
- package/dist/src/formats/cx2/exporter.js.map +1 -1
- package/dist/src/formats/cys/importer.js +3 -3
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/tables.js +1 -1
- package/dist/src/formats/cys/tables.js.map +1 -1
- package/dist/src/formats/dot/exporter.js +3 -3
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.js +1 -1
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +24 -27
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts +1 -2
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +5 -5
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gml/exporter.js +4 -4
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/syntax.js +2 -2
- package/dist/src/formats/gml/syntax.js.map +1 -1
- package/dist/src/formats/graphml/exporter.js +3 -3
- package/dist/src/formats/graphml/exporter.js.map +1 -1
- package/dist/src/formats/graphml/importer.js +2 -2
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/graphml/tree.js +2 -2
- package/dist/src/formats/graphml/tree.js.map +1 -1
- package/dist/src/formats/json/dialect.js +1 -1
- package/dist/src/formats/json/dialect.js.map +1 -1
- package/dist/src/formats/json/exporter.js +1 -1
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.js +1 -1
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/neo4j/exporter.d.ts.map +1 -1
- package/dist/src/formats/neo4j/exporter.js +4 -7
- package/dist/src/formats/neo4j/exporter.js.map +1 -1
- package/dist/src/formats/neo4j/header.js +2 -2
- package/dist/src/formats/neo4j/header.js.map +1 -1
- package/dist/src/formats/obo/syntax.js +1 -1
- package/dist/src/formats/obo/syntax.js.map +1 -1
- package/dist/src/formats/pajek/exporter.js +4 -4
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/document.js +6 -6
- package/dist/src/formats/xgmml/document.js.map +1 -1
- package/dist/src/formats/xgmml/emit.js +2 -2
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +1 -1
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/importer.js +1 -1
- package/dist/src/formats/xgmml/importer.js.map +1 -1
- package/dist/src/registry.js +2 -2
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sniff.js +1 -1
- package/dist/src/sniff.js.map +1 -1
- package/dist/xgmml.js +2 -2
- package/package.json +2 -2
- package/src/common/attributes.ts +1 -2
- package/src/common/cx-export.ts +11 -2
- package/src/common/direction.ts +2 -2
- package/src/common/escape.ts +1 -1
- package/src/common/export.ts +1 -1
- package/src/common/ids.ts +1 -3
- package/src/common/input.ts +2 -2
- package/src/common/json-elements.ts +1 -1
- package/src/common/options.ts +1 -1
- package/src/common/xml.ts +1 -1
- package/src/formats/csv/importer.ts +1 -1
- package/src/formats/cx/exporter.ts +1 -1
- package/src/formats/cx/importer.ts +6 -6
- package/src/formats/cx2/exporter.ts +1 -1
- package/src/formats/cys/importer.ts +3 -3
- package/src/formats/cys/tables.ts +1 -1
- package/src/formats/dot/exporter.ts +3 -3
- package/src/formats/dot/importer.ts +2 -2
- package/src/formats/gexf/exporter.ts +24 -28
- package/src/formats/gexf/importer.ts +5 -5
- package/src/formats/gml/exporter.ts +4 -4
- package/src/formats/gml/importer.ts +1 -1
- package/src/formats/gml/syntax.ts +2 -2
- package/src/formats/graphml/exporter.ts +3 -3
- package/src/formats/graphml/importer.ts +2 -2
- package/src/formats/graphml/tree.ts +2 -2
- package/src/formats/json/dialect.ts +1 -1
- package/src/formats/json/exporter.ts +1 -1
- package/src/formats/json/importer.ts +1 -1
- package/src/formats/neo4j/exporter.ts +4 -7
- package/src/formats/neo4j/header.ts +2 -2
- package/src/formats/obo/syntax.ts +1 -1
- package/src/formats/pajek/exporter.ts +4 -4
- package/src/formats/pajek/importer.ts +1 -1
- package/src/formats/xgmml/document.ts +6 -6
- package/src/formats/xgmml/emit.ts +2 -2
- package/src/formats/xgmml/exporter.ts +5 -2
- package/src/formats/xgmml/importer.ts +1 -1
- package/src/registry.ts +2 -2
- package/src/sniff.ts +1 -1
- package/dist/chunks/export-Cbt4h_0n.js.map +0 -1
- package/dist/chunks/exporter-CkPnJCXU.js.map +0 -1
- package/dist/chunks/exporter-CqnmKk-f.js.map +0 -1
- package/dist/chunks/exporter-DMxRy-0l.js.map +0 -1
- package/dist/chunks/exporter-LZTIAzkS.js.map +0 -1
- package/dist/chunks/importer-BTSvNJUB.js.map +0 -1
- package/dist/chunks/importer-BTbjwN10.js.map +0 -1
- package/dist/chunks/importer-C1VMuEBQ.js.map +0 -1
- package/dist/chunks/importer-CSmH218L.js.map +0 -1
- package/dist/chunks/importer-DMgcD1wI.js.map +0 -1
- package/dist/chunks/importer-DtKPzhVp.js.map +0 -1
- package/dist/chunks/importer-DvPvd4Yy.js.map +0 -1
- package/dist/chunks/json-elements-CxJF-Szz.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GraphFormatError } from "@graphty/graph-format";
|
|
2
|
-
import { a as CX2_FORMAT, s as stringify, d as directionNotes, p as planNodeIds, O as ORIGINAL_ID_ATTRIBUTE, b as planEdgeIds, e as cx2Type, f as aspectBlock, g as declaredType, B as BYPASS_NAMESPACE, n as nonFinitePositions } from "./importer-
|
|
3
|
-
import { c as capabilities, L as LOSS, r as resolveExportOptions, p as pairFolding, e as explicitWeights, a as checkCapabilities, b as plural } from "./export-
|
|
4
|
-
import { i as isRecord, P as POSITION_COLUMN } from "./json-elements-
|
|
2
|
+
import { a as CX2_FORMAT, s as stringify, d as directionNotes, p as planNodeIds, O as ORIGINAL_ID_ATTRIBUTE, b as planEdgeIds, e as cx2Type, f as aspectBlock, g as declaredType, B as BYPASS_NAMESPACE, n as nonFinitePositions } from "./importer-BuzbaFFY.js";
|
|
3
|
+
import { c as capabilities, L as LOSS, r as resolveExportOptions, p as pairFolding, e as explicitWeights, a as checkCapabilities, b as plural } from "./export-CTUlibzr.js";
|
|
4
|
+
import { i as isRecord, P as POSITION_COLUMN } from "./json-elements-AkglPS3m.js";
|
|
5
5
|
import { j as joinText, e as encodeChunks } from "./writer-DxjgHwSe.js";
|
|
6
6
|
const CX2_LOSS = Object.freeze({
|
|
7
7
|
/**
|
|
@@ -258,7 +258,7 @@ function plan(snapshot, common) {
|
|
|
258
258
|
).map((p) => ({ ...p, key: p.name }));
|
|
259
259
|
const position = snapshot.nodes.byRole("position");
|
|
260
260
|
nonFiniteNote(snapshot, [...nodeAttrs, ...edgeAttrs, ...graphAttrs], weights, position, note);
|
|
261
|
-
const edgeIds = planEdgeIds(snapshot, note);
|
|
261
|
+
const edgeIds = planEdgeIds(snapshot, note, ids);
|
|
262
262
|
const z = [...snapshot.nodes].find(isZ) ?? null;
|
|
263
263
|
const positionZ = position !== null && z === null && position.meta.extra.sourceDims === 3;
|
|
264
264
|
return {
|
|
@@ -565,4 +565,4 @@ export {
|
|
|
565
565
|
CX2_LOSS as a,
|
|
566
566
|
cx2Exporter as c
|
|
567
567
|
};
|
|
568
|
-
//# sourceMappingURL=exporter-
|
|
568
|
+
//# sourceMappingURL=exporter-Bf5tZA0X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exporter-Bf5tZA0X.js","sources":["../../src/formats/cx2/exporter.ts"],"sourcesContent":["/**\n * The CX2 exporter (design/graph-io/cytoscape-and-obo/design.md section 1.3; graphty issue #307):\n * writes a snapshot as one CX2 document -- the descriptor, the pre-metadata, one\n * `attributeDeclarations` block (aliases from `origin.id`, defaults from `meta.default`),\n * `networkAttributes`, `nodes` (x / y from the position with y flipped back to screen coordinates,\n * `z` from the `z` column), `edges`, the `cx2.bypass` columns as `nodeBypasses` / `edgeBypasses`,\n * the opaque aspects a CX2 import kept (which returns its own style rules) and `status`.\n *\n * What CX2 cannot hold is announced by check() before anything is written: every edge is\n * directed (W_CX2_UNDIRECTED_AS_DIRECTED, W_MUTUAL_EXPANDED), node ids are integers (E_ID_CHARSET\n * unless `sanitizeIds: \"mangle\"`, which keeps the original in the `graphty:originalId` attribute\n * the importer restores), nested values are written as JSON text (W_CX2_JSON_AS_STRING), NaN and\n * the infinities as null (W_CX2_NONFINITE_AS_NULL), and the generic notes of checkCapabilities().\n */\n\nimport { type Column, GraphFormatError, type GraphSnapshot } from \"@graphty/graph-format\";\n\nimport {\n aspectBlock,\n declaredType,\n directionNotes,\n nonFinitePositions,\n planEdgeIds,\n planNodeIds,\n stringify,\n type WrittenIds,\n} from \"../../common/cx-export.js\";\nimport { type PairFolding, pairFolding } from \"../../common/direction.js\";\nimport { capabilities, checkCapabilities, LOSS } from \"../../common/export.js\";\nimport { isRecord, POSITION_COLUMN } from \"../../common/json-elements.js\";\nimport { type ResolvedExportOptions, resolveExportOptions } from \"../../common/options.js\";\nimport { plural } from \"../../common/plural.js\";\nimport { type ExplicitWeights, explicitWeights } from \"../../common/weights.js\";\nimport { encodeChunks, joinText } from \"../../common/writer.js\";\nimport { type CommonExportOptions, type ExportCapabilities, type GraphExporter, type LossNote } from \"../../types.js\";\nimport { BYPASS_NAMESPACE, CX2_FORMAT, cx2Type, ORIGINAL_ID_ATTRIBUTE } from \"./importer.js\";\n\n/**\n * The options of the CX2 exporter: the common export options; it has none of its own.\n * @category Built-in formats\n */\nexport type Cx2ExportOptions = CommonExportOptions;\n\n/**\n * The loss notes the CX2 exporter's check() returns, by name. A key is the\n * code without its severity and format prefixes.\n * @category Built-in formats\n */\nexport const CX2_LOSS = Object.freeze({\n /**\n * Every edge is written as directed, so an undirected graph, or the undirected edges of a mixed graph, read back\n * as directed.\n */\n UNDIRECTED_AS_DIRECTED: \"W_CX2_UNDIRECTED_AS_DIRECTED\",\n /** A nested (json) column is written as a string attribute holding its JSON text. */\n JSON_AS_STRING: \"W_CX2_JSON_AS_STRING\",\n /** NaN and the infinities cannot be written; they are written as null and read back unset. */\n NONFINITE_AS_NULL: \"W_CX2_NONFINITE_AS_NULL\",\n /** A mutual pair is written as two directed edges without its mark. */\n MUTUAL_EXPANDED: LOSS.MUTUAL_EXPANDED,\n /**\n * An attribute without the weight role is named like the key weights are written under; it reads back as the edge\n * weight, or is not written when the graph has weights of its own.\n */\n WEIGHT_KEY_CLASH: LOSS.WEIGHT_KEY_CLASH,\n /** A parent / parents column: CX2 has no containment. */\n HIERARCHY_DROPPED: LOSS.HIERARCHY,\n /** A start / end / timestamp column: CX2 has no time. */\n TEMPORAL_DROPPED: LOSS.TEMPORAL,\n /** An attribute with a role the format has no place for is written as a plain attribute; the role is lost. */\n ROLE_DROPPED: LOSS.ROLE,\n /**\n * An attribute type CX2 stores as another (a 32-bit float as double, an unsigned integer as long, a dictionary as\n * string); it reads back with that type.\n */\n DTYPE_UNSUPPORTED: LOSS.DTYPE,\n /**\n * Node ids the format cannot write, under `sanitizeIds: \"error\"`; the save fails with E_INVALID_ID. Pass\n * `sanitizeIds: \"mangle\"` to rewrite them.\n */\n ID_CHARSET: LOSS.ID_CHARSET,\n /** Node ids that are not integers under sanitizeIds \"mangle\": renumbered, originals kept. */\n ID_MANGLED: LOSS.ID_MANGLED,\n /** Edges without a usable id get generated integer ids. */\n EDGE_IDS_GENERATED: LOSS.EDGE_IDS_GENERATED,\n});\n\n/**\n * What CX2 keeps: directed multigraphs with self-loops, integer node ids,\n * required integer edge ids, declared string / double / integer / boolean columns and lists of\n * them, declared defaults, network attributes and the position role. f32, u32, u8 and dict columns\n * are written as the nearest declared type and read back as it.\n * @category Built-in formats\n */\nexport const CX2_CAPABILITIES: ExportCapabilities = capabilities({\n mixedDirection: false,\n multiEdges: true,\n selfLoops: true,\n edgeIds: \"required\",\n idCharset: \"integer\",\n dtypes: [\"string\", \"f64\", \"i32\", \"bool\"],\n components: false,\n lists: true,\n json: false,\n defaults: true,\n options: false,\n hierarchy: false,\n temporal: \"none\",\n graphAttributes: true,\n positions: true,\n viz: false,\n});\n\n/** The roles CX2 has a slot for, and the column names its importer gives them. */\nconst SLOT_ROLES: ReadonlySet<string> = new Set([\"label\", \"position\", \"id\"]);\nconst ROLE_NAMES: Readonly<Record<string, string>> = Object.freeze({\n label: \"name\",\n position: POSITION_COLUMN,\n});\n\n/** Roles whose columns are never written as attributes. */\nconst SKIPPED_ROLES: ReadonlySet<string> = new Set([\n \"directed\",\n \"pair\",\n \"mutual\",\n \"weight\",\n \"timeText\",\n \"originalId\",\n \"parent\",\n \"parents\",\n \"start\",\n \"end\",\n \"timestamp\",\n \"timestamps\",\n \"spells\",\n \"open\",\n \"spellsOpen\",\n \"position\",\n \"color\",\n \"size\",\n \"shape\",\n \"thickness\",\n]);\n\n/** The aspects the exporter writes itself; an opaque aspect of the same name is not written again. */\nconst CORE_ASPECTS: ReadonlySet<string> = new Set([\n \"nodes\",\n \"edges\",\n \"attributeDeclarations\",\n \"networkAttributes\",\n \"nodeBypasses\",\n \"edgeBypasses\",\n \"metaData\",\n \"status\",\n]);\n\n/** The weight attribute name. */\nconst WEIGHT_ATTRIBUTE = \"weight\";\n\n/** One attribute column as it will be written. */\ninterface AttributePlan {\n readonly column: Column;\n /** The full attribute name. */\n readonly name: string;\n /** The key used in v (the alias, or the name). */\n readonly key: string;\n /** The declared type text. */\n readonly d: string;\n /** Whether values are written as their JSON text (a json column). */\n readonly jsonText: boolean;\n}\n\n/** Everything export() and check() need, computed once. */\ninterface Plan {\n readonly notes: LossNote[];\n readonly fatal: GraphFormatError | null;\n readonly ids: WrittenIds | null;\n readonly folding: PairFolding;\n readonly weights: ExplicitWeights;\n readonly nodeAttrs: readonly AttributePlan[];\n readonly edgeAttrs: readonly AttributePlan[];\n readonly graphAttrs: readonly AttributePlan[];\n readonly nodeBypasses: readonly Column[];\n readonly edgeBypasses: readonly Column[];\n readonly position: Column | null;\n readonly positionZ: boolean;\n readonly z: Column | null;\n readonly edgeIds: readonly number[];\n readonly originalIds: boolean;\n}\n\n/**\n * Whether a column is a bypass column of a CX2 import.\n * @param column - the column\n * @returns true for the cx2.bypass namespace\n */\nfunction isBypass(column: Column): boolean {\n return column.meta.origin?.namespace === BYPASS_NAMESPACE;\n}\n\n/**\n * Whether a column is the z (stacking order) column.\n * @param column - the column\n * @returns true for the column marked by a Cytoscape-family importer\n */\nfunction isZ(column: Column): boolean {\n return column.meta.extra.cytoscape === \"z\";\n}\n\n/**\n * Count the non-finite numbers of a column.\n * @param column - the column\n * @returns how many set cells (or list items) are NaN or infinite\n */\nfunction nonFiniteCount(column: Column): number {\n const { dtype, itemDtype } = column.meta;\n const numeric =\n dtype === \"f32\" || dtype === \"f64\" || (dtype === \"list\" && (itemDtype === \"f32\" || itemDtype === \"f64\"));\n if (!numeric) {\n return 0;\n }\n let count = 0;\n for (let i = 0; i < column.length; i++) {\n if (!column.isSet(i)) {\n continue;\n }\n const value = column.value(i);\n if (dtype === \"list\") {\n if ((value as readonly number[]).some((v) => !Number.isFinite(v))) {\n count++;\n }\n } else if (!Number.isFinite(value)) {\n count++;\n }\n }\n return count;\n}\n\n/**\n * Plan the attribute columns of one table.\n * @param table - the table\n * @param skip - columns not written as attributes\n * @param rename - the written name of a column, when it differs (the label as `name`)\n * @param reserved - keys already used in v\n * @returns the plans\n */\nfunction planAttributes(\n table: Iterable<Column>,\n skip: (column: Column) => boolean,\n rename: (column: Column) => string,\n reserved: ReadonlySet<string> = new Set(),\n): AttributePlan[] {\n const plans: AttributePlan[] = [];\n const used = new Set<string>(reserved);\n const candidates = [...table].filter((c) => !skip(c));\n for (const column of candidates) {\n used.add(rename(column));\n }\n for (const column of candidates) {\n const name = rename(column);\n const { origin } = column.meta;\n let key = name;\n const alias = origin?.format === CX2_FORMAT && typeof origin.id === \"string\" ? origin.id : null;\n if (alias !== null && alias.length > 0 && alias !== name && !used.has(alias)) {\n key = alias;\n used.add(alias);\n }\n plans.push({ column, name, key, d: declaredType(column), jsonText: column.meta.dtype === \"json\" });\n }\n return plans;\n}\n\n/** A note-recording callback. */\ntype Note = (code: string, message: string, column?: string | null, count?: number | null) => void;\n\n/**\n * The generic notes of checkCapabilities(), adapted to CX2: bypass columns hold any JSON value,\n * ids are counted by planNodeIds(), nested values are written as JSON text, and only the node\n * label is written into the \"n\" slot (an edge label keeps its own name but loses its role).\n * @param snapshot - the snapshot\n * @param common - the resolved common options\n * @param notes - the notes so far, appended to\n * @param note - the recorder\n * @returns the fatal condition, or null\n */\nfunction capabilityNotes(\n snapshot: GraphSnapshot,\n common: ResolvedExportOptions,\n notes: LossNote[],\n note: Note,\n): GraphFormatError | null {\n let fatal: GraphFormatError | null = null;\n // bypass columns are written as bypasses, which hold any JSON value\n const bypassNames = new Set(\n [...snapshot.nodes, ...snapshot.edges].filter((c) => isBypass(c) || isZ(c)).map((c) => c.meta.name),\n );\n for (const gen of checkCapabilities(snapshot, CX2_CAPABILITIES, common, {\n roles: SLOT_ROLES,\n roleNames: ROLE_NAMES,\n // only the node label is written into the \"n\" slot; an edge label keeps its own name\n edgeRoleNames: {},\n })) {\n if (!keepGenericNote(gen, bypassNames)) {\n continue;\n }\n if (gen.code === LOSS.JSON) {\n note(\n CX2_LOSS.JSON_AS_STRING,\n `${gen.column === null ? \"a column\" : `column \"${gen.column}\"`} holds nested values; written as a string attribute holding their JSON text`,\n gen.column,\n gen.count,\n );\n continue;\n }\n if (gen.code === LOSS.MIXED_DIRECTION_ERROR && fatal === null) {\n fatal = new GraphFormatError(\"E_DIRECTED\", gen.message, { reason: \"mixed direction\" });\n }\n notes.push(gen);\n }\n const edgeLabel = snapshot.edges.byRole(\"label\");\n if (edgeLabel !== null) {\n note(\n LOSS.ROLE,\n `edge column \"${edgeLabel.meta.name}\" (label) is written as a plain attribute; CX2 edges have no label slot and the role is lost`,\n edgeLabel.meta.name,\n edgeLabel.length - edgeLabel.nullCount,\n );\n }\n return fatal;\n}\n\n/**\n * Whether a generic note applies to CX2 as it stands.\n * @param gen - the generic note\n * @param bypassNames - the names of the columns written as bypasses\n * @returns false for a note CX2 drops or replaces\n */\nfunction keepGenericNote(gen: LossNote, bypassNames: ReadonlySet<string>): boolean {\n if (gen.column !== null && bypassNames.has(gen.column) && (gen.code === LOSS.JSON || gen.code === LOSS.DTYPE)) {\n return false;\n }\n // ids are counted by planNodeIds(): CX2 also keeps integer ids beyond 2^53, which the generic rule refuses\n return gen.code !== LOSS.ID_CHARSET && gen.code !== LOSS.ID_MANGLED;\n}\n\n/**\n * Note the NaN and infinite values written as null: attribute cells, explicit weights, positions.\n * @param snapshot - the snapshot\n * @param attrs - every planned attribute\n * @param weights - the explicit weights\n * @param position - the position column, or null\n * @param note - the recorder\n */\nfunction nonFiniteNote(\n snapshot: GraphSnapshot,\n attrs: readonly AttributePlan[],\n weights: ExplicitWeights,\n position: Column | null,\n note: Note,\n): void {\n let nonfinite = 0;\n for (const p of attrs) {\n nonfinite += nonFiniteCount(p.column);\n }\n for (let e = 0; e < snapshot.edgeCount; e++) {\n if (weights.isExplicit(e) && !Number.isFinite(weights.value(e))) {\n nonfinite++;\n }\n }\n if (position !== null) {\n nonfinite += nonFinitePositions(position);\n }\n if (nonfinite > 0) {\n note(\n CX2_LOSS.NONFINITE_AS_NULL,\n `${nonfinite} NaN or infinite value${plural(nonfinite)} cannot be written in CX2; written as null, they read back unset`,\n null,\n nonfinite,\n );\n }\n}\n\n/**\n * Plan the edge attributes, noting a plain `weight` column that clashes with the weight key.\n * @param snapshot - the snapshot\n * @param weights - the explicit weights\n * @param note - the recorder\n * @returns the edge attribute plans\n */\nfunction planEdgeAttributes(snapshot: GraphSnapshot, weights: ExplicitWeights, note: Note): AttributePlan[] {\n const plainWeight = snapshot.edges.get(WEIGHT_ATTRIBUTE);\n if (plainWeight !== null && plainWeight.meta.role === null) {\n note(\n LOSS.WEIGHT_KEY_CLASH,\n weights.weighted\n ? `edge column \"${WEIGHT_ATTRIBUTE}\" is not written: the explicit weights are written under that name`\n : `edge column \"${WEIGHT_ATTRIBUTE}\" reads back as the edge weight`,\n WEIGHT_ATTRIBUTE,\n null,\n );\n }\n return planAttributes(\n snapshot.edges,\n (c) =>\n (c.meta.role !== null && (SKIPPED_ROLES.has(c.meta.role) || c.meta.role === \"id\")) ||\n isBypass(c) ||\n (weights.weighted && c === plainWeight),\n (c) => c.meta.name,\n weights.weighted ? new Set([WEIGHT_ATTRIBUTE]) : new Set(),\n );\n}\n\n/**\n * Plan an export: the notes, the fatal condition and what is written.\n * @param snapshot - the snapshot\n * @param common - the resolved common options\n * @returns the plan\n */\nfunction plan(snapshot: GraphSnapshot, common: ResolvedExportOptions): Plan {\n const notes: LossNote[] = [];\n const note: Note = (code, message, column = null, count = null) => {\n notes.push(Object.freeze({ code, message, column, count }));\n };\n let fatal = capabilityNotes(snapshot, common, notes, note);\n\n const folding = pairFolding(snapshot);\n directionNotes(snapshot, folding, common, CX2_LOSS.UNDIRECTED_AS_DIRECTED, note);\n\n const planned = planNodeIds(snapshot, common, \"CX2\", ORIGINAL_ID_ATTRIBUTE, note);\n const ids = planned instanceof GraphFormatError ? null : planned;\n if (planned instanceof GraphFormatError) {\n fatal ??= planned;\n }\n\n const weights = explicitWeights(snapshot);\n const label = snapshot.nodes.byRole(\"label\");\n const nodeAttrs = planAttributes(\n snapshot.nodes,\n (c) => (c.meta.role !== null && SKIPPED_ROLES.has(c.meta.role)) || isBypass(c) || isZ(c),\n (c) => (c === label && !snapshot.nodes.has(\"name\") ? \"name\" : c.meta.name),\n ids !== null && ids.changed > 0 ? new Set([ORIGINAL_ID_ATTRIBUTE]) : new Set(),\n );\n const edgeAttrs = planEdgeAttributes(snapshot, weights, note);\n const graphAttrs = planAttributes(\n snapshot.graph,\n () => false,\n (c) => c.meta.name,\n ).map((p) => ({ ...p, key: p.name }));\n\n const position = snapshot.nodes.byRole(\"position\");\n nonFiniteNote(snapshot, [...nodeAttrs, ...edgeAttrs, ...graphAttrs], weights, position, note);\n\n const edgeIds = planEdgeIds(snapshot, note, ids);\n const z = [...snapshot.nodes].find(isZ) ?? null;\n const positionZ = position !== null && z === null && position.meta.extra.sourceDims === 3;\n return {\n notes,\n fatal,\n ids,\n folding,\n weights,\n nodeAttrs,\n edgeAttrs,\n graphAttrs,\n nodeBypasses: [...snapshot.nodes].filter(isBypass),\n edgeBypasses: [...snapshot.edges].filter(isBypass),\n position,\n positionZ,\n z,\n edgeIds,\n originalIds: ids !== null && ids.changed > 0,\n };\n}\n\n// ============================================================ writing\n\n/**\n * The value written for one cell.\n * @param p - the attribute plan\n * @param row - the row\n * @returns the value, or undefined for an unset cell\n */\nfunction cellValue(p: AttributePlan, row: number): unknown {\n const { column } = p;\n if (!column.isSet(row)) {\n return undefined;\n }\n const value = column.value(row);\n if (p.jsonText) {\n return JSON.stringify(value);\n }\n if (column.meta.dtype === \"list\" || column.meta.components > 1) {\n const items = Array.from(value as ArrayLike<unknown>);\n if (p.d === \"string\") {\n return JSON.stringify(items);\n }\n return items.some((v) => typeof v === \"number\" && !Number.isFinite(v)) ? null : items;\n }\n if (typeof value === \"number\" && !Number.isFinite(value)) {\n return null;\n }\n return value;\n}\n\n/**\n * The declarations of one table.\n * @param plans - the attribute plans\n * @param defaults - whether defaults and aliases may be written (not for network attributes)\n * @returns the declaration object\n */\nfunction declarations(plans: readonly AttributePlan[], defaults: boolean): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const p of plans) {\n const decl: Record<string, unknown> = { d: p.d };\n if (defaults && p.key !== p.name) {\n decl.a = p.key;\n }\n const fallback = p.column.meta.default;\n if (defaults && fallback !== undefined && fallback !== null) {\n if (defaultFits(cx2Type(p.d), fallback)) {\n decl.v = fallback;\n }\n }\n out[p.name] = decl;\n }\n return out;\n}\n\n/**\n * Whether a declared default can be written as the value of a declared type.\n * @param type - the type\n * @param fallback - the default\n * @returns true when it matches\n */\nfunction defaultFits(type: ReturnType<typeof cx2Type>, fallback: unknown): boolean {\n if (type === null) {\n return false;\n }\n if (type.list) {\n return Array.isArray(fallback);\n }\n switch (type.scalar) {\n case \"string\":\n return typeof fallback === \"string\";\n case \"boolean\":\n return typeof fallback === \"boolean\";\n default:\n return typeof fallback === \"number\" && Number.isFinite(fallback);\n }\n}\n\n/**\n * The v object of one element.\n * @param plans - the attribute plans\n * @param row - the row\n * @returns the object, or null when empty\n */\nfunction attributesOf(plans: readonly AttributePlan[], row: number): Record<string, unknown> | null {\n let out: Record<string, unknown> | null = null;\n for (const p of plans) {\n const value = cellValue(p, row);\n if (value !== undefined) {\n out ??= {};\n out[p.key] = value;\n }\n }\n return out;\n}\n\n/**\n * Write the document as text parts.\n * @param snapshot - the snapshot\n * @param p - the plan\n * @yields the document's text\n * @returns nothing\n */\nfunction* write(snapshot: GraphSnapshot, p: Plan): Generator<string, void, undefined> {\n if (p.fatal !== null) {\n throw p.fatal;\n }\n const { ids } = p;\n if (ids === null) {\n throw new GraphFormatError(\"E_INVALID_ID\", \"node ids cannot be written as CX2 integers\", { reason: \"charset\" });\n }\n const { src, dst } = snapshot.edgeList();\n const edges: number[] = [];\n for (let e = 0; e < snapshot.edgeCount; e++) {\n if (!p.folding.folded(e)) {\n edges.push(e);\n }\n }\n\n const nodeDecls = declarations(p.nodeAttrs, true);\n if (p.originalIds) {\n nodeDecls[ORIGINAL_ID_ATTRIBUTE] = { d: \"string\" };\n }\n const edgeDecls = declarations(p.edgeAttrs, true);\n if (p.weights.weighted) {\n edgeDecls[WEIGHT_ATTRIBUTE] = { d: \"double\" };\n }\n const networkDecls = declarations(p.graphAttrs, false);\n const network: Record<string, unknown> = {};\n for (const a of p.graphAttrs) {\n const value = cellValue(a, 0);\n if (value !== undefined) {\n network[a.name] = value;\n }\n }\n const { meta } = snapshot;\n for (const [key, value] of [\n [\"name\", meta.name],\n [\"description\", meta.description],\n ] as const) {\n if (value !== null && !(key in network) && !(key in networkDecls)) {\n network[key] = value;\n networkDecls[key] = { d: \"string\" };\n }\n }\n const kept = isRecord(meta.extra.cx2) ? meta.extra.cx2 : {};\n const otherDecls = isRecord(kept.declarations) ? kept.declarations : {};\n const opaque = meta.sourceFormat === CX2_FORMAT && isRecord(kept.opaque) ? kept.opaque : {};\n const declarationsElement: Record<string, unknown> = { ...otherDecls };\n for (const [key, table] of [\n [\"networkAttributes\", networkDecls],\n [\"nodes\", nodeDecls],\n [\"edges\", edgeDecls],\n ] as const) {\n if (Object.keys(table).length > 0) {\n declarationsElement[key] = table;\n }\n }\n const nodeBypassRows = bypassRows(p.nodeBypasses, snapshot.nodeCount);\n const edgeBypassRows = bypassRows(p.edgeBypasses, snapshot.edgeCount).filter((e) => !p.folding.folded(e));\n const opaqueAspects = Object.entries(opaque).filter(\n (entry): entry is [string, unknown[]] => !CORE_ASPECTS.has(entry[0]) && Array.isArray(entry[1]),\n );\n\n const counts: [string, number][] = [];\n const hasDeclarations = Object.keys(declarationsElement).length > 0;\n if (hasDeclarations) {\n counts.push([\"attributeDeclarations\", 1]);\n }\n if (Object.keys(network).length > 0) {\n counts.push([\"networkAttributes\", 1]);\n }\n counts.push([\"nodes\", snapshot.nodeCount], [\"edges\", edges.length]);\n if (nodeBypassRows.length > 0) {\n counts.push([\"nodeBypasses\", nodeBypassRows.length]);\n }\n if (edgeBypassRows.length > 0) {\n counts.push([\"edgeBypasses\", edgeBypassRows.length]);\n }\n for (const [name, elements] of opaqueAspects) {\n counts.push([name, elements.length]);\n }\n\n yield '[{\"CXVersion\":\"2.0\",\"hasFragments\":false},\\n';\n yield `{\"metaData\":${stringify(counts.map(([name, elementCount]) => ({ name, elementCount })))}},\\n`;\n if (hasDeclarations) {\n yield `{\"attributeDeclarations\":[${stringify(declarationsElement)}]},\\n`;\n }\n if (Object.keys(network).length > 0) {\n yield `{\"networkAttributes\":[${stringify(network)}]},\\n`;\n }\n yield* block(\"nodes\", snapshot.nodeCount, (i) => stringify(nodeElement(p, ids, i)));\n yield* block(\"edges\", edges.length, (k) => {\n const e = edges[k];\n const element: Record<string, unknown> = {\n id: p.edgeIds[e],\n s: ids.idAt(src[e]),\n t: ids.idAt(dst[e]),\n };\n let v = attributesOf(p.edgeAttrs, e);\n if (p.weights.isExplicit(e)) {\n const w = p.weights.value(e);\n v ??= {};\n v[WEIGHT_ATTRIBUTE] = Number.isFinite(w) ? w : null;\n }\n if (v !== null) {\n element.v = v;\n }\n return stringify(element);\n });\n if (nodeBypassRows.length > 0) {\n yield* block(\"nodeBypasses\", nodeBypassRows.length, (k) => {\n const i = nodeBypassRows[k];\n return stringify({ id: ids.idAt(i), v: bypassValues(p.nodeBypasses, i) });\n });\n }\n if (edgeBypassRows.length > 0) {\n yield* block(\"edgeBypasses\", edgeBypassRows.length, (k) => {\n const e = edgeBypassRows[k];\n return stringify({ id: p.edgeIds[e], v: bypassValues(p.edgeBypasses, e) });\n });\n }\n for (const [name, elements] of opaqueAspects) {\n yield* block(name, elements.length, (k) => stringify(elements[k]));\n }\n yield '{\"status\":[{\"error\":\"\",\"success\":true}]}]\\n';\n}\n\n/**\n * The text of one aspect block, element by element.\n * @param aspect - the aspect name\n * @param count - its element count\n * @param element - the JSON text of element k\n * @returns the block's text parts\n */\nfunction block(aspect: string, count: number, element: (k: number) => string): Generator<string, void, undefined> {\n return aspectBlock(\n aspect,\n (function* elements(): Generator<string, void, undefined> {\n for (let k = 0; k < count; k++) {\n yield element(k);\n }\n })(),\n );\n}\n\n/**\n * The element of node i.\n * @param p - the plan\n * @param ids - the written ids\n * @param i - the node index\n * @returns the element\n */\nfunction nodeElement(p: Plan, ids: WrittenIds, i: number): Record<string, unknown> {\n const element: Record<string, unknown> = { id: ids.idAt(i) };\n if (p.position?.isSet(i) === true) {\n const point = p.position.value(i) as ArrayLike<number>;\n if (Number.isFinite(point[0]) && Number.isFinite(point[1])) {\n element.x = point[0];\n element.y = point[1] === 0 ? 0 : -point[1];\n if (p.positionZ && Number.isFinite(point[2])) {\n element.z = point[2];\n }\n }\n }\n if (p.z?.isSet(i) === true) {\n const z = p.z.value(i);\n if (typeof z === \"number\" && Number.isFinite(z)) {\n element.z = z;\n }\n }\n let v = attributesOf(p.nodeAttrs, i);\n if (p.originalIds && ids.isChanged(i)) {\n v ??= {};\n v[ORIGINAL_ID_ATTRIBUTE] = String(ids.originalAt(i));\n }\n if (v !== null) {\n element.v = v;\n }\n return element;\n}\n\n/**\n * The rows with at least one bypass value.\n * @param columns - the bypass columns\n * @param rows - the row count\n * @returns the rows, ascending\n */\nfunction bypassRows(columns: readonly Column[], rows: number): number[] {\n const out: number[] = [];\n if (columns.length === 0) {\n return out;\n }\n for (let i = 0; i < rows; i++) {\n if (columns.some((c) => c.isSet(i))) {\n out.push(i);\n }\n }\n return out;\n}\n\n/**\n * The bypass values of one row.\n * @param columns - the bypass columns\n * @param row - the row\n * @returns property -> value\n */\nfunction bypassValues(columns: readonly Column[], row: number): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const column of columns) {\n if (column.isSet(row)) {\n // the visual property's own name: a column renamed for a clash with an attribute keeps it in origin.id\n const property = column.meta.origin?.id;\n out[typeof property === \"string\" && property.length > 0 ? property : column.meta.name] = column.value(row);\n }\n }\n return out;\n}\n\n/**\n * The CX2 exporter plugin.\n * @category Built-in formats\n */\nexport const cx2Exporter: GraphExporter<Cx2ExportOptions> = Object.freeze({\n format: CX2_FORMAT,\n options: Object.freeze([]),\n capabilities: CX2_CAPABILITIES,\n\n /**\n * Pre-flight: what export() would lose, without writing anything.\n * @param snapshot - the snapshot\n * @param options - the common options\n * @returns the notes, empty when the export is exact\n */\n check(snapshot: GraphSnapshot, options?: Cx2ExportOptions): readonly LossNote[] {\n return Object.freeze([...plan(snapshot, resolveExportOptions(options)).notes]);\n },\n\n /**\n * Write the document as UTF-8 chunks.\n * @param snapshot - the snapshot\n * @param options - the common options\n * @returns the chunks\n */\n export(snapshot: GraphSnapshot, options?: Cx2ExportOptions): AsyncIterable<Uint8Array> {\n return encodeChunks(write(snapshot, plan(snapshot, resolveExportOptions(options))));\n },\n\n /**\n * Write the document as one string.\n * @param snapshot - the snapshot\n * @param options - the common options\n * @returns the document\n */\n exportToString(snapshot: GraphSnapshot, options?: Cx2ExportOptions): Promise<string> {\n return joinText(write(snapshot, plan(snapshot, resolveExportOptions(options))));\n },\n});\n"],"names":[],"mappings":";;;;;AAgDO,MAAM,WAAW,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlC,wBAAwB;AAAA;AAAA,EAExB,gBAAgB;AAAA;AAAA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,EAQA,eAAe,UAAyB,SAA6C;AACjF,WAAO,SAAS,MAAM,UAAU,KAAK,UAAU,qBAAqB,OAAO,CAAC,CAAC,CAAC;AAAA,EAClF;AACJ,CAAC;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { GraphFormatError } from "@graphty/graph-format";
|
|
2
2
|
import { c as childrenCsr } from "./children-CL3Cy0ez.js";
|
|
3
|
-
import { r as resolveExportOptions, c as capabilities, a as checkCapabilities, L as LOSS, p as pairFolding, b as plural, $ as agree, e as explicitWeights, a9 as idText, aa as formatF32, ab as formatF64, ac as DictHeuristic } from "./export-
|
|
4
|
-
import { e as escapeXmlAttribute, x as xmlIllegalTextNotes, a as escapeXmlText } from "./escape-
|
|
3
|
+
import { r as resolveExportOptions, c as capabilities, a as checkCapabilities, L as LOSS, p as pairFolding, b as plural, $ as agree, e as explicitWeights, a9 as idText, aa as formatF32, ab as formatF64, ac as DictHeuristic } from "./export-CTUlibzr.js";
|
|
4
|
+
import { e as escapeXmlAttribute, x as xmlIllegalTextNotes, a as escapeXmlText } from "./escape-BRcyzD77.js";
|
|
5
5
|
import { j as joinText, e as encodeChunks } from "./writer-DxjgHwSe.js";
|
|
6
|
-
import { F as FORMAT, M as META_KEY, b as XLINK_NAMESPACE, C as CY_NAMESPACE, c as XGMML_NAMESPACE, a as XGMML_LOSS, Z as Z_COLUMN, L as LABEL_COLUMN, I as INTERACTION_COLUMN, d as aliasesOf, G as GRAPHICS_COLUMN, S as SUBGRAPH_COLUMN, N as NESTED_NETWORK_COLUMN, e as NETWORK_POINTER_COLUMN, f as NETWORKS_COLUMN, E as EDGE_ID_COLUMN, P as POSITION_COLUMN, g as PARENT_COLUMN, h as PARENTS_COLUMN, i as XGMML_ORIGIN_NAMESPACE, j as CYTOSCAPE_ORIGIN_NAMESPACE } from "./importer-
|
|
6
|
+
import { F as FORMAT, M as META_KEY, b as XLINK_NAMESPACE, C as CY_NAMESPACE, c as XGMML_NAMESPACE, a as XGMML_LOSS, Z as Z_COLUMN, L as LABEL_COLUMN, I as INTERACTION_COLUMN, d as aliasesOf, G as GRAPHICS_COLUMN, S as SUBGRAPH_COLUMN, N as NESTED_NETWORK_COLUMN, e as NETWORK_POINTER_COLUMN, f as NETWORKS_COLUMN, E as EDGE_ID_COLUMN, P as POSITION_COLUMN, g as PARENT_COLUMN, h as PARENTS_COLUMN, i as XGMML_ORIGIN_NAMESPACE, j as CYTOSCAPE_ORIGIN_NAMESPACE } from "./importer-yWUPR_nU.js";
|
|
7
7
|
const LITERAL_ESCAPES = String.raw`\n or \t`;
|
|
8
8
|
const CAPABILITIES = capabilities({
|
|
9
9
|
mixedDirection: true,
|
|
@@ -646,7 +646,7 @@ function slot(writes, kind) {
|
|
|
646
646
|
return writes.find((w) => w.kind === kind)?.column ?? null;
|
|
647
647
|
}
|
|
648
648
|
function cellOf(column, row) {
|
|
649
|
-
return column
|
|
649
|
+
return column?.isSet(row) ? column.value(row) : null;
|
|
650
650
|
}
|
|
651
651
|
function coordsOf(plan, zColumn, node) {
|
|
652
652
|
const out = [];
|
|
@@ -834,4 +834,4 @@ const xgmmlExporter = Object.freeze({
|
|
|
834
834
|
export {
|
|
835
835
|
xgmmlExporter as x
|
|
836
836
|
};
|
|
837
|
-
//# sourceMappingURL=exporter-
|
|
837
|
+
//# sourceMappingURL=exporter-Bn4jdYfd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exporter-Bn4jdYfd.js","sources":["../../src/formats/xgmml/exporter.ts"],"sourcesContent":["/**\n * The XGMML exporter (design `design/graph-io/cytoscape-and-obo/design.md` section 1.1;\n * `research-xgmml.md` section 4.7): the Cytoscape 3.x dialect, which Cytoscape 3 opens with every\n * attribute type intact. It writes `cy:documentVersion=\"3.0\"`, the root `directed` from the\n * snapshot and `cy:directed` on every edge (Cytoscape ignores the root attribute), `type` plus\n * `cy:type` (and `cy:elementType`) on every att, positions as `graphics x y z` with y negated\n * back to screen coordinates, the importer's `graphics` json columns back as graphics attributes\n * and nested atts, containment as each group node's nested graph of `xlink:href` member\n * references (every node is declared at the top level, so the node order survives), and newline\n * and tab as character references unless `cytoscapeEscapes` asks for Cytoscape's two-character\n * form. It writes the graph's structure and columns, never styles.\n */\n\nimport { type Column, GraphFormatError, type GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { type ChildrenCsr, childrenCsr } from \"../../children.js\";\nimport { DictHeuristic } from \"../../common/attributes.js\";\nimport { type PairFolding, pairFolding } from \"../../common/direction.js\";\nimport { escapeXmlAttribute, escapeXmlText } from \"../../common/escape.js\";\nimport { capabilities, checkCapabilities, LOSS } from \"../../common/export.js\";\nimport { formatF32, formatF64, idText } from \"../../common/format.js\";\nimport { type ResolvedExportOptions, resolveExportOptions } from \"../../common/options.js\";\nimport { agree, plural } from \"../../common/plural.js\";\nimport { type ExplicitWeights, explicitWeights } from \"../../common/weights.js\";\nimport { encodeChunks, joinText } from \"../../common/writer.js\";\nimport { xmlIllegalTextNotes } from \"../../common/xml.js\";\nimport { type CommonExportOptions, type ExportCapabilities, type GraphExporter, type LossNote } from \"../../types.js\";\nimport {\n CY_NAMESPACE,\n CYTOSCAPE_ORIGIN_NAMESPACE,\n EDGE_ID_COLUMN,\n FORMAT,\n GRAPHICS_COLUMN,\n INTERACTION_COLUMN,\n LABEL_COLUMN,\n META_KEY,\n NESTED_NETWORK_COLUMN,\n NETWORK_POINTER_COLUMN,\n NETWORKS_COLUMN,\n PARENT_COLUMN,\n PARENTS_COLUMN,\n POSITION_COLUMN,\n SUBGRAPH_COLUMN,\n XGMML_LOSS,\n XGMML_NAMESPACE,\n XGMML_ORIGIN_NAMESPACE,\n XLINK_NAMESPACE,\n Z_COLUMN,\n} from \"./constants.js\";\nimport { aliasesOf } from \"./emit.js\";\n\n/** The two escapes Cytoscape reads back as a newline and a tab, as a message writes them. */\nconst LITERAL_ESCAPES = String.raw`\\n or \\t`;\n\n/**\n * The format-specific options of the XGMML exporter.\n * @category Built-in formats\n */\nexport interface XgmmlExportOptions extends CommonExportOptions {\n /**\n * Write line breaks and tabs in text values as Cytoscape's two-character `\\n` and `\\t`, as\n * Cytoscape does, instead of the XML character references ` ` and `	`.\n * @defaultValue false\n */\n cytoscapeEscapes?: boolean | undefined;\n}\n\n/** What XGMML keeps (design section 1.1, all 16 fields). */\nconst CAPABILITIES: ExportCapabilities = capabilities({\n mixedDirection: true,\n multiEdges: true,\n selfLoops: true,\n edgeIds: \"optional\",\n idCharset: \"any\",\n dtypes: [\"string\", \"dict\", \"f64\", \"f32\", \"i32\", \"u32\", \"u8\", \"bool\", \"list\"],\n components: false,\n lists: true,\n json: false,\n defaults: false,\n options: false,\n hierarchy: true,\n temporal: \"none\",\n graphAttributes: true,\n positions: true,\n viz: false,\n});\n\n/** The roles with a slot: label (XML attribute), the edge id, containment and position. */\nconst SLOT_ROLES: ReadonlySet<string> = new Set([\"label\", \"id\", \"parent\", \"parents\", \"position\"]);\n\n/** The names the importer gives the slot columns. */\nconst ROLE_NAMES: Readonly<Record<string, string>> = Object.freeze({\n label: LABEL_COLUMN,\n id: EDGE_ID_COLUMN,\n parent: PARENT_COLUMN,\n position: POSITION_COLUMN,\n});\n\n/** Roles checkCapabilities() reports as not written (no slot in XGMML): the column is skipped. */\nconst DROPPED_ROLES: ReadonlySet<string> = new Set([\n \"color\",\n \"size\",\n \"shape\",\n \"thickness\",\n \"start\",\n \"end\",\n \"timestamp\",\n \"timestamps\",\n \"spells\",\n \"open\",\n \"spellsOpen\",\n]);\n\n/** XML attributes of `<node>` and `<edge>` the importer reads itself; a column of such a name is an att. */\nconst READ_ATTRIBUTES: Readonly<Record<\"node\" | \"edge\", ReadonlySet<string>>> = {\n node: new Set([\"id\", \"label\", \"name\"]),\n edge: new Set([\"id\", \"label\", \"name\", \"source\", \"target\", \"weight\"]),\n};\n\n/** Roles never written as atts. */\nconst STRUCTURAL_ROLES: ReadonlySet<string> = new Set([\n \"directed\",\n \"pair\",\n \"mutual\",\n \"weight\",\n \"parent\",\n \"parents\",\n \"position\",\n]);\n\n/** Node column names the importer owns; a plain column of such a name reads back renamed. */\nconst RESERVED_NODE_NAMES: ReadonlySet<string> = new Set([\n LABEL_COLUMN,\n POSITION_COLUMN,\n Z_COLUMN,\n GRAPHICS_COLUMN,\n PARENT_COLUMN,\n PARENTS_COLUMN,\n SUBGRAPH_COLUMN,\n NESTED_NETWORK_COLUMN,\n NETWORK_POINTER_COLUMN,\n NETWORKS_COLUMN,\n]);\n\n/** Edge column names the importer owns. */\nconst RESERVED_EDGE_NAMES: ReadonlySet<string> = new Set([EDGE_ID_COLUMN, LABEL_COLUMN, GRAPHICS_COLUMN]);\n\n/** The table an attribute name belongs to. */\ntype Domain = \"graph\" | \"node\" | \"edge\";\n\n/** The importer-owned names of each table. */\nconst RESERVED_NAMES: Readonly<Record<Domain, ReadonlySet<string>>> = {\n graph: new Set([GRAPHICS_COLUMN]),\n node: RESERVED_NODE_NAMES,\n edge: RESERVED_EDGE_NAMES,\n};\n\n/** The XGMML and Cytoscape `<graphics>` XML attributes; every other graphics key is a nested att. */\nconst GRAPHICS_ATTRIBUTES: ReadonlySet<string> = new Set([\n \"type\",\n \"w\",\n \"h\",\n \"d\",\n \"image\",\n \"bitmap\",\n \"width\",\n \"arrow\",\n \"capstyle\",\n \"joinstyle\",\n \"smooth\",\n \"splinesteps\",\n \"justify\",\n \"font\",\n \"background\",\n \"foreground\",\n \"extent\",\n \"start\",\n \"style\",\n \"stipple\",\n \"visible\",\n \"fill\",\n \"outline\",\n \"anchor\",\n]);\n\nconst I32_MAX = 2147483647;\n\n/** A note-recording callback. */\ntype NoteFn = (code: string, message: string, column?: string | null, count?: number | null) => void;\n\n/** How one column is written. */\ninterface ColumnWrite {\n readonly column: Column;\n readonly name: string;\n /** \"att\" for a typed att, or the importer-owned slot it goes to. */\n readonly kind: \"att\" | \"xml\" | \"label\" | \"graphics\" | \"z\" | \"subgraph\" | \"nested\" | \"pointer\" | \"networks\";\n /** The att's type and cy:type; null when the source att had none. */\n readonly type: string | null;\n readonly cyType: string | null;\n readonly elementType: string | null;\n}\n\n/** Everything check() and export() agree on. */\ninterface Plan {\n readonly options: ResolvedExportOptions;\n readonly escapes: boolean;\n readonly notes: LossNote[];\n readonly graph: ColumnWrite[];\n readonly nodes: ColumnWrite[];\n readonly edges: ColumnWrite[];\n readonly folding: PairFolding;\n readonly weights: ExplicitWeights;\n readonly hierarchy: ChildrenCsr;\n /** 1 for a node a traversal from the roots reaches; the others are written without parents. */\n readonly reachable: Uint8Array;\n readonly position: Column | null;\n readonly edgeId: Column | null;\n}\n\n/**\n * The Cytoscape type of a scalar dtype and the XGMML type.\n * @param column - the column\n * @param dtype - the dtype (a list's item dtype)\n * @returns [type, cy:type]\n */\nfunction typesOf(column: Column, dtype: string | null): [string, string] {\n if (column.meta.components > 1) {\n return [\"string\", \"String\"];\n }\n switch (dtype) {\n case \"bool\":\n return [\"boolean\", \"Boolean\"];\n case \"i32\":\n case \"u8\":\n return [\"integer\", \"Integer\"];\n case \"u32\":\n return maxValue(column) > I32_MAX ? [\"integer\", \"Long\"] : [\"integer\", \"Integer\"];\n case \"f32\":\n case \"f64\":\n return column.meta.origin?.type === \"long\" && allSafeIntegers(column)\n ? [\"integer\", \"Long\"]\n : [\"real\", \"Double\"];\n default:\n return [\"string\", \"String\"];\n }\n}\n\n/**\n * Whether every value of a numeric column (or of its list items) is a safe integer.\n * @param column - the column\n * @returns true when Long can carry every value\n */\nfunction allSafeIntegers(column: Column): boolean {\n for (let r = 0; r < column.length; r++) {\n if (!column.isSet(r)) {\n continue;\n }\n const items: unknown[] = column.dtype === \"list\" ? [...column.sliceOf(r)] : [column.value(r)];\n if (!items.every((item) => typeof item === \"number\" && Number.isSafeInteger(item))) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * The largest value of a u32 column (or of its list items).\n * @param column - the column\n * @returns the maximum, 0 when empty\n */\nfunction maxValue(column: Column): number {\n let max = 0;\n for (let r = 0; r < column.length; r++) {\n if (!column.isSet(r)) {\n continue;\n }\n const value = column.value(r);\n const items: unknown[] = column.dtype === \"list\" ? [...column.sliceOf(r)] : [value];\n for (const item of items) {\n if (typeof item === \"number\" && item > max) {\n max = item;\n }\n }\n }\n return max;\n}\n\n/**\n * Whether a column came from the XGMML importer's own slot of that name.\n * @param column - the column\n * @param namespace - the origin namespace the importer gives it\n * @returns true for an importer-owned column\n */\nfunction owned(column: Column, namespace: string): boolean {\n const { origin } = column.meta;\n return origin !== null && origin.namespace === namespace;\n}\n\n/**\n * Plan the columns of one table.\n * @param table - the columns\n * @param domain - the table\n * @param snapshot - the snapshot\n * @param note - the recorder\n * @returns the writes\n */\nfunction planTable(\n table: Iterable<Column>,\n domain: \"graph\" | \"node\" | \"edge\",\n snapshot: GraphSnapshot,\n note: NoteFn,\n): ColumnWrite[] {\n const writes: ColumnWrite[] = [];\n const reserved = RESERVED_NAMES[domain];\n const hasLabelRole =\n domain !== \"graph\" && (domain === \"node\" ? snapshot.nodes : snapshot.edges).byRole(\"label\") !== null;\n for (const column of table) {\n const { meta } = column;\n if (\n meta.role !== null &&\n (STRUCTURAL_ROLES.has(meta.role) ||\n DROPPED_ROLES.has(meta.role) ||\n meta.role === \"id\" ||\n meta.role === \"timeText\")\n ) {\n continue;\n }\n const kind = slotOf(column, domain, hasLabelRole);\n const set = column.length - column.nullCount;\n if (kind === \"att\" && reserved.has(meta.name)) {\n note(\n LOSS.COLUMN_NAME_CHANGED,\n `${domain} column \"${meta.name}\" is named like a column the XGMML importer owns and reads back renamed`,\n meta.name,\n set,\n );\n } else if (kind === \"label\" && meta.dtype !== \"string\" && meta.dtype !== \"dict\") {\n note(\n LOSS.DTYPE,\n `${domain} label column \"${meta.name}\" (${meta.dtype}) is written as text and reads back as string`,\n meta.name,\n set,\n );\n } else if (kind === \"label\" && meta.role === null) {\n note(\n LOSS.ROLE_ASSUMED,\n `${domain} column \"${meta.name}\" is written as the label and reads back with the label role`,\n meta.name,\n set,\n );\n }\n if (kind === \"att\") {\n attNotes(column, domain, note);\n }\n const item = meta.dtype === \"list\" ? meta.itemDtype : meta.dtype;\n const [type, cyType] = meta.dtype === \"list\" ? [\"list\", \"List\"] : declaredTypes(column, typesOf(column, item));\n writes.push({\n column,\n name: meta.name,\n kind,\n type,\n cyType,\n elementType: meta.dtype === \"list\" ? typesOf(column, item)[1] : null,\n });\n }\n return writes;\n}\n\n/**\n * Where a column goes.\n * @param column - the column\n * @param domain - the table\n * @param hasLabelRole - whether the table has a label role column\n * @returns the slot\n */\nfunction slotOf(column: Column, domain: \"graph\" | \"node\" | \"edge\", hasLabelRole: boolean): ColumnWrite[\"kind\"] {\n const { meta } = column;\n if (domain !== \"graph\" && untypedAttribute(column, domain)) {\n return \"xml\";\n }\n if (\n meta.role === \"label\" ||\n (!hasLabelRole &&\n domain !== \"graph\" &&\n meta.role === null &&\n meta.name === LABEL_COLUMN &&\n (meta.dtype === \"string\" || meta.dtype === \"dict\"))\n ) {\n return \"label\";\n }\n if (meta.dtype === \"json\" && meta.name === GRAPHICS_COLUMN && owned(column, XGMML_ORIGIN_NAMESPACE)) {\n return \"graphics\";\n }\n if (domain !== \"node\") {\n return \"att\";\n }\n if (meta.name === Z_COLUMN && meta.dtype === \"f64\" && meta.role === null) {\n return \"z\";\n }\n if (meta.name === SUBGRAPH_COLUMN && meta.dtype === \"json\" && owned(column, XGMML_ORIGIN_NAMESPACE)) {\n return \"subgraph\";\n }\n if (meta.name === NESTED_NETWORK_COLUMN && meta.dtype === \"string\" && owned(column, CYTOSCAPE_ORIGIN_NAMESPACE)) {\n return \"nested\";\n }\n if (meta.name === NETWORK_POINTER_COLUMN && meta.dtype === \"string\" && owned(column, XGMML_ORIGIN_NAMESPACE)) {\n return \"pointer\";\n }\n if (meta.name === NETWORKS_COLUMN && meta.dtype === \"list\" && owned(column, XGMML_ORIGIN_NAMESPACE)) {\n return \"networks\";\n }\n return \"att\";\n}\n\n/**\n * Whether a column came from an XML attribute of the element (the importer's 5.1 text grammar:\n * xgmml origin, no declared type) and can be written back as one, so it reads back the same.\n * @param column - the column\n * @param domain - node or edge\n * @returns true to write it as an XML attribute\n */\nfunction untypedAttribute(column: Column, domain: \"node\" | \"edge\"): boolean {\n const { meta } = column;\n const { origin } = meta;\n return (\n origin !== null &&\n origin.format === FORMAT &&\n origin.type === null &&\n origin.namespace === null &&\n meta.role === null &&\n meta.components === 1 &&\n (meta.dtype === \"string\" || meta.dtype === \"bool\" || meta.dtype === \"i32\" || meta.dtype === \"f64\") &&\n /^[A-Za-z_][A-Za-z0-9_.-]*$/.test(meta.name) &&\n !READ_ATTRIBUTES[domain].has(meta.name)\n );\n}\n\n/**\n * The type and cy:type of an att: the source's own declaration when the column came from an\n * XGMML att that declared only `type` (a draft or 2.x file), else both.\n * @param column - the column\n * @param types - the type and cy:type of its dtype\n * @returns the pair to write; a null member is not written\n */\nfunction declaredTypes(column: Column, types: [string, string]): [string | null, string | null] {\n const { origin } = column.meta;\n if (origin !== null && origin.format === FORMAT && origin.type === types[0] && column.meta.components === 1) {\n return [types[0], null];\n }\n return types;\n}\n\n/**\n * The notes of a column written as a typed att: dtypes Cytoscape widens, json written as text,\n * literal backslash escapes, the string / dict heuristic.\n * @param column - the column\n * @param domain - the table\n * @param note - the recorder\n */\nfunction attNotes(column: Column, domain: string, note: NoteFn): void {\n const { meta } = column;\n const set = column.length - column.nullCount;\n const label = `${domain} column \"${meta.name}\"`;\n const item = meta.dtype === \"list\" ? meta.itemDtype : meta.dtype;\n if (meta.dtype === \"json\") {\n note(\n XGMML_LOSS.JSON_AS_STRING,\n `${label} holds nested values; they are written as JSON text and read back as strings`,\n meta.name,\n set,\n );\n return;\n }\n if (item === \"f32\" || item === \"u8\" || item === \"u32\") {\n note(\n XGMML_LOSS.WIDENED_TYPE,\n `${label} (${item}) is written as a wider Cytoscape type and reads back as ${readBackDtype(column, item)}`,\n meta.name,\n set,\n );\n }\n if (item === \"string\" || item === \"dict\") {\n let escapes = 0;\n for (let r = 0; r < column.length; r++) {\n if (column.isSet(r)) {\n const values = column.dtype === \"list\" ? [...column.sliceOf(r)] : [column.value(r)];\n if (values.some((v) => typeof v === \"string\" && /\\\\[nt]/.test(v))) {\n escapes++;\n }\n }\n }\n if (escapes > 0) {\n note(\n XGMML_LOSS.BACKSLASH_ESCAPE,\n `${label}: ${escapes} value${plural(escapes)} ${agree(escapes, \"holds\", \"hold\")} a literal ${LITERAL_ESCAPES}, which Cytoscape's escape convention reads back as a newline or tab`,\n meta.name,\n escapes,\n );\n }\n }\n if (meta.dtype === \"string\" || meta.dtype === \"dict\") {\n const heuristic = new DictHeuristic();\n for (let r = 0; r < column.length && !heuristic.decided; r++) {\n if (column.isSet(r)) {\n heuristic.observe(column.value(r) as string);\n }\n }\n const readsAs = heuristic.decide();\n if (readsAs !== meta.dtype) {\n note(\n XGMML_LOSS.STORAGE_CLASS_CHANGED,\n `${label} reads back as ${readsAs}: the importer stores text with few distinct values as dict and other text as string; the values are the same`,\n meta.name,\n null,\n );\n }\n }\n}\n\n/**\n * The dtype a widened column reads back as.\n * @param column - the column\n * @param item - its dtype (a list's item dtype)\n * @returns the dtype the importer gives it\n */\nfunction readBackDtype(column: Column, item: string): string {\n if (item === \"u8\" || (item === \"u32\" && maxValue(column) <= I32_MAX)) {\n return \"i32\";\n }\n return \"f64\";\n}\n\n/**\n * Build the plan and its loss notes.\n * @param snapshot - the snapshot\n * @param options - the common options\n * @param escapes - the cytoscapeEscapes option\n * @returns the plan\n */\nfunction planExport(snapshot: GraphSnapshot, options: ResolvedExportOptions, escapes: boolean): Plan {\n const notes = checkCapabilities(snapshot, CAPABILITIES, options, {\n roles: SLOT_ROLES,\n roleNames: ROLE_NAMES,\n positionDtype: \"f64\",\n }).filter((n) => n.code !== LOSS.JSON);\n const note: NoteFn = (code, message, column = null, count = null): void => {\n notes.push(Object.freeze({ code, message, column, count }));\n };\n notes.push(...xmlIllegalTextNotes(snapshot));\n const folding = pairFolding(snapshot);\n if (folding.mutualCount > 0) {\n note(\n XGMML_LOSS.MUTUAL_EXPANDED,\n `${folding.mutualCount} mutual pair${plural(folding.mutualCount)} ${agree(folding.mutualCount, \"is\", \"are\")} written as two directed edges; the mutual mark is lost`,\n null,\n folding.mutualCount,\n );\n }\n const numericIds = countNumericIds(snapshot);\n if (numericIds > 0) {\n note(\n XGMML_LOSS.ID_TEXT_TYPE,\n `${numericIds} numeric node id${plural(numericIds)} ${agree(numericIds, \"is\", \"are\")} written as text and read back as strings`,\n null,\n numericIds,\n );\n }\n const edgeId = snapshot.edges.byRole(\"id\");\n if (edgeId !== null && edgeId.dtype !== \"string\" && edgeId.dtype !== \"dict\") {\n note(\n XGMML_LOSS.EDGE_ID_TEXT,\n `edge id column \"${edgeId.meta.name}\" (${edgeId.dtype}) is written as text and reads back as strings`,\n edgeId.meta.name,\n null,\n );\n }\n const hierarchy = childrenCsr(snapshot);\n if (hierarchy.unreachable > 0) {\n note(\n XGMML_LOSS.PARENT_CYCLE,\n `${hierarchy.unreachable} node${plural(hierarchy.unreachable)} whose parent chain never reaches a root ${agree(hierarchy.unreachable, \"is\", \"are\")} written at the top level and lose their parent`,\n null,\n hierarchy.unreachable,\n );\n }\n const parents = snapshot.nodes.byRole(\"parents\");\n if (parents !== null && snapshot.nodes.byRole(\"parent\") !== null) {\n note(\n XGMML_LOSS.PARENTS_DROPPED,\n `parents column \"${parents.meta.name}\" is not written: the \"parent\" column is the containment written`,\n parents.meta.name,\n parents.length - parents.nullCount,\n );\n } else if (parents !== null && !multiParent(parents)) {\n note(\n LOSS.COLUMN_NAME_CHANGED,\n `parents column \"${parents.meta.name}\" holds one parent per node and reads back as the \"parent\" column`,\n parents.meta.name,\n null,\n );\n }\n const position = snapshot.nodes.byRole(\"position\");\n if (position !== null) {\n positionNotes(position, snapshot, note);\n }\n interactionNote(snapshot, note);\n const weights = explicitWeights(snapshot);\n for (const column of snapshot.edges) {\n if (column.meta.name === \"weight\" && column.meta.role === null && !weights.weighted) {\n note(\n LOSS.WEIGHT_KEY_CLASH,\n `edge column \"weight\" reads back as the edge weight, not as a column`,\n \"weight\",\n null,\n );\n }\n }\n return {\n options,\n escapes,\n notes,\n graph: planTable(snapshot.graph, \"graph\", snapshot, note),\n nodes: planTable(snapshot.nodes, \"node\", snapshot, note),\n edges: planTable(snapshot.edges, \"edge\", snapshot, note),\n folding,\n weights,\n hierarchy,\n reachable: reachableNodes(snapshot.nodeCount, hierarchy),\n position,\n edgeId,\n };\n}\n\n/**\n * The note for edge labels the importer reads as Cytoscape label aliases (`a (i) b`): without an\n * `interaction` column they read back with one, as Cytoscape fills it.\n * @param snapshot - the snapshot\n * @param note - the recorder\n */\nfunction interactionNote(snapshot: GraphSnapshot, note: NoteFn): void {\n const label = snapshot.edges.byRole(\"label\") ?? snapshot.edges.get(LABEL_COLUMN);\n if (label === null || snapshot.edges.get(INTERACTION_COLUMN) !== null) {\n return;\n }\n let shaped = 0;\n for (let e = 0; e < label.length; e++) {\n if (label.isSet(e) && aliasesOf(scalarText(label.value(e))) !== null) {\n shaped++;\n }\n }\n if (shaped > 0) {\n note(\n XGMML_LOSS.INTERACTION_FROM_LABEL,\n `${shaped} edge label${plural(shaped)} ${agree(shaped, \"has\", \"have\")} Cytoscape's \"a (i) b\" shape and read back with an \"${INTERACTION_COLUMN}\" column`,\n INTERACTION_COLUMN,\n shaped,\n );\n }\n}\n\n/**\n * The nodes a traversal of the containment from its roots reaches.\n * @param nodeCount - the number of nodes\n * @param hierarchy - the children CSR\n * @returns 1 per reached node\n */\nfunction reachableNodes(nodeCount: number, hierarchy: ChildrenCsr): Uint8Array {\n const reached = new Uint8Array(nodeCount);\n const stack = Array.from(hierarchy.roots);\n for (const root of stack) {\n reached[root] = 1;\n }\n while (stack.length > 0) {\n for (const child of hierarchy.childrenOf(stack.pop() as number)) {\n if (reached[child] === 0) {\n reached[child] = 1;\n stack.push(child);\n }\n }\n }\n return reached;\n}\n\n/**\n * Whether a parents column gives some node more than one parent.\n * @param column - the parents column\n * @returns true when a row holds two or more parents\n */\nfunction multiParent(column: Column): boolean {\n for (let r = 0; r < column.length; r++) {\n if (column.isSet(r) && column.dtype === \"list\" && column.sliceOf(r).length > 1) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * The notes of a position column: its shape, non-finite coordinates, and a z that reads back in\n * the z column.\n * @param position - the position column\n * @param snapshot - the snapshot\n * @param note - the recorder\n */\nfunction positionNotes(position: Column, snapshot: GraphSnapshot, note: NoteFn): void {\n const { meta } = position;\n if (meta.components !== 3) {\n note(\n XGMML_LOSS.POSITION,\n `position column \"${meta.name}\" has ${meta.components} component${plural(meta.components)} and reads back with 3`,\n meta.name,\n null,\n );\n }\n let nonFinite = 0;\n let depth = 0;\n for (let r = 0; r < position.length; r++) {\n if (!position.isSet(r)) {\n continue;\n }\n const xyz = Array.from(position.value(r) as ArrayLike<number>);\n if (xyz.slice(0, 2).some((v) => !Number.isFinite(v))) {\n nonFinite++;\n } else if ((xyz[2] ?? 0) !== 0) {\n depth++;\n }\n }\n if (nonFinite > 0) {\n note(\n XGMML_LOSS.POSITION,\n `${nonFinite} position${plural(nonFinite)} with a non-finite coordinate ${agree(nonFinite, \"is\", \"are\")} not written`,\n meta.name,\n nonFinite,\n );\n }\n const zColumn = snapshot.nodes.get(Z_COLUMN);\n if (depth > 0) {\n note(\n XGMML_LOSS.POSITION,\n zColumn === null\n ? `${depth} position${plural(depth)} ${agree(depth, \"has\", \"have\")} a z; it is written as graphics z and reads back in the z column (zAs: \"position\" reads it as a coordinate)`\n : `${depth} position${plural(depth)} ${agree(depth, \"has\", \"have\")} a z, but graphics z holds the z column; the position z is lost`,\n meta.name,\n depth,\n );\n }\n}\n\n/**\n * Node ids that are numbers (written as text, read back as strings).\n * @param snapshot - the snapshot\n * @returns the count\n */\nfunction countNumericIds(snapshot: GraphSnapshot): number {\n let n = 0;\n for (let i = 0; i < snapshot.nodeCount; i++) {\n if (typeof snapshot.ids.idOf(i) === \"number\") {\n n++;\n }\n }\n return n;\n}\n\n/**\n * The text of a scalar for an att value.\n * @param value - the value\n * @param dtype - its dtype\n * @param escapes - Cytoscape's two-character newline and tab\n * @returns the attribute text, escaped\n */\nfunction valueText(value: unknown, dtype: string | null, escapes: boolean): string {\n let text: string;\n if (typeof value === \"boolean\") {\n text = value ? \"1\" : \"0\";\n } else if (typeof value === \"number\") {\n text = dtype === \"f32\" ? formatF32(value) : formatF64(value);\n } else if (typeof value === \"string\") {\n text = escapes ? value.replaceAll(\"\\n\", String.raw`\\n`).replaceAll(\"\\t\", String.raw`\\t`) : value;\n } else if (ArrayBuffer.isView(value)) {\n text = JSON.stringify(Array.from(value as unknown as ArrayLike<number>));\n } else {\n text = JSON.stringify(value) ?? \"\";\n }\n return escapeXmlAttribute(text);\n}\n\n/**\n * The text of a scalar cell (a label, an edge id, a graphics value): numbers in their shortest\n * form, anything that is not a scalar as JSON.\n * @param value - the value\n * @returns the text\n */\nfunction scalarText(value: unknown): string {\n if (typeof value === \"string\") {\n return value;\n }\n if (typeof value === \"number\") {\n return formatF64(value);\n }\n if (typeof value === \"boolean\") {\n return value ? \"true\" : \"false\";\n }\n return JSON.stringify(value) ?? \"\";\n}\n\n/**\n * The XML attributes of one row: the columns that came from XML attributes (`untypedAttribute`).\n * @param writes - the column writes of the table\n * @param row - the row\n * @returns the attributes, each with a leading space\n */\nfunction xmlAttributesOf(writes: readonly ColumnWrite[], row: number): string {\n let out = \"\";\n for (const w of writes) {\n if (w.kind === \"xml\" && w.column.isSet(row)) {\n out += ` ${w.name}=\"${escapeXmlAttribute(scalarText(w.column.value(row)))}\"`;\n }\n }\n return out;\n}\n\n/**\n * The atts of one row of a table.\n * @param writes - the column writes of the table\n * @param row - the row\n * @param first - whether this is the table's first row (an all-unset column is declared there)\n * @param plan - the plan\n * @param indent - the indentation\n * @yields the att elements\n * @returns nothing\n */\nfunction* attsOf(\n writes: readonly ColumnWrite[],\n row: number,\n first: boolean,\n plan: Plan,\n indent: string,\n): Generator<string, void, undefined> {\n for (const w of writes) {\n if (w.kind !== \"att\") {\n continue;\n }\n const { column } = w;\n const isSet = column.isSet(row);\n if (!isSet && !(first && column.nullCount === column.length)) {\n continue;\n }\n const name = `${indent}<att name=\"${escapeXmlAttribute(w.name)}\"`;\n const types = `${w.type === null ? \"\" : ` type=\"${w.type}\"`}${w.cyType === null ? \"\" : ` cy:type=\"${w.cyType}\"`}`;\n const extra = `${column.meta.extra.hidden === true ? ' cy:hidden=\"1\"' : \"\"}${column.meta.extra.equation === true ? ' cy:equation=\"1\"' : \"\"}`;\n if (!isSet) {\n yield `${name}${types}${w.elementType === null ? \"\" : ` cy:elementType=\"${w.elementType}\"`}${extra}/>\\n`;\n continue;\n }\n if (column.dtype === \"list\") {\n const items = [...column.sliceOf(row)];\n const [itemType, itemCy] = typesOf(column, column.meta.itemDtype);\n yield `${name}${types} cy:elementType=\"${w.elementType ?? \"String\"}\"${extra}${items.length === 0 ? \"/>\" : \">\"}\\n`;\n if (items.length > 0) {\n for (const item of items) {\n yield `${indent} <att name=\"${escapeXmlAttribute(w.name)}\" value=\"${valueText(item, column.meta.itemDtype, plan.escapes)}\" type=\"${itemType}\" cy:type=\"${itemCy}\"/>\\n`;\n }\n yield `${indent}</att>\\n`;\n }\n continue;\n }\n yield `${name} value=\"${valueText(column.value(row), column.dtype, plan.escapes)}\"${types}${extra}/>\\n`;\n }\n}\n\n/**\n * A graphics record as `<graphics>` XML attributes and nested atts.\n * @param record - the record (the importer's graphics json value)\n * @param coords - the x, y, z texts to write, or empty\n * @param indent - the indentation\n * @yields the graphics element\n * @returns nothing\n */\nfunction* graphicsOf(\n record: Record<string, unknown> | null,\n coords: readonly [string, string][],\n indent: string,\n): Generator<string, void, undefined> {\n const attrs: [string, string][] = [...coords];\n const nested: [string, unknown][] = [];\n for (const [key, value] of Object.entries(record ?? {})) {\n if (key === \"Line\") {\n nested.push([key, value]);\n } else if (typeof value === \"string\" && (GRAPHICS_ATTRIBUTES.has(key) || key.startsWith(\"cy:\"))) {\n attrs.push([key, value]);\n } else {\n nested.push([key, value]);\n }\n }\n if (attrs.length === 0 && nested.length === 0) {\n return;\n }\n const head = `${indent}<graphics${attrs.map(([k, v]) => ` ${k}=\"${escapeXmlAttribute(v)}\"`).join(\"\")}`;\n if (nested.length === 0) {\n yield `${head}/>\\n`;\n return;\n }\n yield `${head}>\\n`;\n for (const [key, value] of nested) {\n if (key === \"Line\" && Array.isArray(value)) {\n yield `${indent} <Line>\\n`;\n for (const point of value) {\n const entries =\n typeof point === \"object\" && point !== null ? Object.entries(point as Record<string, unknown>) : [];\n yield `${indent} <point${entries.map(([k, v]) => ` ${k}=\"${escapeXmlAttribute(String(v))}\"`).join(\"\")}/>\\n`;\n }\n yield `${indent} </Line>\\n`;\n } else {\n yield* jsonAtt(key, value, `${indent} `);\n }\n }\n yield `${indent}</graphics>\\n`;\n}\n\n/**\n * A graphics value as an att: a string as its value, an array as a list of child atts, a record\n * as named child atts (a record of strings with no further structure keeps its keys).\n * @param name - the att name\n * @param value - the value\n * @param indent - the indentation\n * @yields the att element\n * @returns nothing\n */\nfunction* jsonAtt(name: string | null, value: unknown, indent: string): Generator<string, void, undefined> {\n const nameAttr = name === null ? \"\" : ` name=\"${escapeXmlAttribute(name)}\"`;\n if (Array.isArray(value)) {\n yield `${indent}<att${nameAttr} type=\"list\">\\n`;\n for (const item of value) {\n yield* jsonAtt(name, item, `${indent} `);\n }\n yield `${indent}</att>\\n`;\n } else if (typeof value === \"object\" && value !== null) {\n const entries = Object.entries(value as Record<string, unknown>);\n if (\n name !== null &&\n entries.every(([, v]) => typeof v === \"string\") &&\n entries.length <= 3 &&\n entries.every(([k]) => /^[a-z]$/.test(k))\n ) {\n yield `${indent}<att${nameAttr}${entries.map(([k, v]) => ` ${k}=\"${escapeXmlAttribute(v as string)}\"`).join(\"\")}/>\\n`;\n return;\n }\n yield `${indent}<att${nameAttr}>\\n`;\n for (const [key, item] of entries) {\n yield* jsonAtt(key, item, `${indent} `);\n }\n yield `${indent}</att>\\n`;\n } else if (value === null || value === undefined) {\n yield `${indent}<att${nameAttr} type=\"string\"/>\\n`;\n } else {\n yield `${indent}<att${nameAttr} value=\"${escapeXmlAttribute(scalarText(value))}\" type=\"string\"/>\\n`;\n }\n}\n\n/**\n * The importer's slot column of a kind, if the table has it.\n * @param writes - the writes\n * @param kind - the slot\n * @returns the column, or null\n */\nfunction slot(writes: readonly ColumnWrite[], kind: ColumnWrite[\"kind\"]): Column | null {\n return writes.find((w) => w.kind === kind)?.column ?? null;\n}\n\n/**\n * The value of a set cell, else null.\n * @param column - the column, or null\n * @param row - the row\n * @returns the value\n */\nfunction cellOf(column: Column | null, row: number): unknown {\n return column?.isSet(row) ? column.value(row) : null;\n}\n\n/**\n * The graphics coordinates of a node: x, y negated back to screen coordinates, z.\n * @param plan - the plan\n * @param zColumn - the z column, or null\n * @param node - the node\n * @returns the coordinates as XML attributes\n */\nfunction coordsOf(plan: Plan, zColumn: Column | null, node: number): [string, string][] {\n const out: [string, string][] = [];\n const xyz = cellOf(plan.position, node);\n if (xyz !== null) {\n const [x, y, z] = Array.from(xyz as ArrayLike<number>);\n const fmt = plan.position?.dtype === \"f32\" ? formatF32 : formatF64;\n if (Number.isFinite(x) && Number.isFinite(y)) {\n out.push([\"x\", fmt(x)], [\"y\", fmt(y === 0 ? 0 : -y)]);\n if (zColumn === null && z !== undefined && z !== 0 && Number.isFinite(z)) {\n out.push([\"z\", fmt(z)]);\n }\n }\n }\n const z = cellOf(zColumn, node);\n if (typeof z === \"number\") {\n out.push([\"z\", formatF64(z)]);\n }\n return out;\n}\n\n/**\n * The XML of one node and its group graph, whose members are `xlink:href` references (every\n * node is declared at the top level, in index order).\n * @param snapshot - the snapshot\n * @param plan - the plan\n * @param node - the node\n * @param indent - the indentation\n * @yields the node element\n * @returns nothing\n */\nfunction* nodeOf(\n snapshot: GraphSnapshot,\n plan: Plan,\n node: number,\n indent: string,\n): Generator<string, void, undefined> {\n const labelCol = slot(plan.nodes, \"label\");\n const label = cellOf(labelCol, node);\n yield `${indent}<node id=\"${escapeXmlAttribute(idText(snapshot.ids.idOf(node)))}\"${label === null ? \"\" : ` label=\"${escapeXmlAttribute(scalarText(label))}\"`}${xmlAttributesOf(plan.nodes, node)}>\\n`;\n const inner = `${indent} `;\n yield* attsOf(plan.nodes, node, node === 0, plan, inner);\n const children = plan.reachable[node] === 1 ? plan.hierarchy.childrenOf(node) : [];\n const nested = cellOf(slot(plan.nodes, \"nested\"), node);\n const pointer = cellOf(slot(plan.nodes, \"pointer\"), node);\n const subgraph = cellOf(slot(plan.nodes, \"subgraph\"), node);\n if (children.length > 0 || subgraph !== null) {\n const sub = (subgraph ?? {}) as Record<string, unknown>;\n yield `${inner}<att name=\"__isGroup\" value=\"1\" type=\"boolean\" cy:type=\"Boolean\" cy:hidden=\"1\"/>\\n`;\n const id = typeof sub.id === \"string\" ? ` id=\"${escapeXmlAttribute(sub.id)}\"` : \"\";\n const lbl = typeof sub.label === \"string\" ? ` label=\"${escapeXmlAttribute(sub.label)}\"` : \"\";\n yield `${inner}<att>\\n${inner} <graph${id}${lbl}>\\n`;\n const atts =\n typeof sub.atts === \"object\" && sub.atts !== null\n ? Object.entries(sub.atts as Record<string, unknown>)\n : [];\n for (const [key, value] of atts) {\n yield* jsonAtt(key, value, `${inner} `);\n }\n for (const child of children) {\n yield `${inner} <node xlink:href=\"#${escapeXmlAttribute(idText(snapshot.ids.idOf(child)))}\"/>\\n`;\n }\n yield `${inner} </graph>\\n${inner}</att>\\n`;\n } else if (typeof nested === \"string\") {\n yield `${inner}<att>\\n${inner} <graph label=\"${escapeXmlAttribute(nested)}\"/>\\n${inner}</att>\\n`;\n } else if (typeof pointer === \"string\") {\n yield `${inner}<att>\\n${inner} <graph xlink:href=\"${escapeXmlAttribute(pointer)}\"/>\\n${inner}</att>\\n`;\n }\n const graphics = cellOf(slot(plan.nodes, \"graphics\"), node) as Record<string, unknown> | null;\n yield* graphicsOf(graphics, coordsOf(plan, slot(plan.nodes, \"z\"), node), inner);\n yield `${indent}</node>\\n`;\n}\n\n/**\n * The document, as string parts; the plan (and the E_ conditions it throws) is made when the\n * first part is asked for.\n * @param snapshot - the snapshot\n * @param options - the options\n * @yields the XML text\n * @returns nothing\n */\nfunction* write(\n snapshot: GraphSnapshot,\n options: (XgmmlExportOptions & CommonExportOptions) | undefined,\n): Generator<string, void, undefined> {\n const plan = planFor(snapshot, options);\n const meta = snapshot.meta.extra[META_KEY] as { graphId?: unknown; directed?: unknown } | undefined;\n const graphId = typeof meta?.graphId === \"string\" ? ` id=\"${escapeXmlAttribute(meta.graphId)}\"` : \"\";\n // Every edge carries cy:directed, so when they all agree the root attribute does not decide\n // the direction and the source's own text is written back.\n const keep =\n (meta?.directed === \"0\" || meta?.directed === \"1\") &&\n snapshot.edgeCount > 0 &&\n snapshot.edges.byRole(\"directed\") === null;\n let directed = snapshot.directed ? \"1\" : \"0\";\n if (keep) {\n directed = meta?.directed as string;\n }\n const name = snapshot.meta.name === null ? \"\" : ` label=\"${escapeXmlAttribute(snapshot.meta.name)}\"`;\n yield '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\\n';\n yield `<graph${graphId}${name} directed=\"${directed}\" cy:documentVersion=\"3.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:xlink=\"${XLINK_NAMESPACE}\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:cy=\"${CY_NAMESPACE}\" xmlns=\"${XGMML_NAMESPACE}\">\\n`;\n yield* metadataOf(snapshot);\n yield* attsOf(plan.graph, 0, true, plan, \" \");\n yield* graphicsOf(cellOf(slot(plan.graph, \"graphics\"), 0) as Record<string, unknown> | null, [], \" \");\n for (let u = 0; u < snapshot.nodeCount; u++) {\n yield* nodeOf(snapshot, plan, u, \" \");\n }\n yield* networksOf(snapshot, plan);\n yield* edgesOf(snapshot, plan);\n yield \"</graph>\\n\";\n}\n\n/**\n * The RDF network metadata, when the snapshot has a description or a creation date.\n * @param snapshot - the snapshot\n * @yields the networkMetadata att\n * @returns nothing\n */\nfunction* metadataOf(snapshot: GraphSnapshot): Generator<string, void, undefined> {\n const { name, description, created } = snapshot.meta;\n if (description === null && created === null) {\n return;\n }\n yield ' <att name=\"networkMetadata\">\\n <rdf:RDF>\\n <rdf:Description rdf:about=\"http://www.cytoscape.org/\">\\n';\n if (name !== null) {\n yield ` <dc:title>${escapeXmlText(name)}</dc:title>\\n`;\n }\n if (description !== null) {\n yield ` <dc:description>${escapeXmlText(description)}</dc:description>\\n`;\n }\n if (created !== null) {\n yield ` <dc:date>${escapeXmlText(created)}</dc:date>\\n`;\n }\n yield \" </rdf:Description>\\n </rdf:RDF>\\n </att>\\n\";\n}\n\n/**\n * The root-level subgraphs of an `xgmml.networks` membership column.\n * @param snapshot - the snapshot\n * @param plan - the plan\n * @yields the subgraph atts\n * @returns nothing\n */\nfunction* networksOf(snapshot: GraphSnapshot, plan: Plan): Generator<string, void, undefined> {\n const column = slot(plan.nodes, \"networks\");\n if (column?.dtype !== \"list\") {\n return;\n }\n const members = new Map<string, number[]>();\n for (let u = 0; u < snapshot.nodeCount; u++) {\n for (const id of column.isSet(u) ? column.sliceOf(u) : []) {\n const list = members.get(String(id)) ?? [];\n list.push(u);\n members.set(String(id), list);\n }\n }\n for (const [id, nodes] of members) {\n yield ` <att>\\n <graph id=\"${escapeXmlAttribute(id)}\">\\n`;\n for (const u of nodes) {\n yield ` <node xlink:href=\"#${escapeXmlAttribute(idText(snapshot.ids.idOf(u)))}\"/>\\n`;\n }\n yield \" </graph>\\n </att>\\n\";\n }\n}\n\n/**\n * The edges: one per logical edge, expanded pairs folded.\n * @param snapshot - the snapshot\n * @param plan - the plan\n * @yields the edge elements\n * @returns nothing\n */\nfunction* edgesOf(snapshot: GraphSnapshot, plan: Plan): Generator<string, void, undefined> {\n const { folding, weights } = plan;\n const labelCol = slot(plan.edges, \"label\");\n const graphicsCol = slot(plan.edges, \"graphics\");\n const list = snapshot.edgeList();\n let first = true;\n for (let e = 0; e < snapshot.edgeCount; e++) {\n if (folding.folded(e)) {\n continue;\n }\n const u = list.src[e];\n const v = list.dst[e];\n const directed = snapshot.directed && folding.sourceDirected(e);\n const id = cellOf(plan.edgeId, e);\n const label = cellOf(labelCol, e);\n const weight = weights.text(e);\n yield ` <edge${id === null ? \"\" : ` id=\"${escapeXmlAttribute(scalarText(id))}\"`}${label === null ? \"\" : ` label=\"${escapeXmlAttribute(scalarText(label))}\"`} source=\"${escapeXmlAttribute(idText(snapshot.ids.idOf(u)))}\" target=\"${escapeXmlAttribute(idText(snapshot.ids.idOf(v)))}\" cy:directed=\"${directed ? \"1\" : \"0\"}\"${weight === null ? \"\" : ` weight=\"${weight}\"`}${xmlAttributesOf(plan.edges, e)}>\\n`;\n yield* attsOf(plan.edges, e, first, plan, \" \");\n yield* graphicsOf(cellOf(graphicsCol, e) as Record<string, unknown> | null, [], \" \");\n yield \" </edge>\\n\";\n first = false;\n }\n}\n\n/**\n * Resolve the format-specific options.\n * @param options - the caller's options\n * @returns the cytoscapeEscapes flag\n */\nfunction resolveEscapes(options: XgmmlExportOptions | undefined): boolean {\n const value = options?.cytoscapeEscapes ?? false;\n if (typeof value !== \"boolean\") {\n throw new GraphFormatError(\"E_UNSUPPORTED\", \"option cytoscapeEscapes must be a boolean\", {\n option: \"cytoscapeEscapes\",\n found: typeof value,\n });\n }\n return value;\n}\n\n/**\n * The plan of one export call; throws the E_ conditions before anything is written.\n * @param snapshot - the snapshot\n * @param options - the options\n * @returns the plan\n */\nfunction planFor(snapshot: GraphSnapshot, options: (XgmmlExportOptions & CommonExportOptions) | undefined): Plan {\n const plan = planExport(snapshot, resolveExportOptions(options), resolveEscapes(options));\n const illegal = plan.notes.find((n) => n.code === XGMML_LOSS.XML_ILLEGAL_CHAR);\n if (illegal !== undefined) {\n throw new GraphFormatError(\"E_COLUMN_TYPE\", illegal.message, { code: illegal.code, column: illegal.column });\n }\n return plan;\n}\n\n/**\n * The XGMML exporter.\n * @category Built-in formats\n */\nexport const xgmmlExporter: GraphExporter<XgmmlExportOptions> = Object.freeze({\n format: FORMAT,\n options: Object.freeze([\"cytoscapeEscapes\"]),\n capabilities: CAPABILITIES,\n check: (snapshot: GraphSnapshot, options?: XgmmlExportOptions & CommonExportOptions): readonly LossNote[] =>\n Object.freeze(planExport(snapshot, resolveExportOptions(options), resolveEscapes(options)).notes),\n export: (snapshot: GraphSnapshot, options?: XgmmlExportOptions & CommonExportOptions): AsyncIterable<Uint8Array> =>\n encodeChunks(write(snapshot, options)),\n exportToString: (snapshot: GraphSnapshot, options?: XgmmlExportOptions & CommonExportOptions): Promise<string> =>\n joinText(write(snapshot, options)),\n});\n"],"names":["z"],"mappings":";;;;;;AAoDA,MAAM,kBAAkB,OAAO;AAgB/B,MAAM,eAAmC,aAAa;AAAA,EAClD,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ,CAAC,UAAU,QAAQ,OAAO,OAAO,OAAO,OAAO,MAAM,QAAQ,MAAM;AAAA,EAC3E,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,KAAK;AACT,CAAC;AAGD,MAAM,iCAAsC,IAAI,CAAC,SAAS,MAAM,UAAU,WAAW,UAAU,CAAC;AAGhG,MAAM,aAA+C,OAAO,OAAO;AAAA,EAC/D,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,UAAU;AACd,CAAC;AAGD,MAAM,oCAAyC,IAAI;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,CAAC;AAGD,MAAM,kBAA0E;AAAA,EAC5E,MAAM,oBAAI,IAAI,CAAC,MAAM,SAAS,MAAM,CAAC;AAAA,EACrC,MAAM,o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G,eAAe,OAAO,CAAC,EAAE,KAAK;AAAA,EACpG,QAAQ,CAAC,UAAyB,YAC9B,aAAa,MAAM,UAAU,OAAO,CAAC;AAAA,EACzC,gBAAgB,CAAC,UAAyB,YACtC,SAAS,MAAM,UAAU,OAAO,CAAC;AACzC,CAAC;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { GraphFormatError, INVALID_INDEX } from "@graphty/graph-format";
|
|
2
|
-
import { c as capabilities, R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, o as DUPLICATE_ATTRIBUTE_CODE, g as UNKNOWN_ELEMENT_CODE, b5 as EMPTY_COLUMN_DROPPED_CODE, ai as PARENT_CYCLE_CODE, P as PRECISION_CODE, w as UNKNOWN_ENCODING_CODE, a2 as JSON_NONSTANDARD_NUMBER_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, O as OPTION_IGNORED_CODE, S as SINK_OPTION_CODE, H as HYPEREDGE_CODE, ad as TOO_LARGE_CODE, i as DANGLING_REFERENCE_CODE, ae as AMBIGUOUS_GRAPH_NAME_CODE, af as GRAPH_NOT_FOUND_CODE, l as MULTIPLE_GRAPHS_CODE, I as ID_MERGED_CODE, m as DUPLICATE_EDGE_ID_CODE, n as DUPLICATE_NODE_CODE, q as UNKNOWN_PARENT_CODE, a3 as BAD_VALUE_CODE, s as MISSING_ENDPOINT_CODE, t as MISSING_ID_CODE, ak as SYNTAX_CODE, E as EMPTY_INPUT_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE, al as resolveImportOptions, a8 as ImportReportBuilder, bB as readText, b as plural, ao as reportSinkOptions, an as reportUnusedOptions, am as throwIfAborted, ar as IdCoercer, aq as DirectionResolver, $ as agree, as as weightFromValue, a0 as uniqueColumnName, a7 as chooseGraph, ap as graphChosen, a1 as declareResolved, aB as GRAPH_COLUMN_AS_METADATA_CODE, aC as TYPEDEF_NODES_CODE, aD as RELATION_ASSUMED_CODE, at as COLUMN_AS_PROPERTY_VALUE_CODE, p as pairFolding, e as explicitWeights, bd as NONFINITE_AS_NULL_CODE, L as LOSS, b3 as DIRECTION_DROPPED_CODE, aA as NODE_ORDER_CODE, r as resolveExportOptions, b_ as otherFormatDialect, a as checkCapabilities, bD as countMixedEdges, aa as formatF32, ab as formatF64 } from "./export-
|
|
3
|
-
import { M as MAYBE_UNSAFE_INTEGER, j as MAYBE_INEXACT_EXPONENT, l as rewriteNumbers, m as findDuplicateKeys, f as flipY } from "./json-elements-
|
|
2
|
+
import { c as capabilities, R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, o as DUPLICATE_ATTRIBUTE_CODE, g as UNKNOWN_ELEMENT_CODE, b5 as EMPTY_COLUMN_DROPPED_CODE, ai as PARENT_CYCLE_CODE, P as PRECISION_CODE, w as UNKNOWN_ENCODING_CODE, a2 as JSON_NONSTANDARD_NUMBER_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, O as OPTION_IGNORED_CODE, S as SINK_OPTION_CODE, H as HYPEREDGE_CODE, ad as TOO_LARGE_CODE, i as DANGLING_REFERENCE_CODE, ae as AMBIGUOUS_GRAPH_NAME_CODE, af as GRAPH_NOT_FOUND_CODE, l as MULTIPLE_GRAPHS_CODE, I as ID_MERGED_CODE, m as DUPLICATE_EDGE_ID_CODE, n as DUPLICATE_NODE_CODE, q as UNKNOWN_PARENT_CODE, a3 as BAD_VALUE_CODE, s as MISSING_ENDPOINT_CODE, t as MISSING_ID_CODE, ak as SYNTAX_CODE, E as EMPTY_INPUT_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE, al as resolveImportOptions, a8 as ImportReportBuilder, bB as readText, b as plural, ao as reportSinkOptions, an as reportUnusedOptions, am as throwIfAborted, ar as IdCoercer, aq as DirectionResolver, $ as agree, as as weightFromValue, a0 as uniqueColumnName, a7 as chooseGraph, ap as graphChosen, a1 as declareResolved, aB as GRAPH_COLUMN_AS_METADATA_CODE, aC as TYPEDEF_NODES_CODE, aD as RELATION_ASSUMED_CODE, at as COLUMN_AS_PROPERTY_VALUE_CODE, p as pairFolding, e as explicitWeights, bd as NONFINITE_AS_NULL_CODE, L as LOSS, b3 as DIRECTION_DROPPED_CODE, aA as NODE_ORDER_CODE, r as resolveExportOptions, b_ as otherFormatDialect, a as checkCapabilities, bD as countMixedEdges, aa as formatF32, ab as formatF64 } from "./export-CTUlibzr.js";
|
|
3
|
+
import { M as MAYBE_UNSAFE_INTEGER, j as MAYBE_INEXACT_EXPONENT, l as rewriteNumbers, m as findDuplicateKeys, f as flipY } from "./json-elements-AkglPS3m.js";
|
|
4
4
|
import { j as joinText, e as encodeChunks, i as indentUnit } from "./writer-DxjgHwSe.js";
|
|
5
|
-
import { t as trimTrailingZeros } from "./text-
|
|
6
|
-
import { d as OBOGRAPHS_PREDICATE_TAGS, g as compactOboIri, o as oboColumnDecl, P as PLACEHOLDER_COLUMN, h as synonymScopeOf, O as OBO_NODE_COLUMNS, c as capabilityNotes, s as slotColumn, e as emptyColumnNotes, j as OBO_PURL, f as framelessNodes, m as movedNodes, U as UNWRITTEN_ROLES, n as notePropertyColumn, a as cellOf, v as valuesOf, k as OBO_IN_OWL, b as fitsVocabulary, t as textOf, S as SYNONYM_SCOPES } from "./ontology-export-
|
|
5
|
+
import { t as trimTrailingZeros } from "./text-Btw3sBe_.js";
|
|
6
|
+
import { d as OBOGRAPHS_PREDICATE_TAGS, g as compactOboIri, o as oboColumnDecl, P as PLACEHOLDER_COLUMN, h as synonymScopeOf, O as OBO_NODE_COLUMNS, c as capabilityNotes, s as slotColumn, e as emptyColumnNotes, j as OBO_PURL, f as framelessNodes, m as movedNodes, U as UNWRITTEN_ROLES, n as notePropertyColumn, a as cellOf, v as valuesOf, k as OBO_IN_OWL, b as fitsVocabulary, t as textOf, S as SYNONYM_SCOPES } from "./ontology-export-DDoG3egY.js";
|
|
7
7
|
const JSON_DIALECTS = Object.freeze([
|
|
8
8
|
"node-link",
|
|
9
9
|
"d3",
|
|
@@ -27,7 +27,7 @@ function isJsonObject(value) {
|
|
|
27
27
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28
28
|
}
|
|
29
29
|
function hasKey(record, key) {
|
|
30
|
-
return Object.
|
|
30
|
+
return Object.hasOwn(record, key);
|
|
31
31
|
}
|
|
32
32
|
function isJsonDialect(value) {
|
|
33
33
|
return typeof value === "string" && JSON_DIALECTS.includes(value);
|
|
@@ -463,7 +463,7 @@ function scanKeys(text) {
|
|
|
463
463
|
if (ch === "{" || ch === "[") {
|
|
464
464
|
let label = "";
|
|
465
465
|
if (kinds.length > 0) {
|
|
466
|
-
label = kinds
|
|
466
|
+
label = kinds.at(-1) === "object" ? pendingKey ?? "" : String(counts.at(-1));
|
|
467
467
|
}
|
|
468
468
|
kinds.push(ch === "{" ? "object" : "array");
|
|
469
469
|
labels.push(label);
|
|
@@ -824,7 +824,7 @@ function withoutPath(value, segments) {
|
|
|
824
824
|
return entries.length === 0 ? void 0 : Object.fromEntries(entries);
|
|
825
825
|
}
|
|
826
826
|
function pathEdgesKey(json2, edgesPath) {
|
|
827
|
-
return json2.edgesKey ?? (edgesPath
|
|
827
|
+
return json2.edgesKey ?? (edgesPath.at(-1) === "links" ? "links" : "edges");
|
|
828
828
|
}
|
|
829
829
|
function pathDialect(record, forced, placedEdges) {
|
|
830
830
|
if (forced !== "auto") {
|
|
@@ -5485,7 +5485,7 @@ function idText(id) {
|
|
|
5485
5485
|
}
|
|
5486
5486
|
function edgeIdText(p, e, c) {
|
|
5487
5487
|
const column = p.edgeIds;
|
|
5488
|
-
if (
|
|
5488
|
+
if (!column?.isSet(e)) {
|
|
5489
5489
|
return null;
|
|
5490
5490
|
}
|
|
5491
5491
|
return cellText(column, e, c.ids, c.nonfinite);
|
|
@@ -5946,4 +5946,4 @@ export {
|
|
|
5946
5946
|
rankFormats as r,
|
|
5947
5947
|
sniffFormat as s
|
|
5948
5948
|
};
|
|
5949
|
-
//# sourceMappingURL=exporter-
|
|
5949
|
+
//# sourceMappingURL=exporter-D-qQuRcG.js.map
|