@graphty/graph-io 0.0.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +250 -28
- package/dist/chunks/children-CL3Cy0ez.js +238 -0
- package/dist/chunks/children-CL3Cy0ez.js.map +1 -0
- package/dist/chunks/escape-DyI8JofU.js +938 -0
- package/dist/chunks/escape-DyI8JofU.js.map +1 -0
- package/dist/chunks/importer-CQnJuWJw.js +2987 -0
- package/dist/chunks/importer-CQnJuWJw.js.map +1 -0
- package/dist/chunks/importer-CpCpfbxr.js +2015 -0
- package/dist/chunks/importer-CpCpfbxr.js.map +1 -0
- package/dist/chunks/importer-DbnGYr3_.js +2342 -0
- package/dist/chunks/importer-DbnGYr3_.js.map +1 -0
- package/dist/chunks/importer-GozH8DkN.js +3050 -0
- package/dist/chunks/importer-GozH8DkN.js.map +1 -0
- package/dist/chunks/records-CGpxszm1.js +605 -0
- package/dist/chunks/records-CGpxszm1.js.map +1 -0
- package/dist/chunks/text-CajMdVFy.js +189 -0
- package/dist/chunks/text-CajMdVFy.js.map +1 -0
- package/dist/chunks/writer-DxSKC7TL.js +2842 -0
- package/dist/chunks/writer-DxSKC7TL.js.map +1 -0
- package/dist/csv.d.ts +1 -0
- package/dist/csv.js +1702 -0
- package/dist/csv.js.map +1 -0
- package/dist/dot.d.ts +1 -0
- package/dist/dot.js +8 -0
- package/dist/dot.js.map +1 -0
- package/dist/gexf.d.ts +1 -0
- package/dist/gexf.js +3466 -0
- package/dist/gexf.js.map +1 -0
- package/dist/gml.d.ts +1 -0
- package/dist/gml.js +2647 -0
- package/dist/gml.js.map +1 -0
- package/dist/graph-io.d.ts +1 -0
- package/dist/graph-io.js +790 -0
- package/dist/graph-io.js.map +1 -0
- package/dist/graphml.d.ts +1 -0
- package/dist/graphml.js +8 -0
- package/dist/graphml.js.map +1 -0
- package/dist/json.d.ts +1 -0
- package/dist/json.js +11 -0
- package/dist/json.js.map +1 -0
- package/dist/neo4j.d.ts +1 -0
- package/dist/neo4j.js +2046 -0
- package/dist/neo4j.js.map +1 -0
- package/dist/pajek.d.ts +1 -0
- package/dist/pajek.js +8 -0
- package/dist/pajek.js.map +1 -0
- package/dist/src/children.d.ts +134 -0
- package/dist/src/children.d.ts.map +1 -0
- package/dist/src/children.js +274 -0
- package/dist/src/children.js.map +1 -0
- package/dist/src/common/attributes.d.ts +229 -0
- package/dist/src/common/attributes.d.ts.map +1 -0
- package/dist/src/common/attributes.js +368 -0
- package/dist/src/common/attributes.js.map +1 -0
- package/dist/src/common/codes.d.ts +105 -0
- package/dist/src/common/codes.d.ts.map +1 -0
- package/dist/src/common/codes.js +107 -0
- package/dist/src/common/codes.js.map +1 -0
- package/dist/src/common/declared-types.d.ts +84 -0
- package/dist/src/common/declared-types.d.ts.map +1 -0
- package/dist/src/common/declared-types.js +326 -0
- package/dist/src/common/declared-types.js.map +1 -0
- package/dist/src/common/direction.d.ts +206 -0
- package/dist/src/common/direction.d.ts.map +1 -0
- package/dist/src/common/direction.js +370 -0
- package/dist/src/common/direction.js.map +1 -0
- package/dist/src/common/escape.d.ts +92 -0
- package/dist/src/common/escape.d.ts.map +1 -0
- package/dist/src/common/escape.js +212 -0
- package/dist/src/common/escape.js.map +1 -0
- package/dist/src/common/export.d.ts +249 -0
- package/dist/src/common/export.d.ts.map +1 -0
- package/dist/src/common/export.js +594 -0
- package/dist/src/common/export.js.map +1 -0
- package/dist/src/common/format.d.ts +59 -0
- package/dist/src/common/format.d.ts.map +1 -0
- package/dist/src/common/format.js +106 -0
- package/dist/src/common/format.js.map +1 -0
- package/dist/src/common/ids.d.ts +83 -0
- package/dist/src/common/ids.d.ts.map +1 -0
- package/dist/src/common/ids.js +158 -0
- package/dist/src/common/ids.js.map +1 -0
- package/dist/src/common/input.d.ts +100 -0
- package/dist/src/common/input.d.ts.map +1 -0
- package/dist/src/common/input.js +335 -0
- package/dist/src/common/input.js.map +1 -0
- package/dist/src/common/lists.d.ts +34 -0
- package/dist/src/common/lists.d.ts.map +1 -0
- package/dist/src/common/lists.js +185 -0
- package/dist/src/common/lists.js.map +1 -0
- package/dist/src/common/options.d.ts +108 -0
- package/dist/src/common/options.d.ts.map +1 -0
- package/dist/src/common/options.js +265 -0
- package/dist/src/common/options.js.map +1 -0
- package/dist/src/common/report.d.ts +187 -0
- package/dist/src/common/report.d.ts.map +1 -0
- package/dist/src/common/report.js +274 -0
- package/dist/src/common/report.js.map +1 -0
- package/dist/src/common/temporal.d.ts +71 -0
- package/dist/src/common/temporal.d.ts.map +1 -0
- package/dist/src/common/temporal.js +266 -0
- package/dist/src/common/temporal.js.map +1 -0
- package/dist/src/common/text.d.ts +104 -0
- package/dist/src/common/text.d.ts.map +1 -0
- package/dist/src/common/text.js +255 -0
- package/dist/src/common/text.js.map +1 -0
- package/dist/src/common/weights.d.ts +77 -0
- package/dist/src/common/weights.d.ts.map +1 -0
- package/dist/src/common/weights.js +156 -0
- package/dist/src/common/weights.js.map +1 -0
- package/dist/src/common/writer.d.ts +51 -0
- package/dist/src/common/writer.d.ts.map +1 -0
- package/dist/src/common/writer.js +108 -0
- package/dist/src/common/writer.js.map +1 -0
- package/dist/src/common/xml.d.ts +245 -0
- package/dist/src/common/xml.d.ts.map +1 -0
- package/dist/src/common/xml.js +942 -0
- package/dist/src/common/xml.js.map +1 -0
- package/dist/src/formats/csv/exporter.d.ts +70 -0
- package/dist/src/formats/csv/exporter.d.ts.map +1 -0
- package/dist/src/formats/csv/exporter.js +682 -0
- package/dist/src/formats/csv/exporter.js.map +1 -0
- package/dist/src/formats/csv/header.d.ts +66 -0
- package/dist/src/formats/csv/header.d.ts.map +1 -0
- package/dist/src/formats/csv/header.js +152 -0
- package/dist/src/formats/csv/header.js.map +1 -0
- package/dist/src/formats/csv/importer.d.ts +82 -0
- package/dist/src/formats/csv/importer.d.ts.map +1 -0
- package/dist/src/formats/csv/importer.js +849 -0
- package/dist/src/formats/csv/importer.js.map +1 -0
- package/dist/src/formats/csv/index.d.ts +60 -0
- package/dist/src/formats/csv/index.d.ts.map +1 -0
- package/dist/src/formats/csv/index.js +63 -0
- package/dist/src/formats/csv/index.js.map +1 -0
- package/dist/src/formats/csv/records.d.ts +188 -0
- package/dist/src/formats/csv/records.d.ts.map +1 -0
- package/dist/src/formats/csv/records.js +702 -0
- package/dist/src/formats/csv/records.js.map +1 -0
- package/dist/src/formats/csv/values.d.ts +105 -0
- package/dist/src/formats/csv/values.d.ts.map +1 -0
- package/dist/src/formats/csv/values.js +192 -0
- package/dist/src/formats/csv/values.js.map +1 -0
- package/dist/src/formats/dot/exporter.d.ts +52 -0
- package/dist/src/formats/dot/exporter.d.ts.map +1 -0
- package/dist/src/formats/dot/exporter.js +836 -0
- package/dist/src/formats/dot/exporter.js.map +1 -0
- package/dist/src/formats/dot/importer.d.ts +102 -0
- package/dist/src/formats/dot/importer.d.ts.map +1 -0
- package/dist/src/formats/dot/importer.js +1291 -0
- package/dist/src/formats/dot/importer.js.map +1 -0
- package/dist/src/formats/dot/index.d.ts +7 -0
- package/dist/src/formats/dot/index.d.ts.map +1 -0
- package/dist/src/formats/dot/index.js +7 -0
- package/dist/src/formats/dot/index.js.map +1 -0
- package/dist/src/formats/dot/names.d.ts +29 -0
- package/dist/src/formats/dot/names.d.ts.map +1 -0
- package/dist/src/formats/dot/names.js +28 -0
- package/dist/src/formats/dot/names.js.map +1 -0
- package/dist/src/formats/dot/tokenizer.d.ts +114 -0
- package/dist/src/formats/dot/tokenizer.d.ts.map +1 -0
- package/dist/src/formats/dot/tokenizer.js +341 -0
- package/dist/src/formats/dot/tokenizer.js.map +1 -0
- package/dist/src/formats/gexf/exporter.d.ts +56 -0
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -0
- package/dist/src/formats/gexf/exporter.js +1395 -0
- package/dist/src/formats/gexf/exporter.js.map +1 -0
- package/dist/src/formats/gexf/importer.d.ts +73 -0
- package/dist/src/formats/gexf/importer.d.ts.map +1 -0
- package/dist/src/formats/gexf/importer.js +1880 -0
- package/dist/src/formats/gexf/importer.js.map +1 -0
- package/dist/src/formats/gexf/index.d.ts +96 -0
- package/dist/src/formats/gexf/index.d.ts.map +1 -0
- package/dist/src/formats/gexf/index.js +97 -0
- package/dist/src/formats/gexf/index.js.map +1 -0
- package/dist/src/formats/gexf/schema.d.ts +135 -0
- package/dist/src/formats/gexf/schema.d.ts.map +1 -0
- package/dist/src/formats/gexf/schema.js +323 -0
- package/dist/src/formats/gexf/schema.js.map +1 -0
- package/dist/src/formats/gml/exporter.d.ts +69 -0
- package/dist/src/formats/gml/exporter.d.ts.map +1 -0
- package/dist/src/formats/gml/exporter.js +1093 -0
- package/dist/src/formats/gml/exporter.js.map +1 -0
- package/dist/src/formats/gml/importer.d.ts +66 -0
- package/dist/src/formats/gml/importer.d.ts.map +1 -0
- package/dist/src/formats/gml/importer.js +1331 -0
- package/dist/src/formats/gml/importer.js.map +1 -0
- package/dist/src/formats/gml/index.d.ts +85 -0
- package/dist/src/formats/gml/index.d.ts.map +1 -0
- package/dist/src/formats/gml/index.js +88 -0
- package/dist/src/formats/gml/index.js.map +1 -0
- package/dist/src/formats/gml/syntax.d.ts +186 -0
- package/dist/src/formats/gml/syntax.d.ts.map +1 -0
- package/dist/src/formats/gml/syntax.js +467 -0
- package/dist/src/formats/gml/syntax.js.map +1 -0
- package/dist/src/formats/graphml/constants.d.ts +169 -0
- package/dist/src/formats/graphml/constants.d.ts.map +1 -0
- package/dist/src/formats/graphml/constants.js +165 -0
- package/dist/src/formats/graphml/constants.js.map +1 -0
- package/dist/src/formats/graphml/exporter.d.ts +34 -0
- package/dist/src/formats/graphml/exporter.d.ts.map +1 -0
- package/dist/src/formats/graphml/exporter.js +1176 -0
- package/dist/src/formats/graphml/exporter.js.map +1 -0
- package/dist/src/formats/graphml/importer.d.ts +31 -0
- package/dist/src/formats/graphml/importer.d.ts.map +1 -0
- package/dist/src/formats/graphml/importer.js +1607 -0
- package/dist/src/formats/graphml/importer.js.map +1 -0
- package/dist/src/formats/graphml/index.d.ts +8 -0
- package/dist/src/formats/graphml/index.d.ts.map +1 -0
- package/dist/src/formats/graphml/index.js +8 -0
- package/dist/src/formats/graphml/index.js.map +1 -0
- package/dist/src/formats/graphml/tree.d.ts +72 -0
- package/dist/src/formats/graphml/tree.d.ts.map +1 -0
- package/dist/src/formats/graphml/tree.js +290 -0
- package/dist/src/formats/graphml/tree.js.map +1 -0
- package/dist/src/formats/json/dialect.d.ts +125 -0
- package/dist/src/formats/json/dialect.d.ts.map +1 -0
- package/dist/src/formats/json/dialect.js +262 -0
- package/dist/src/formats/json/dialect.js.map +1 -0
- package/dist/src/formats/json/exporter.d.ts +89 -0
- package/dist/src/formats/json/exporter.d.ts.map +1 -0
- package/dist/src/formats/json/exporter.js +1358 -0
- package/dist/src/formats/json/exporter.js.map +1 -0
- package/dist/src/formats/json/importer.d.ts +108 -0
- package/dist/src/formats/json/importer.d.ts.map +1 -0
- package/dist/src/formats/json/importer.js +1838 -0
- package/dist/src/formats/json/importer.js.map +1 -0
- package/dist/src/formats/json/index.d.ts +8 -0
- package/dist/src/formats/json/index.d.ts.map +1 -0
- package/dist/src/formats/json/index.js +8 -0
- package/dist/src/formats/json/index.js.map +1 -0
- package/dist/src/formats/neo4j/exporter.d.ts +68 -0
- package/dist/src/formats/neo4j/exporter.d.ts.map +1 -0
- package/dist/src/formats/neo4j/exporter.js +1055 -0
- package/dist/src/formats/neo4j/exporter.js.map +1 -0
- package/dist/src/formats/neo4j/header.d.ts +52 -0
- package/dist/src/formats/neo4j/header.d.ts.map +1 -0
- package/dist/src/formats/neo4j/header.js +131 -0
- package/dist/src/formats/neo4j/header.js.map +1 -0
- package/dist/src/formats/neo4j/importer.d.ts +73 -0
- package/dist/src/formats/neo4j/importer.d.ts.map +1 -0
- package/dist/src/formats/neo4j/importer.js +932 -0
- package/dist/src/formats/neo4j/importer.js.map +1 -0
- package/dist/src/formats/neo4j/index.d.ts +79 -0
- package/dist/src/formats/neo4j/index.d.ts.map +1 -0
- package/dist/src/formats/neo4j/index.js +83 -0
- package/dist/src/formats/neo4j/index.js.map +1 -0
- package/dist/src/formats/pajek/exporter.d.ts +58 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -0
- package/dist/src/formats/pajek/exporter.js +825 -0
- package/dist/src/formats/pajek/exporter.js.map +1 -0
- package/dist/src/formats/pajek/importer.d.ts +88 -0
- package/dist/src/formats/pajek/importer.d.ts.map +1 -0
- package/dist/src/formats/pajek/importer.js +1047 -0
- package/dist/src/formats/pajek/importer.js.map +1 -0
- package/dist/src/formats/pajek/index.d.ts +7 -0
- package/dist/src/formats/pajek/index.d.ts.map +1 -0
- package/dist/src/formats/pajek/index.js +7 -0
- package/dist/src/formats/pajek/index.js.map +1 -0
- package/dist/src/formats/pajek/syntax.d.ts +112 -0
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -0
- package/dist/src/formats/pajek/syntax.js +269 -0
- package/dist/src/formats/pajek/syntax.js.map +1 -0
- package/dist/src/index.d.ts +35 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +39 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/registry.d.ts +207 -0
- package/dist/src/registry.d.ts.map +1 -0
- package/dist/src/registry.js +481 -0
- package/dist/src/registry.js.map +1 -0
- package/dist/src/sniff.d.ts +104 -0
- package/dist/src/sniff.d.ts.map +1 -0
- package/dist/src/sniff.js +357 -0
- package/dist/src/sniff.js.map +1 -0
- package/dist/src/types.d.ts +238 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +29 -0
- package/dist/src/types.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +122 -7
- package/src/children.ts +335 -0
- package/src/common/attributes.ts +520 -0
- package/src/common/codes.ts +153 -0
- package/src/common/declared-types.ts +374 -0
- package/src/common/direction.ts +518 -0
- package/src/common/escape.ts +231 -0
- package/src/common/export.ts +817 -0
- package/src/common/format.ts +111 -0
- package/src/common/ids.ts +176 -0
- package/src/common/input.ts +378 -0
- package/src/common/lists.ts +196 -0
- package/src/common/options.ts +377 -0
- package/src/common/report.ts +352 -0
- package/src/common/temporal.ts +302 -0
- package/src/common/text.ts +294 -0
- package/src/common/weights.ts +202 -0
- package/src/common/writer.ts +123 -0
- package/src/common/xml.ts +1053 -0
- package/src/formats/csv/exporter.ts +894 -0
- package/src/formats/csv/header.ts +172 -0
- package/src/formats/csv/importer.ts +1104 -0
- package/src/formats/csv/index.ts +88 -0
- package/src/formats/csv/records.ts +813 -0
- package/src/formats/csv/values.ts +224 -0
- package/src/formats/dot/exporter.ts +1014 -0
- package/src/formats/dot/importer.ts +1549 -0
- package/src/formats/dot/index.ts +7 -0
- package/src/formats/dot/names.ts +40 -0
- package/src/formats/dot/tokenizer.ts +384 -0
- package/src/formats/gexf/exporter.ts +1696 -0
- package/src/formats/gexf/importer.ts +2333 -0
- package/src/formats/gexf/index.ts +142 -0
- package/src/formats/gexf/schema.ts +361 -0
- package/src/formats/gml/exporter.ts +1404 -0
- package/src/formats/gml/importer.ts +1591 -0
- package/src/formats/gml/index.ts +128 -0
- package/src/formats/gml/syntax.ts +545 -0
- package/src/formats/graphml/constants.ts +225 -0
- package/src/formats/graphml/exporter.ts +1458 -0
- package/src/formats/graphml/importer.ts +2027 -0
- package/src/formats/graphml/index.ts +8 -0
- package/src/formats/graphml/tree.ts +318 -0
- package/src/formats/json/dialect.ts +317 -0
- package/src/formats/json/exporter.ts +1616 -0
- package/src/formats/json/importer.ts +2271 -0
- package/src/formats/json/index.ts +8 -0
- package/src/formats/neo4j/exporter.ts +1287 -0
- package/src/formats/neo4j/header.ts +156 -0
- package/src/formats/neo4j/importer.ts +1220 -0
- package/src/formats/neo4j/index.ts +116 -0
- package/src/formats/pajek/exporter.ts +1000 -0
- package/src/formats/pajek/importer.ts +1311 -0
- package/src/formats/pajek/index.ts +7 -0
- package/src/formats/pajek/syntax.ts +307 -0
- package/src/index.ts +244 -0
- package/src/registry.ts +617 -0
- package/src/sniff.ts +397 -0
- package/src/types.ts +262 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the GraphML importer and exporter share: the namespace, the format facts, the reserved
|
|
3
|
+
* column names of the XML-attribute-derived columns (design section 5.6), the `meta.extra`
|
|
4
|
+
* keys the importer records for the exporter, and the issue and loss codes.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
BAD_DEFAULT_CODE,
|
|
9
|
+
COLUMN_RENAMED_CODE,
|
|
10
|
+
COUNT_HINT_CODE,
|
|
11
|
+
DIRECTION_FORCED_CODE,
|
|
12
|
+
DIRECTION_REFUSED_CODE,
|
|
13
|
+
DUPLICATE_EDGE_ID_CODE,
|
|
14
|
+
DUPLICATE_KEY_CODE,
|
|
15
|
+
DUPLICATE_NODE_CODE,
|
|
16
|
+
HYPEREDGE_CODE,
|
|
17
|
+
ID_MERGED_CODE,
|
|
18
|
+
ID_TEXT_TYPE_CODE,
|
|
19
|
+
INVALID_UTF8_CODE,
|
|
20
|
+
MISSING_ENDPOINT_CODE,
|
|
21
|
+
MISSING_ID_CODE,
|
|
22
|
+
MIXED_DIRECTION_CODE,
|
|
23
|
+
MULTIPLE_GRAPHS_CODE,
|
|
24
|
+
MUTUAL_AS_UNDIRECTED_CODE,
|
|
25
|
+
NO_GRAPH_CODE,
|
|
26
|
+
OPTION_IGNORED_CODE,
|
|
27
|
+
PARENTS_DROPPED_CODE,
|
|
28
|
+
PRECISION_CODE,
|
|
29
|
+
ROLE_DROPPED_CODE,
|
|
30
|
+
ROLE_TAKEN_CODE,
|
|
31
|
+
SINK_OPTION_CODE,
|
|
32
|
+
STRAY_TEXT_CODE,
|
|
33
|
+
UNKNOWN_ATTR_TYPE_CODE,
|
|
34
|
+
UNKNOWN_ELEMENT_CODE,
|
|
35
|
+
XML_SYNTAX_CODE,
|
|
36
|
+
} from "../../common/codes.js";
|
|
37
|
+
|
|
38
|
+
/** The GraphML namespace. */
|
|
39
|
+
export const GRAPHML_NAMESPACE = "http://graphml.graphdrawing.org/xmlns";
|
|
40
|
+
|
|
41
|
+
/** The yFiles extension namespace, declared as `xmlns:y` when a yfiles column is written. */
|
|
42
|
+
export const YFILES_NAMESPACE = "http://www.yworks.com/xml/graphml";
|
|
43
|
+
|
|
44
|
+
/** The XML Schema instance namespace and the schema location the exporter writes. */
|
|
45
|
+
export const XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance";
|
|
46
|
+
|
|
47
|
+
/** The GraphML schema location written by the exporter. */
|
|
48
|
+
export const SCHEMA_LOCATION =
|
|
49
|
+
"http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd";
|
|
50
|
+
|
|
51
|
+
/** The format name. */
|
|
52
|
+
export const FORMAT = "graphml";
|
|
53
|
+
|
|
54
|
+
/** File extensions. */
|
|
55
|
+
export const EXTENSIONS: readonly string[] = Object.freeze([".graphml", ".xml"]);
|
|
56
|
+
|
|
57
|
+
/** MIME types. */
|
|
58
|
+
export const MIME_TYPES: readonly string[] = Object.freeze(["application/graphml+xml", "application/xml", "text/xml"]);
|
|
59
|
+
|
|
60
|
+
/** The `attr.name` of the node key that carries ids rewritten by `sanitizeIds: "mangle"` (design section 8.5). */
|
|
61
|
+
export const ORIGINAL_ID_ATTRIBUTE = "graphty:originalId";
|
|
62
|
+
|
|
63
|
+
/** The node column that keeps original ids when `restoreMangledIds` is off (design section 5.6). */
|
|
64
|
+
export const ORIGINAL_ID_COLUMN = "graphty.originalId";
|
|
65
|
+
|
|
66
|
+
/** The edge column of the `id` XML attribute (role id, unique). */
|
|
67
|
+
export const EDGE_ID_COLUMN = "id";
|
|
68
|
+
|
|
69
|
+
/** The edge columns of the `sourceport` / `targetport` XML attributes (roles sourcePort / targetPort). */
|
|
70
|
+
export const SOURCE_PORT_COLUMN = "sourceport";
|
|
71
|
+
|
|
72
|
+
/** The edge column of the `targetport` XML attribute. */
|
|
73
|
+
export const TARGET_PORT_COLUMN = "targetport";
|
|
74
|
+
|
|
75
|
+
/** The node column of the containing node of a nested graph (u32, role parent, refersTo node). */
|
|
76
|
+
export const PARENT_COLUMN = "parent";
|
|
77
|
+
|
|
78
|
+
/** The bool node column marking the hub nodes synthesised for hyperedges under `hyperedges: "star"`. */
|
|
79
|
+
export const HYPEREDGE_HUB_COLUMN = "graphty.hyperedge";
|
|
80
|
+
|
|
81
|
+
/** The column name a node key titled `label` receives the `label` role under. */
|
|
82
|
+
export const LABEL_COLUMN = "label";
|
|
83
|
+
|
|
84
|
+
/** Edge column names reserved for the XML-attribute-derived columns; a key titled like one is renamed `<name>#<id>`. */
|
|
85
|
+
export const RESERVED_EDGE_NAMES: ReadonlySet<string> = new Set([
|
|
86
|
+
EDGE_ID_COLUMN,
|
|
87
|
+
SOURCE_PORT_COLUMN,
|
|
88
|
+
TARGET_PORT_COLUMN,
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
/** Node column names reserved for the XML-derived columns. */
|
|
92
|
+
export const RESERVED_NODE_NAMES: ReadonlySet<string> = new Set([PARENT_COLUMN]);
|
|
93
|
+
|
|
94
|
+
/** The `meta.extra` key under which the importer records what the exporter needs. */
|
|
95
|
+
export const META_KEY = "graphml";
|
|
96
|
+
|
|
97
|
+
/** What the importer stores under `meta.extra.graphml`. */
|
|
98
|
+
export interface GraphmlMeta {
|
|
99
|
+
/** The top-level `<graph id>`, or null. */
|
|
100
|
+
readonly graphId: string | null;
|
|
101
|
+
/** The top-level `edgedefault` as written, so a mixed file re-exports with the same layout. */
|
|
102
|
+
readonly edgedefault: "directed" | "undirected" | null;
|
|
103
|
+
/** The `xmlns:<prefix>` declarations of the root element (yFiles and the like). */
|
|
104
|
+
readonly namespaces: Readonly<Record<string, string>>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The issue codes the GraphML importer records (design section 8.6), by name: the codes shared
|
|
109
|
+
* with the other importers (src/common/codes.ts) and the GraphML-specific ones. A key is the code
|
|
110
|
+
* without its severity and format prefixes.
|
|
111
|
+
*/
|
|
112
|
+
export const GRAPHML_ISSUE = Object.freeze({
|
|
113
|
+
/** Fatal: the input is not well-formed XML. */
|
|
114
|
+
XML_SYNTAX: XML_SYNTAX_CODE,
|
|
115
|
+
/** Fatal: the input holds invalid UTF-8. */
|
|
116
|
+
INVALID_UTF8: INVALID_UTF8_CODE,
|
|
117
|
+
/** Fatal: the root element is not `<graphml>`. */
|
|
118
|
+
NOT_GRAPHML: "E_NOT_GRAPHML",
|
|
119
|
+
/** Fatal: the document has no `<graph>`. */
|
|
120
|
+
NO_GRAPH: NO_GRAPH_CODE,
|
|
121
|
+
/** A `<key>` without an id. */
|
|
122
|
+
KEY_MISSING_ID: "E_GRAPHML_KEY_MISSING_ID",
|
|
123
|
+
/** Two `<key>` elements with the same id. */
|
|
124
|
+
DUPLICATE_KEY: DUPLICATE_KEY_CODE,
|
|
125
|
+
/** A key declared for hyperedges, ports or endpoints (never used). */
|
|
126
|
+
KEY_DOMAIN_UNSUPPORTED: "W_GRAPHML_KEY_DOMAIN_UNSUPPORTED",
|
|
127
|
+
/** A `<node>` without an id. */
|
|
128
|
+
MISSING_ID: MISSING_ID_CODE,
|
|
129
|
+
/** An `<edge>` without a source or a target. */
|
|
130
|
+
MISSING_ENDPOINT: MISSING_ENDPOINT_CODE,
|
|
131
|
+
/** A `<data>` whose key was never declared. */
|
|
132
|
+
UNKNOWN_KEY: "E_GRAPHML_UNKNOWN_KEY",
|
|
133
|
+
/** A `<data>` whose key is declared for another domain. */
|
|
134
|
+
KEY_DOMAIN: "W_GRAPHML_KEY_DOMAIN",
|
|
135
|
+
/** A `<data>` without a key attribute. */
|
|
136
|
+
DATA_MISSING_KEY: "E_GRAPHML_DATA_MISSING_KEY",
|
|
137
|
+
/** A `<key>` whose `for` is not a GraphML domain. */
|
|
138
|
+
KEY_FOR_INVALID: "E_GRAPHML_KEY_FOR_INVALID",
|
|
139
|
+
/** Data of a nested `<graph>`; only the top-level graph has attributes. */
|
|
140
|
+
NESTED_GRAPH_DATA: "W_GRAPHML_NESTED_GRAPH_DATA",
|
|
141
|
+
/** Data of a hyperedge expanded to a star or clique. */
|
|
142
|
+
HYPEREDGE_DATA_DROPPED: "W_GRAPHML_HYPEREDGE_DATA_DROPPED",
|
|
143
|
+
/** Nested elements in the `<data>` of a typed (non-yfiles) key. */
|
|
144
|
+
DATA_NESTED: "E_GRAPHML_DATA_NESTED",
|
|
145
|
+
/** A `<node>` declared twice. */
|
|
146
|
+
DUPLICATE_NODE: DUPLICATE_NODE_CODE,
|
|
147
|
+
/** An edge id already used by another edge. */
|
|
148
|
+
DUPLICATE_EDGE_ID: DUPLICATE_EDGE_ID_CODE,
|
|
149
|
+
/** A `directed` attribute that is neither true nor false. */
|
|
150
|
+
INVALID_DIRECTED: "E_GRAPHML_INVALID_DIRECTED",
|
|
151
|
+
/** An `edgedefault` that is neither directed nor undirected. */
|
|
152
|
+
INVALID_EDGEDEFAULT: "E_GRAPHML_INVALID_EDGEDEFAULT",
|
|
153
|
+
/** A `<graph>` without edgedefault; the `defaultDirected` option applies. */
|
|
154
|
+
EDGEDEFAULT_MISSING: "W_GRAPHML_EDGEDEFAULT_MISSING",
|
|
155
|
+
/** A second top-level `<graph>`; its nodes and edges are merged into the first. */
|
|
156
|
+
MULTIPLE_GRAPHS: MULTIPLE_GRAPHS_CODE,
|
|
157
|
+
/** A `parse.nodes` / `parse.edges` hint the sink cannot reserve (ignored). */
|
|
158
|
+
COUNT_HINT: COUNT_HINT_CODE,
|
|
159
|
+
/** A hyperedge under `hyperedges: "error"`. */
|
|
160
|
+
HYPEREDGE: HYPEREDGE_CODE,
|
|
161
|
+
/** Hyperedges skipped under `hyperedges: "skip"`. */
|
|
162
|
+
HYPEREDGE_SKIPPED: "W_GRAPHML_HYPEREDGE_SKIPPED",
|
|
163
|
+
/** An endpoint of a hyperedge without a node, or with an unknown type. */
|
|
164
|
+
HYPEREDGE_ENDPOINT: "E_GRAPHML_HYPEREDGE_ENDPOINT",
|
|
165
|
+
/** `<port>` declarations (and their data) are not kept; sourceport / targetport edge attributes are. */
|
|
166
|
+
PORT_DECLARATION: "W_GRAPHML_PORT_DECLARATION",
|
|
167
|
+
/** A `<locator>` element. */
|
|
168
|
+
LOCATOR_DROPPED: "W_GRAPHML_LOCATOR_DROPPED",
|
|
169
|
+
/** A `<desc>` of a node, an edge or a hyperedge. */
|
|
170
|
+
DESC_DROPPED: "W_GRAPHML_DESC_DROPPED",
|
|
171
|
+
/** An element the GraphML schema does not define at that place. */
|
|
172
|
+
UNKNOWN_ELEMENT: UNKNOWN_ELEMENT_CODE,
|
|
173
|
+
/** Non-whitespace text where the schema allows only elements. */
|
|
174
|
+
STRAY_TEXT: STRAY_TEXT_CODE,
|
|
175
|
+
/** Two distinct id texts merged into one number under `ids: "number"`. */
|
|
176
|
+
ID_MERGED: ID_MERGED_CODE,
|
|
177
|
+
/** An option GraphML has no use for (`nodeIdFrom`: nodes are identified by their id attribute). */
|
|
178
|
+
OPTION_IGNORED: OPTION_IGNORED_CODE,
|
|
179
|
+
/** A yFiles key under `yfiles: "skip"`. */
|
|
180
|
+
YFILES_SKIPPED: "W_GRAPHML_YFILES_SKIPPED",
|
|
181
|
+
/** A key renamed `<name>#<id>` because the name was taken (design section 5.6). */
|
|
182
|
+
COLUMN_RENAMED: COLUMN_RENAMED_CODE,
|
|
183
|
+
/** A key declared without its role because the table already holds it. */
|
|
184
|
+
ROLE_TAKEN: ROLE_TAKEN_CODE,
|
|
185
|
+
/** A declared type the format does not define (kept as string). */
|
|
186
|
+
UNKNOWN_ATTR_TYPE: UNKNOWN_ATTR_TYPE_CODE,
|
|
187
|
+
/** A default that does not parse as the declared type. */
|
|
188
|
+
BAD_DEFAULT: BAD_DEFAULT_CODE,
|
|
189
|
+
/** A long value beyond 2^53 rounded. */
|
|
190
|
+
PRECISION: PRECISION_CODE,
|
|
191
|
+
/** A builder-policy option the sink does not honour. */
|
|
192
|
+
SINK_OPTION: SINK_OPTION_CODE,
|
|
193
|
+
/** The sink refused the file's direction. */
|
|
194
|
+
DIRECTION_REFUSED: DIRECTION_REFUSED_CODE,
|
|
195
|
+
/** Edges forced to the policy's direction. */
|
|
196
|
+
DIRECTION_FORCED: DIRECTION_FORCED_CODE,
|
|
197
|
+
/** A mixed file under onMixedDirection "error" (fatal). */
|
|
198
|
+
MIXED_DIRECTION: MIXED_DIRECTION_CODE,
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Loss note codes of the GraphML importer (report.lossy) and exporter (check()): the GraphML
|
|
203
|
+
* ones; the generic ones (dtypes, lists, json text, positions, visual and temporal roles,
|
|
204
|
+
* extension tables, id charsets, the weight key clash, name changes) are those of `LOSS`.
|
|
205
|
+
*/
|
|
206
|
+
export const GRAPHML_LOSS = Object.freeze({
|
|
207
|
+
/** yFiles nested XML kept as a JSON tree: structure preserved, not byte-exact. */
|
|
208
|
+
YFILES_JSON: "W_GRAPHML_YFILES_JSON",
|
|
209
|
+
/** A mutual pair written as one undirected edge; the mark is lost. */
|
|
210
|
+
MUTUAL_AS_UNDIRECTED: MUTUAL_AS_UNDIRECTED_CODE,
|
|
211
|
+
/** A `parents` (multi-parent) column cannot be written as nested graphs. */
|
|
212
|
+
PARENTS_DROPPED: PARENTS_DROPPED_CODE,
|
|
213
|
+
/** A role column GraphML has no slot for (kind, node ids, ...) written as a plain attribute. */
|
|
214
|
+
ROLE_DROPPED: ROLE_DROPPED_CODE,
|
|
215
|
+
/** Containment order differs from index order; node indices change after a round trip. */
|
|
216
|
+
HIERARCHY_REORDERED: "W_GRAPHML_HIERARCHY_REORDERED",
|
|
217
|
+
/** Nodes whose parent chain never reaches a root are written at the top level. */
|
|
218
|
+
PARENT_CYCLE: "W_GRAPHML_PARENT_CYCLE",
|
|
219
|
+
/** Node ids that change type after a round trip under the canonical rule (design section 4.1). */
|
|
220
|
+
ID_TEXT_TYPE: ID_TEXT_TYPE_CODE,
|
|
221
|
+
/** A numeric edge id column reads back as string. */
|
|
222
|
+
EDGE_ID_TEXT: "W_GRAPHML_EDGE_ID_TEXT",
|
|
223
|
+
/** A yfiles json value that is not a serialisable tree: export() will throw E_COLUMN_TYPE. */
|
|
224
|
+
YFILES_TREE: "E_GRAPHML_YFILES_TREE",
|
|
225
|
+
});
|