@graphty/graph-io 0.3.43 → 0.3.44
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/approximations-3Q4TsdTh.js +40 -0
- package/dist/chunks/approximations-3Q4TsdTh.js.map +1 -0
- package/dist/chunks/block-JQiwViEt.js +2777 -0
- package/dist/chunks/block-JQiwViEt.js.map +1 -0
- package/dist/chunks/{choose-DvpbdRuz.js → choose-BemygfH8.js} +3 -2
- package/dist/chunks/{choose-DvpbdRuz.js.map → choose-BemygfH8.js.map} +1 -1
- package/dist/chunks/{constants-fT3E8JYY.js → constants-BFUR_CtU.js} +6 -2
- package/dist/chunks/constants-BFUR_CtU.js.map +1 -0
- package/dist/chunks/convert-BcQ8_jMo.js +59 -0
- package/dist/chunks/convert-BcQ8_jMo.js.map +1 -0
- package/dist/chunks/emit-DCwFLts5.js +3456 -0
- package/dist/chunks/emit-DCwFLts5.js.map +1 -0
- package/dist/chunks/{escape-B62ZGM_a.js → escape-B1rMftd9.js} +43 -20
- package/dist/chunks/escape-B1rMftd9.js.map +1 -0
- package/dist/chunks/{export-rKLeGQMo.js → export-D7IGzTG4.js} +196 -792
- package/dist/chunks/export-D7IGzTG4.js.map +1 -0
- package/dist/chunks/{exporter-BWwEuOPT.js → exporter-BtnqYuuj.js} +22 -12
- package/dist/chunks/exporter-BtnqYuuj.js.map +1 -0
- package/dist/chunks/{exporter-yLxKBvLE.js → exporter-ChPyhBOv.js} +4 -3
- package/dist/chunks/{exporter-yLxKBvLE.js.map → exporter-ChPyhBOv.js.map} +1 -1
- package/dist/chunks/{exporter-8hLNemFk.js → exporter-KEPxYUXD.js} +133 -74
- package/dist/chunks/exporter-KEPxYUXD.js.map +1 -0
- package/dist/chunks/{exporter-RVtXVetw.js → exporter-quPUCBiC.js} +1805 -287
- package/dist/chunks/exporter-quPUCBiC.js.map +1 -0
- package/dist/chunks/format-GDmO6m6Q.js +676 -0
- package/dist/chunks/format-GDmO6m6Q.js.map +1 -0
- package/dist/chunks/generic-BL06jrJf.js +1347 -0
- package/dist/chunks/generic-BL06jrJf.js.map +1 -0
- package/dist/chunks/{importer-WrGRZb0N.js → importer-B7r2owVf.js} +449 -102
- package/dist/chunks/importer-B7r2owVf.js.map +1 -0
- package/dist/chunks/{importer-Ht7LNg8L.js → importer-BFmOP96W.js} +116 -296
- package/dist/chunks/importer-BFmOP96W.js.map +1 -0
- package/dist/chunks/{importer-BbNb7eNg.js → importer-C2nzGhdV.js} +1390 -129
- package/dist/chunks/importer-C2nzGhdV.js.map +1 -0
- package/dist/chunks/{importer-Dz7tI8Sa.js → importer-CbX2_rNF.js} +617 -115
- package/dist/chunks/importer-CbX2_rNF.js.map +1 -0
- package/dist/chunks/{importer-D794XUTe.js → importer-CdzeN6X4.js} +31 -8
- package/dist/chunks/importer-CdzeN6X4.js.map +1 -0
- package/dist/chunks/{importer-xZ-3suY1.js → importer-ChKNC_GN.js} +791 -135
- package/dist/chunks/importer-ChKNC_GN.js.map +1 -0
- package/dist/chunks/{importer-C98dpSH4.js → importer-dwoYpSqb.js} +141 -82
- package/dist/chunks/importer-dwoYpSqb.js.map +1 -0
- package/dist/chunks/index-B9fdNpTA.js +4310 -0
- package/dist/chunks/index-B9fdNpTA.js.map +1 -0
- package/dist/chunks/{json-elements-DKSqpNW1.js → json-elements-C4FwgnH5.js} +123 -32
- package/dist/chunks/json-elements-C4FwgnH5.js.map +1 -0
- package/dist/chunks/lexicon-B-knUi-l.js +508 -0
- package/dist/chunks/lexicon-B-knUi-l.js.map +1 -0
- package/dist/chunks/{ontology-export-CtRXjg_i.js → ontology-export-BSpbY5FL.js} +3 -2
- package/dist/chunks/{ontology-export-CtRXjg_i.js.map → ontology-export-BSpbY5FL.js.map} +1 -1
- package/dist/chunks/{records-Cu4bxYOm.js → records-Nwz_rbNt.js} +2 -2
- package/dist/chunks/{records-Cu4bxYOm.js.map → records-Nwz_rbNt.js.map} +1 -1
- package/dist/chunks/styles-Brt9JMfs.js +690 -0
- package/dist/chunks/styles-Brt9JMfs.js.map +1 -0
- package/dist/chunks/styles-_N-C8S-U.js +2102 -0
- package/dist/chunks/styles-_N-C8S-U.js.map +1 -0
- package/dist/chunks/styles-yed-DAfcIkf7.js +842 -0
- package/dist/chunks/styles-yed-DAfcIkf7.js.map +1 -0
- package/dist/chunks/{text-DHOJXnED.js → text-CgzMqHQb.js} +2 -2
- package/dist/chunks/{text-DHOJXnED.js.map → text-CgzMqHQb.js.map} +1 -1
- package/dist/chunks/units-XMZFIFe1.js +19 -0
- package/dist/chunks/units-XMZFIFe1.js.map +1 -0
- package/dist/csv.js +5 -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 +5 -2
- package/dist/dot.js.map +1 -1
- package/dist/gexf.js +292 -412
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +8 -3031
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +354 -240
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +4 -2
- package/dist/graphml.js.map +1 -1
- package/dist/json.js +1 -1
- package/dist/neo4j.js +4 -3
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +4 -2
- package/dist/positions.d.ts +1 -0
- package/dist/positions.js +427 -0
- package/dist/positions.js.map +1 -0
- package/dist/src/common/codes.d.ts +6 -0
- package/dist/src/common/codes.d.ts.map +1 -1
- package/dist/src/common/codes.js +6 -0
- package/dist/src/common/codes.js.map +1 -1
- package/dist/src/common/escape.d.ts.map +1 -1
- package/dist/src/common/escape.js +4 -2
- package/dist/src/common/escape.js.map +1 -1
- package/dist/src/common/export.d.ts +10 -0
- package/dist/src/common/export.d.ts.map +1 -1
- package/dist/src/common/export.js +123 -100
- package/dist/src/common/export.js.map +1 -1
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +8 -1
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/json-elements.d.ts +12 -9
- package/dist/src/common/json-elements.d.ts.map +1 -1
- package/dist/src/common/json-elements.js +160 -37
- package/dist/src/common/json-elements.js.map +1 -1
- package/dist/src/common/notes.d.ts +42 -0
- package/dist/src/common/notes.d.ts.map +1 -0
- package/dist/src/common/notes.js +72 -0
- package/dist/src/common/notes.js.map +1 -0
- package/dist/src/common/report.d.ts +18 -0
- package/dist/src/common/report.d.ts.map +1 -1
- package/dist/src/common/report.js +36 -1
- package/dist/src/common/report.js.map +1 -1
- package/dist/src/common/units.d.ts +24 -0
- package/dist/src/common/units.d.ts.map +1 -0
- package/dist/src/common/units.js +26 -0
- package/dist/src/common/units.js.map +1 -0
- package/dist/src/common/xml.d.ts +18 -0
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +42 -5
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/formats/cx/exporter.d.ts +6 -0
- package/dist/src/formats/cx/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx/exporter.js +71 -8
- package/dist/src/formats/cx/exporter.js.map +1 -1
- package/dist/src/formats/cx/importer.d.ts +5 -2
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +102 -72
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx/styles.d.ts +102 -0
- package/dist/src/formats/cx/styles.d.ts.map +1 -0
- package/dist/src/formats/cx/styles.js +225 -0
- package/dist/src/formats/cx/styles.js.map +1 -0
- package/dist/src/formats/cx2/exporter.d.ts +5 -0
- package/dist/src/formats/cx2/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx2/exporter.js +181 -71
- package/dist/src/formats/cx2/exporter.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts +4 -1
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +19 -1
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cx2/styles.d.ts +18 -0
- package/dist/src/formats/cx2/styles.d.ts.map +1 -0
- package/dist/src/formats/cx2/styles.js +24 -0
- package/dist/src/formats/cx2/styles.js.map +1 -0
- package/dist/src/formats/cys/constants.d.ts +2 -0
- package/dist/src/formats/cys/constants.d.ts.map +1 -1
- package/dist/src/formats/cys/constants.js +2 -0
- package/dist/src/formats/cys/constants.js.map +1 -1
- package/dist/src/formats/cys/exporter.d.ts +6 -2
- package/dist/src/formats/cys/exporter.d.ts.map +1 -1
- package/dist/src/formats/cys/exporter.js +215 -53
- package/dist/src/formats/cys/exporter.js.map +1 -1
- package/dist/src/formats/cys/importer.d.ts +2 -1
- package/dist/src/formats/cys/importer.d.ts.map +1 -1
- package/dist/src/formats/cys/importer.js +119 -6
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/session.d.ts +2 -0
- package/dist/src/formats/cys/session.d.ts.map +1 -1
- package/dist/src/formats/cys/session.js +5 -0
- package/dist/src/formats/cys/session.js.map +1 -1
- package/dist/src/formats/cys/styles.d.ts +38 -0
- package/dist/src/formats/cys/styles.d.ts.map +1 -0
- package/dist/src/formats/cys/styles.js +213 -0
- package/dist/src/formats/cys/styles.js.map +1 -0
- package/dist/src/formats/cys/tables.d.ts +8 -3
- package/dist/src/formats/cys/tables.d.ts.map +1 -1
- package/dist/src/formats/cys/tables.js +88 -34
- package/dist/src/formats/cys/tables.js.map +1 -1
- package/dist/src/formats/dot/exporter.d.ts +2 -0
- package/dist/src/formats/dot/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +195 -81
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +100 -20
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/index.d.ts +1 -0
- package/dist/src/formats/dot/index.d.ts.map +1 -1
- package/dist/src/formats/dot/index.js +1 -0
- package/dist/src/formats/dot/index.js.map +1 -1
- package/dist/src/formats/dot/positions.d.ts +14 -0
- package/dist/src/formats/dot/positions.d.ts.map +1 -0
- package/dist/src/formats/dot/positions.js +70 -0
- package/dist/src/formats/dot/positions.js.map +1 -0
- package/dist/src/formats/dot/styles.d.ts +82 -0
- package/dist/src/formats/dot/styles.d.ts.map +1 -0
- package/dist/src/formats/dot/styles.js +1484 -0
- package/dist/src/formats/dot/styles.js.map +1 -0
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +20 -5
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts +8 -1
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +251 -131
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/index.d.ts +8 -0
- package/dist/src/formats/gexf/index.d.ts.map +1 -1
- package/dist/src/formats/gexf/index.js +10 -2
- package/dist/src/formats/gexf/index.js.map +1 -1
- package/dist/src/formats/gexf/schema.d.ts +5 -0
- package/dist/src/formats/gexf/schema.d.ts.map +1 -1
- package/dist/src/formats/gexf/schema.js +5 -0
- package/dist/src/formats/gexf/schema.js.map +1 -1
- package/dist/src/formats/gexf/styles.d.ts +74 -0
- package/dist/src/formats/gexf/styles.d.ts.map +1 -0
- package/dist/src/formats/gexf/styles.js +604 -0
- package/dist/src/formats/gexf/styles.js.map +1 -0
- package/dist/src/formats/gml/exporter.d.ts +1 -5
- package/dist/src/formats/gml/exporter.d.ts.map +1 -1
- package/dist/src/formats/gml/exporter.js +19 -8
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +4 -0
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +2 -1
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +2 -1
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/gml/positions.d.ts +14 -0
- package/dist/src/formats/gml/positions.d.ts.map +1 -0
- package/dist/src/formats/gml/positions.js +46 -0
- package/dist/src/formats/gml/positions.js.map +1 -0
- package/dist/src/formats/gml/styles.d.ts +59 -0
- package/dist/src/formats/gml/styles.d.ts.map +1 -0
- package/dist/src/formats/gml/styles.js +1056 -0
- package/dist/src/formats/gml/styles.js.map +1 -0
- package/dist/src/formats/gml/syntax.d.ts +11 -0
- package/dist/src/formats/gml/syntax.d.ts.map +1 -1
- package/dist/src/formats/gml/syntax.js +151 -62
- package/dist/src/formats/gml/syntax.js.map +1 -1
- package/dist/src/formats/graphml/constants.d.ts +4 -0
- package/dist/src/formats/graphml/constants.d.ts.map +1 -1
- package/dist/src/formats/graphml/constants.js +5 -1
- package/dist/src/formats/graphml/constants.js.map +1 -1
- package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
- package/dist/src/formats/graphml/exporter.js +133 -65
- package/dist/src/formats/graphml/exporter.js.map +1 -1
- package/dist/src/formats/graphml/importer.d.ts +4 -1
- package/dist/src/formats/graphml/importer.d.ts.map +1 -1
- package/dist/src/formats/graphml/importer.js +100 -44
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/graphml/index.d.ts +1 -0
- package/dist/src/formats/graphml/index.d.ts.map +1 -1
- package/dist/src/formats/graphml/index.js +1 -0
- package/dist/src/formats/graphml/index.js.map +1 -1
- package/dist/src/formats/graphml/styles-plain.d.ts +19 -0
- package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-plain.js +187 -0
- package/dist/src/formats/graphml/styles-plain.js.map +1 -0
- package/dist/src/formats/graphml/styles-yed.d.ts +179 -0
- package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-yed.js +1086 -0
- package/dist/src/formats/graphml/styles-yed.js.map +1 -0
- package/dist/src/formats/graphml/styles-yfiles3.d.ts +19 -0
- package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-yfiles3.js +508 -0
- package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -0
- package/dist/src/formats/graphml/tree.d.ts.map +1 -1
- package/dist/src/formats/graphml/tree.js +34 -19
- package/dist/src/formats/graphml/tree.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts +16 -2
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +83 -12
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/exporter.d.ts +5 -0
- package/dist/src/formats/json/exporter.d.ts.map +1 -1
- package/dist/src/formats/json/exporter.js +68 -25
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +22 -3
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +439 -264
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/positions.d.ts +16 -0
- package/dist/src/formats/json/positions.d.ts.map +1 -0
- package/dist/src/formats/json/positions.js +44 -0
- package/dist/src/formats/json/positions.js.map +1 -0
- package/dist/src/formats/json/styles.d.ts +102 -0
- package/dist/src/formats/json/styles.d.ts.map +1 -0
- package/dist/src/formats/json/styles.js +1753 -0
- package/dist/src/formats/json/styles.js.map +1 -0
- package/dist/src/formats/neo4j/exporter.d.ts.map +1 -1
- package/dist/src/formats/neo4j/exporter.js +2 -1
- package/dist/src/formats/neo4j/exporter.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts +2 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +142 -76
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +4 -0
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +60 -6
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/index.d.ts +2 -0
- package/dist/src/formats/pajek/index.d.ts.map +1 -1
- package/dist/src/formats/pajek/index.js +2 -0
- package/dist/src/formats/pajek/index.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts +50 -0
- package/dist/src/formats/pajek/styles.d.ts.map +1 -0
- package/dist/src/formats/pajek/styles.js +569 -0
- package/dist/src/formats/pajek/styles.js.map +1 -0
- package/dist/src/formats/pajek/syntax.d.ts +6 -0
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +6 -0
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/columns.d.ts.map +1 -1
- package/dist/src/formats/xgmml/columns.js +34 -9
- package/dist/src/formats/xgmml/columns.js.map +1 -1
- package/dist/src/formats/xgmml/constants.d.ts +2 -0
- package/dist/src/formats/xgmml/constants.d.ts.map +1 -1
- package/dist/src/formats/xgmml/constants.js +3 -1
- package/dist/src/formats/xgmml/constants.js.map +1 -1
- package/dist/src/formats/xgmml/document.d.ts +12 -8
- package/dist/src/formats/xgmml/document.d.ts.map +1 -1
- package/dist/src/formats/xgmml/document.js +56 -13
- package/dist/src/formats/xgmml/document.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +12 -6
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/exporter.d.ts +3 -1
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +22 -9
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/importer.d.ts +2 -1
- package/dist/src/formats/xgmml/importer.d.ts.map +1 -1
- package/dist/src/formats/xgmml/importer.js +31 -24
- package/dist/src/formats/xgmml/importer.js.map +1 -1
- package/dist/src/formats/xgmml/styles.d.ts +104 -0
- package/dist/src/formats/xgmml/styles.d.ts.map +1 -0
- package/dist/src/formats/xgmml/styles.js +310 -0
- package/dist/src/formats/xgmml/styles.js.map +1 -0
- package/dist/src/index.d.ts +9 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -7
- package/dist/src/index.js.map +1 -1
- package/dist/src/positions/codes.d.ts +31 -0
- package/dist/src/positions/codes.d.ts.map +1 -0
- package/dist/src/positions/codes.js +26 -0
- package/dist/src/positions/codes.js.map +1 -0
- package/dist/src/positions/convert.d.ts +58 -0
- package/dist/src/positions/convert.d.ts.map +1 -0
- package/dist/src/positions/convert.js +107 -0
- package/dist/src/positions/convert.js.map +1 -0
- package/dist/src/positions/extract.d.ts +27 -0
- package/dist/src/positions/extract.d.ts.map +1 -0
- package/dist/src/positions/extract.js +526 -0
- package/dist/src/positions/extract.js.map +1 -0
- package/dist/src/positions/index.d.ts +10 -0
- package/dist/src/positions/index.d.ts.map +1 -0
- package/dist/src/positions/index.js +9 -0
- package/dist/src/positions/index.js.map +1 -0
- package/dist/src/positions/types.d.ts +208 -0
- package/dist/src/positions/types.d.ts.map +1 -0
- package/dist/src/positions/types.js +10 -0
- package/dist/src/positions/types.js.map +1 -0
- package/dist/src/registry.d.ts +30 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +130 -9
- package/dist/src/registry.js.map +1 -1
- package/dist/src/styles/annotations.d.ts +132 -0
- package/dist/src/styles/annotations.d.ts.map +1 -0
- package/dist/src/styles/annotations.js +320 -0
- package/dist/src/styles/annotations.js.map +1 -0
- package/dist/src/styles/budget.d.ts +45 -0
- package/dist/src/styles/budget.d.ts.map +1 -0
- package/dist/src/styles/budget.js +58 -0
- package/dist/src/styles/budget.js.map +1 -0
- package/dist/src/styles/canon/bends.d.ts +32 -0
- package/dist/src/styles/canon/bends.d.ts.map +1 -0
- package/dist/src/styles/canon/bends.js +74 -0
- package/dist/src/styles/canon/bends.js.map +1 -0
- package/dist/src/styles/canon/color-tables.d.ts +22 -0
- package/dist/src/styles/canon/color-tables.d.ts.map +1 -0
- package/dist/src/styles/canon/color-tables.js +369 -0
- package/dist/src/styles/canon/color-tables.js.map +1 -0
- package/dist/src/styles/canon/color.d.ts +66 -0
- package/dist/src/styles/canon/color.d.ts.map +1 -0
- package/dist/src/styles/canon/color.js +548 -0
- package/dist/src/styles/canon/color.js.map +1 -0
- package/dist/src/styles/canon/enums.d.ts +25 -0
- package/dist/src/styles/canon/enums.d.ts.map +1 -0
- package/dist/src/styles/canon/enums.js +187 -0
- package/dist/src/styles/canon/enums.js.map +1 -0
- package/dist/src/styles/canon/graphviz.d.ts +48 -0
- package/dist/src/styles/canon/graphviz.d.ts.map +1 -0
- package/dist/src/styles/canon/graphviz.js +160 -0
- package/dist/src/styles/canon/graphviz.js.map +1 -0
- package/dist/src/styles/canon/index.d.ts +13 -0
- package/dist/src/styles/canon/index.d.ts.map +1 -0
- package/dist/src/styles/canon/index.js +13 -0
- package/dist/src/styles/canon/index.js.map +1 -0
- package/dist/src/styles/canon/number.d.ts +59 -0
- package/dist/src/styles/canon/number.d.ts.map +1 -0
- package/dist/src/styles/canon/number.js +142 -0
- package/dist/src/styles/canon/number.js.map +1 -0
- package/dist/src/styles/canon/site.d.ts +51 -0
- package/dist/src/styles/canon/site.d.ts.map +1 -0
- package/dist/src/styles/canon/site.js +63 -0
- package/dist/src/styles/canon/site.js.map +1 -0
- package/dist/src/styles/canon/text.d.ts +61 -0
- package/dist/src/styles/canon/text.d.ts.map +1 -0
- package/dist/src/styles/canon/text.js +199 -0
- package/dist/src/styles/canon/text.js.map +1 -0
- package/dist/src/styles/codes.d.ts +95 -0
- package/dist/src/styles/codes.d.ts.map +1 -0
- package/dist/src/styles/codes.js +97 -0
- package/dist/src/styles/codes.js.map +1 -0
- package/dist/src/styles/cyjs/cascade.d.ts +134 -0
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -0
- package/dist/src/styles/cyjs/cascade.js +2252 -0
- package/dist/src/styles/cyjs/cascade.js.map +1 -0
- package/dist/src/styles/cyjs/defaults-table.d.ts +25 -0
- package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -0
- package/dist/src/styles/cyjs/defaults-table.js +76 -0
- package/dist/src/styles/cyjs/defaults-table.js.map +1 -0
- package/dist/src/styles/cyjs/emit.d.ts +82 -0
- package/dist/src/styles/cyjs/emit.d.ts.map +1 -0
- package/dist/src/styles/cyjs/emit.js +790 -0
- package/dist/src/styles/cyjs/emit.js.map +1 -0
- package/dist/src/styles/cyjs/index.d.ts +13 -0
- package/dist/src/styles/cyjs/index.d.ts.map +1 -0
- package/dist/src/styles/cyjs/index.js +13 -0
- package/dist/src/styles/cyjs/index.js.map +1 -0
- package/dist/src/styles/cyjs/live.d.ts +46 -0
- package/dist/src/styles/cyjs/live.d.ts.map +1 -0
- package/dist/src/styles/cyjs/live.js +108 -0
- package/dist/src/styles/cyjs/live.js.map +1 -0
- package/dist/src/styles/cyjs/mappers.d.ts +147 -0
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -0
- package/dist/src/styles/cyjs/mappers.js +744 -0
- package/dist/src/styles/cyjs/mappers.js.map +1 -0
- package/dist/src/styles/cyjs/selector.d.ts +113 -0
- package/dist/src/styles/cyjs/selector.d.ts.map +1 -0
- package/dist/src/styles/cyjs/selector.js +611 -0
- package/dist/src/styles/cyjs/selector.js.map +1 -0
- package/dist/src/styles/cyjs/stylesheet-text.d.ts +37 -0
- package/dist/src/styles/cyjs/stylesheet-text.d.ts.map +1 -0
- package/dist/src/styles/cyjs/stylesheet-text.js +181 -0
- package/dist/src/styles/cyjs/stylesheet-text.js.map +1 -0
- package/dist/src/styles/cytoscape/emit.d.ts +125 -0
- package/dist/src/styles/cytoscape/emit.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/emit.js +1025 -0
- package/dist/src/styles/cytoscape/emit.js.map +1 -0
- package/dist/src/styles/cytoscape/index.d.ts +10 -0
- package/dist/src/styles/cytoscape/index.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/index.js +10 -0
- package/dist/src/styles/cytoscape/index.js.map +1 -0
- package/dist/src/styles/cytoscape/lexicon.d.ts +49 -0
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/lexicon.js +603 -0
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -0
- package/dist/src/styles/cytoscape/mappings.d.ts +171 -0
- package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/mappings.js +460 -0
- package/dist/src/styles/cytoscape/mappings.js.map +1 -0
- package/dist/src/styles/cytoscape/resolve.d.ts +137 -0
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/resolve.js +381 -0
- package/dist/src/styles/cytoscape/resolve.js.map +1 -0
- package/dist/src/styles/cytoscape/translate.d.ts +50 -0
- package/dist/src/styles/cytoscape/translate.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/translate.js +156 -0
- package/dist/src/styles/cytoscape/translate.js.map +1 -0
- package/dist/src/styles/defaults.d.ts +90 -0
- package/dist/src/styles/defaults.d.ts.map +1 -0
- package/dist/src/styles/defaults.js +414 -0
- package/dist/src/styles/defaults.js.map +1 -0
- package/dist/src/styles/index.d.ts +15 -0
- package/dist/src/styles/index.d.ts.map +1 -0
- package/dist/src/styles/index.js +14 -0
- package/dist/src/styles/index.js.map +1 -0
- package/dist/src/styles/internal.d.ts +17 -0
- package/dist/src/styles/internal.d.ts.map +1 -0
- package/dist/src/styles/internal.js +16 -0
- package/dist/src/styles/internal.js.map +1 -0
- package/dist/src/styles/io/approximations.d.ts +24 -0
- package/dist/src/styles/io/approximations.d.ts.map +1 -0
- package/dist/src/styles/io/approximations.js +51 -0
- package/dist/src/styles/io/approximations.js.map +1 -0
- package/dist/src/styles/io/block.d.ts +166 -0
- package/dist/src/styles/io/block.d.ts.map +1 -0
- package/dist/src/styles/io/block.js +930 -0
- package/dist/src/styles/io/block.js.map +1 -0
- package/dist/src/styles/io/generic.d.ts +88 -0
- package/dist/src/styles/io/generic.d.ts.map +1 -0
- package/dist/src/styles/io/generic.js +516 -0
- package/dist/src/styles/io/generic.js.map +1 -0
- package/dist/src/styles/io/index.d.ts +8 -0
- package/dist/src/styles/io/index.d.ts.map +1 -0
- package/dist/src/styles/io/index.js +7 -0
- package/dist/src/styles/io/index.js.map +1 -0
- package/dist/src/styles/io/writer.d.ts +80 -0
- package/dist/src/styles/io/writer.d.ts.map +1 -0
- package/dist/src/styles/io/writer.js +596 -0
- package/dist/src/styles/io/writer.js.map +1 -0
- package/dist/src/styles/notes.d.ts +47 -0
- package/dist/src/styles/notes.d.ts.map +1 -0
- package/dist/src/styles/notes.js +140 -0
- package/dist/src/styles/notes.js.map +1 -0
- package/dist/src/styles/plan/classes.d.ts +31 -0
- package/dist/src/styles/plan/classes.d.ts.map +1 -0
- package/dist/src/styles/plan/classes.js +139 -0
- package/dist/src/styles/plan/classes.js.map +1 -0
- package/dist/src/styles/plan/continuous.d.ts +32 -0
- package/dist/src/styles/plan/continuous.d.ts.map +1 -0
- package/dist/src/styles/plan/continuous.js +165 -0
- package/dist/src/styles/plan/continuous.js.map +1 -0
- package/dist/src/styles/plan/discrete.d.ts +39 -0
- package/dist/src/styles/plan/discrete.d.ts.map +1 -0
- package/dist/src/styles/plan/discrete.js +127 -0
- package/dist/src/styles/plan/discrete.js.map +1 -0
- package/dist/src/styles/plan/families.d.ts +31 -0
- package/dist/src/styles/plan/families.d.ts.map +1 -0
- package/dist/src/styles/plan/families.js +95 -0
- package/dist/src/styles/plan/families.js.map +1 -0
- package/dist/src/styles/plan/features.d.ts +58 -0
- package/dist/src/styles/plan/features.d.ts.map +1 -0
- package/dist/src/styles/plan/features.js +185 -0
- package/dist/src/styles/plan/features.js.map +1 -0
- package/dist/src/styles/plan/index.d.ts +7 -0
- package/dist/src/styles/plan/index.d.ts.map +1 -0
- package/dist/src/styles/plan/index.js +7 -0
- package/dist/src/styles/plan/index.js.map +1 -0
- package/dist/src/styles/plan/plan.d.ts +71 -0
- package/dist/src/styles/plan/plan.d.ts.map +1 -0
- package/dist/src/styles/plan/plan.js +893 -0
- package/dist/src/styles/plan/plan.js.map +1 -0
- package/dist/src/styles/plan/resolve.d.ts +137 -0
- package/dist/src/styles/plan/resolve.d.ts.map +1 -0
- package/dist/src/styles/plan/resolve.js +587 -0
- package/dist/src/styles/plan/resolve.js.map +1 -0
- package/dist/src/styles/types.d.ts +702 -0
- package/dist/src/styles/types.d.ts.map +1 -0
- package/dist/src/styles/types.js +10 -0
- package/dist/src/styles/types.js.map +1 -0
- package/dist/src/styles/vocabulary.d.ts +41 -0
- package/dist/src/styles/vocabulary.d.ts.map +1 -0
- package/dist/src/styles/vocabulary.js +140 -0
- package/dist/src/styles/vocabulary.js.map +1 -0
- package/dist/src/types.d.ts +64 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/styles.d.ts +1 -0
- package/dist/styles.js +322 -0
- package/dist/styles.js.map +1 -0
- package/dist/xgmml.js +5 -4
- package/dist/xgmml.js.map +1 -1
- package/package.json +13 -2
- package/src/common/codes.ts +7 -0
- package/src/common/escape.ts +5 -2
- package/src/common/export.ts +179 -140
- package/src/common/input.ts +8 -4
- package/src/common/json-elements.ts +169 -38
- package/src/common/notes.ts +94 -0
- package/src/common/report.ts +41 -1
- package/src/common/units.ts +42 -0
- package/src/common/xml.ts +45 -5
- package/src/formats/cx/exporter.ts +95 -11
- package/src/formats/cx/importer.ts +126 -90
- package/src/formats/cx/styles.ts +304 -0
- package/src/formats/cx2/exporter.ts +234 -77
- package/src/formats/cx2/importer.ts +19 -1
- package/src/formats/cx2/styles.ts +29 -0
- package/src/formats/cys/constants.ts +3 -0
- package/src/formats/cys/exporter.ts +246 -60
- package/src/formats/cys/importer.ts +125 -9
- package/src/formats/cys/session.ts +6 -0
- package/src/formats/cys/styles.ts +254 -0
- package/src/formats/cys/tables.ts +117 -48
- package/src/formats/dot/exporter.ts +262 -126
- package/src/formats/dot/importer.ts +111 -20
- package/src/formats/dot/index.ts +1 -0
- package/src/formats/dot/positions.ts +77 -0
- package/src/formats/dot/styles.ts +1741 -0
- package/src/formats/gexf/exporter.ts +27 -11
- package/src/formats/gexf/importer.ts +308 -158
- package/src/formats/gexf/index.ts +10 -0
- package/src/formats/gexf/schema.ts +5 -0
- package/src/formats/gexf/styles.ts +719 -0
- package/src/formats/gml/exporter.ts +33 -14
- package/src/formats/gml/importer.ts +4 -0
- package/src/formats/gml/index.ts +2 -1
- package/src/formats/gml/positions.ts +52 -0
- package/src/formats/gml/styles.ts +1248 -0
- package/src/formats/gml/syntax.ts +173 -62
- package/src/formats/graphml/constants.ts +5 -0
- package/src/formats/graphml/exporter.ts +163 -71
- package/src/formats/graphml/importer.ts +119 -45
- package/src/formats/graphml/index.ts +1 -0
- package/src/formats/graphml/styles-plain.ts +236 -0
- package/src/formats/graphml/styles-yed.ts +1221 -0
- package/src/formats/graphml/styles-yfiles3.ts +573 -0
- package/src/formats/graphml/tree.ts +36 -20
- package/src/formats/graphml/yfiles.ts +89 -13
- package/src/formats/json/exporter.ts +76 -26
- package/src/formats/json/importer.ts +541 -322
- package/src/formats/json/positions.ts +50 -0
- package/src/formats/json/styles.ts +2082 -0
- package/src/formats/neo4j/exporter.ts +2 -1
- package/src/formats/pajek/exporter.ts +195 -106
- package/src/formats/pajek/importer.ts +78 -9
- package/src/formats/pajek/index.ts +2 -0
- package/src/formats/pajek/styles.ts +685 -0
- package/src/formats/pajek/syntax.ts +7 -0
- package/src/formats/xgmml/columns.ts +39 -9
- package/src/formats/xgmml/constants.ts +3 -0
- package/src/formats/xgmml/document.ts +54 -12
- package/src/formats/xgmml/emit.ts +11 -6
- package/src/formats/xgmml/exporter.ts +32 -13
- package/src/formats/xgmml/importer.ts +43 -29
- package/src/formats/xgmml/styles.ts +400 -0
- package/src/index.ts +16 -0
- package/src/positions/codes.ts +32 -0
- package/src/positions/convert.ts +123 -0
- package/src/positions/extract.ts +619 -0
- package/src/positions/index.ts +23 -0
- package/src/positions/types.ts +221 -0
- package/src/registry.ts +179 -8
- package/src/styles/annotations.ts +478 -0
- package/src/styles/budget.ts +60 -0
- package/src/styles/canon/bends.ts +84 -0
- package/src/styles/canon/color-tables.ts +386 -0
- package/src/styles/canon/color.ts +624 -0
- package/src/styles/canon/enums.ts +211 -0
- package/src/styles/canon/graphviz.ts +189 -0
- package/src/styles/canon/index.ts +13 -0
- package/src/styles/canon/number.ts +152 -0
- package/src/styles/canon/site.ts +87 -0
- package/src/styles/canon/text.ts +221 -0
- package/src/styles/codes.ts +104 -0
- package/src/styles/cyjs/cascade.ts +2670 -0
- package/src/styles/cyjs/defaults-table.ts +82 -0
- package/src/styles/cyjs/emit.ts +951 -0
- package/src/styles/cyjs/index.ts +37 -0
- package/src/styles/cyjs/live.ts +147 -0
- package/src/styles/cyjs/mappers.ts +879 -0
- package/src/styles/cyjs/selector.ts +778 -0
- package/src/styles/cyjs/stylesheet-text.ts +214 -0
- package/src/styles/cytoscape/emit.ts +1264 -0
- package/src/styles/cytoscape/index.ts +40 -0
- package/src/styles/cytoscape/lexicon.ts +656 -0
- package/src/styles/cytoscape/mappings.ts +603 -0
- package/src/styles/cytoscape/resolve.ts +521 -0
- package/src/styles/cytoscape/translate.ts +237 -0
- package/src/styles/defaults.ts +504 -0
- package/src/styles/index.ts +57 -0
- package/src/styles/internal.ts +17 -0
- package/src/styles/io/approximations.ts +47 -0
- package/src/styles/io/block.ts +1138 -0
- package/src/styles/io/generic.ts +687 -0
- package/src/styles/io/index.ts +18 -0
- package/src/styles/io/writer.ts +745 -0
- package/src/styles/notes.ts +165 -0
- package/src/styles/plan/classes.ts +166 -0
- package/src/styles/plan/continuous.ts +218 -0
- package/src/styles/plan/discrete.ts +165 -0
- package/src/styles/plan/families.ts +115 -0
- package/src/styles/plan/features.ts +234 -0
- package/src/styles/plan/index.ts +7 -0
- package/src/styles/plan/plan.ts +1129 -0
- package/src/styles/plan/resolve.ts +685 -0
- package/src/styles/types.ts +814 -0
- package/src/styles/vocabulary.ts +172 -0
- package/src/types.ts +76 -1
- package/dist/chunks/constants-fT3E8JYY.js.map +0 -1
- package/dist/chunks/escape-B62ZGM_a.js.map +0 -1
- package/dist/chunks/export-rKLeGQMo.js.map +0 -1
- package/dist/chunks/exporter-8hLNemFk.js.map +0 -1
- package/dist/chunks/exporter-BWwEuOPT.js.map +0 -1
- package/dist/chunks/exporter-RVtXVetw.js.map +0 -1
- package/dist/chunks/importer-BbNb7eNg.js.map +0 -1
- package/dist/chunks/importer-C98dpSH4.js.map +0 -1
- package/dist/chunks/importer-D794XUTe.js.map +0 -1
- package/dist/chunks/importer-Dz7tI8Sa.js.map +0 -1
- package/dist/chunks/importer-Ht7LNg8L.js.map +0 -1
- package/dist/chunks/importer-WrGRZb0N.js.map +0 -1
- package/dist/chunks/importer-xZ-3suY1.js.map +0 -1
- package/dist/chunks/json-elements-DKSqpNW1.js.map +0 -1
package/dist/gexf.js
CHANGED
|
@@ -1,274 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Z as ImportReportBuilder, E as EMPTY_INPUT_CODE, X as XML_NESTING_CODE, v as XML_SYNTAX_CODE, b as STRAY_TEXT_CODE, N as NO_GRAPH_CODE, d as UNKNOWN_XML_ATTRIBUTE_CODE, h as MULTIPLE_GRAPHS_CODE, f as COUNT_MISMATCH_CODE, g as COUNT_HINT_CODE, k as DUPLICATE_ATTRIBUTE_CODE, n as MISSING_ID_CODE, j as DUPLICATE_NODE_CODE, l as UNKNOWN_PARENT_CODE, a6 as PARENT_CYCLE_CODE, m as MISSING_ENDPOINT_CODE, i as DUPLICATE_EDGE_ID_CODE, P as PRECISION_CODE, Y as BAD_VALUE_CODE, c as UNKNOWN_ELEMENT_CODE, I as ID_MERGED_CODE, $ as formatF32, a0 as formatF64, ad as formatInteger, p as plural, V as agree, M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, a as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, ae as BAD_OPTIONS_CODE, B as BAD_DEFAULT_CODE, U as UNKNOWN_ATTR_TYPE_CODE, q as ENCODING_CONFLICT_CODE, r as UNKNOWN_ENCODING_CODE, s as ENCODING_FALLBACK_CODE, t as INVALID_ENCODING_CODE, u as INVALID_UTF8_CODE, w as COLUMN_TYPE_CODE, x as ELEMENT_ISSUE, y as INPUT_ISSUE } from "./chunks/format-GDmO6m6Q.js";
|
|
2
2
|
import { GraphFormatError, INVALID_INDEX, MAX_COUNT } from "@graphty/graph-format";
|
|
3
|
-
import {
|
|
3
|
+
import { g as resolveImportOptions, j as reportSinkOptions, i as reportUnusedOptions, t as textChunks, h as throwIfAborted, I as IdCoercer, l as DirectionResolver, o as isWeightField, q as declareAttribute, d as declareResolved, s as parseWeightText, v as overflowsToInfinity, x as parseDeclaredTemporal, y as declareCompanion, z as parseDeclaredValue, A as losesPrecision, B as parseTimeText, C as splitListText, E as timeTextCompanion, F as parseDecimalText, c as capabilities, L as LOSS, G as sanitizeIds, p as pairFolding, e as explicitWeights, r as resolveExportOptions, a as checkCapabilities, H as formatTimeValue, J as mapDeclaredType, K as joinListText, N as formatTemporal, O as isCanonicalIntegerText } from "./chunks/export-D7IGzTG4.js";
|
|
4
|
+
import { t as tokenizeXml, b as xmlDeclaredEncoding, X as XmlEmptyInputError, c as XmlSyntaxError, d as XmlNestingError, s as sniffXmlText, l as localName, i as isWhitespace, x as xmlIllegalTextNotes, a as escapeXmlText, e as escapeXmlAttribute } from "./chunks/escape-B1rMftd9.js";
|
|
5
|
+
import { t as MAX_STYLE_BLOCK_LENGTH } from "./chunks/block-JQiwViEt.js";
|
|
6
|
+
import { g as gexfStyles, G as GEXF_FORMAT, N as NODE_DECLS, E as EDGE_DECLS, a as GRAPHTY_XML_NAMESPACE, b as GRAPH_MODES, T as TIME_FORMATS, c as TIME_REPRESENTATIONS, t as temporalTableName, d as temporalTableDecls, e as canonVizColor, O as OPEN_START, f as OPEN_END, R as RESERVED_NODE_NAMES, h as RESERVED_EDGE_NAMES, i as gexfStyledExport, j as GEXF_STYLE_CAPABILITIES, k as GEXF_NAMESPACES, p as parseTemporalTableName, l as TEMPORAL_COLUMNS, m as NODE_COLUMNS, V as VIZ_NAMESPACE, n as isListType, o as canonicalScalarType, q as isScalarType } from "./chunks/styles-Brt9JMfs.js";
|
|
4
7
|
import { j as joinText, e as encodeChunks } from "./chunks/writer-DxjgHwSe.js";
|
|
5
|
-
const GEXF_FORMAT = "gexf";
|
|
6
|
-
const GEXF_NAMESPACES = {
|
|
7
|
-
"1.2": { gexf: "http://www.gexf.net/1.2draft", viz: "http://www.gexf.net/1.2draft/viz" },
|
|
8
|
-
"1.3": { gexf: "http://gexf.net/1.3", viz: "http://gexf.net/1.3/viz" }
|
|
9
|
-
};
|
|
10
|
-
const TIME_FORMATS = /* @__PURE__ */ new Set(["integer", "double", "date", "dateTime"]);
|
|
11
|
-
const GRAPH_MODES = /* @__PURE__ */ new Set(["static", "dynamic", "slice"]);
|
|
12
|
-
const TIME_REPRESENTATIONS = /* @__PURE__ */ new Set(["interval", "timestamp"]);
|
|
13
|
-
const VIZ_NAMESPACE = "viz";
|
|
14
|
-
const XML_ORIGIN = { format: GEXF_FORMAT };
|
|
15
|
-
const VIZ_ORIGIN = { format: GEXF_FORMAT, namespace: VIZ_NAMESPACE };
|
|
16
|
-
const NODE_COLUMNS = Object.freeze({
|
|
17
|
-
label: "label",
|
|
18
|
-
parent: "parent",
|
|
19
|
-
parents: "parents",
|
|
20
|
-
start: "start",
|
|
21
|
-
end: "end",
|
|
22
|
-
timestamp: "timestamp",
|
|
23
|
-
spells: "spells",
|
|
24
|
-
spellsOpen: "spells.open",
|
|
25
|
-
timestamps: "timestamps",
|
|
26
|
-
open: "open",
|
|
27
|
-
position: "position",
|
|
28
|
-
color: "color",
|
|
29
|
-
size: "size",
|
|
30
|
-
shape: "shape",
|
|
31
|
-
shapeUri: "shape.uri"
|
|
32
|
-
});
|
|
33
|
-
const EDGE_COLUMNS = Object.freeze({
|
|
34
|
-
id: "id",
|
|
35
|
-
label: "label",
|
|
36
|
-
kind: "kind",
|
|
37
|
-
start: "start",
|
|
38
|
-
end: "end",
|
|
39
|
-
timestamp: "timestamp",
|
|
40
|
-
spells: "spells",
|
|
41
|
-
spellsOpen: "spells.open",
|
|
42
|
-
timestamps: "timestamps",
|
|
43
|
-
open: "open",
|
|
44
|
-
color: "color",
|
|
45
|
-
thickness: "thickness",
|
|
46
|
-
shape: "shape"
|
|
47
|
-
});
|
|
48
|
-
const RESERVED_NODE_NAMES = /* @__PURE__ */ new Set([
|
|
49
|
-
...Object.values(NODE_COLUMNS),
|
|
50
|
-
NODE_COLUMNS.start + TIME_TEXT_SUFFIX,
|
|
51
|
-
NODE_COLUMNS.end + TIME_TEXT_SUFFIX,
|
|
52
|
-
NODE_COLUMNS.timestamp + TIME_TEXT_SUFFIX
|
|
53
|
-
]);
|
|
54
|
-
const RESERVED_EDGE_NAMES = /* @__PURE__ */ new Set([
|
|
55
|
-
...Object.values(EDGE_COLUMNS),
|
|
56
|
-
EDGE_COLUMNS.start + TIME_TEXT_SUFFIX,
|
|
57
|
-
EDGE_COLUMNS.end + TIME_TEXT_SUFFIX,
|
|
58
|
-
EDGE_COLUMNS.timestamp + TIME_TEXT_SUFFIX
|
|
59
|
-
]);
|
|
60
|
-
const NODE_DECLS = {
|
|
61
|
-
label: { name: NODE_COLUMNS.label, dtype: "string", role: "label", nullable: true, origin: XML_ORIGIN },
|
|
62
|
-
parent: {
|
|
63
|
-
name: NODE_COLUMNS.parent,
|
|
64
|
-
dtype: "u32",
|
|
65
|
-
role: "parent",
|
|
66
|
-
refersTo: "node",
|
|
67
|
-
nullable: true,
|
|
68
|
-
origin: XML_ORIGIN
|
|
69
|
-
},
|
|
70
|
-
parents: {
|
|
71
|
-
name: NODE_COLUMNS.parents,
|
|
72
|
-
dtype: "list",
|
|
73
|
-
itemDtype: "u32",
|
|
74
|
-
role: "parents",
|
|
75
|
-
refersTo: "node",
|
|
76
|
-
nullable: true,
|
|
77
|
-
origin: XML_ORIGIN
|
|
78
|
-
},
|
|
79
|
-
start: { name: NODE_COLUMNS.start, dtype: "f64", role: "start", nullable: true, origin: XML_ORIGIN },
|
|
80
|
-
end: { name: NODE_COLUMNS.end, dtype: "f64", role: "end", nullable: true, origin: XML_ORIGIN },
|
|
81
|
-
timestamp: { name: NODE_COLUMNS.timestamp, dtype: "f64", role: "timestamp", nullable: true, origin: XML_ORIGIN },
|
|
82
|
-
spells: {
|
|
83
|
-
name: NODE_COLUMNS.spells,
|
|
84
|
-
dtype: "list",
|
|
85
|
-
itemDtype: "f64",
|
|
86
|
-
itemComponents: 2,
|
|
87
|
-
role: "spells",
|
|
88
|
-
nullable: true,
|
|
89
|
-
origin: XML_ORIGIN
|
|
90
|
-
},
|
|
91
|
-
timestamps: {
|
|
92
|
-
name: NODE_COLUMNS.timestamps,
|
|
93
|
-
dtype: "list",
|
|
94
|
-
itemDtype: "f64",
|
|
95
|
-
role: "timestamps",
|
|
96
|
-
nullable: true,
|
|
97
|
-
origin: XML_ORIGIN
|
|
98
|
-
},
|
|
99
|
-
open: { name: NODE_COLUMNS.open, dtype: "u8", role: "open", nullable: true, origin: XML_ORIGIN },
|
|
100
|
-
spellsOpen: {
|
|
101
|
-
name: NODE_COLUMNS.spellsOpen,
|
|
102
|
-
dtype: "list",
|
|
103
|
-
itemDtype: "u8",
|
|
104
|
-
role: "spellsOpen",
|
|
105
|
-
nullable: true,
|
|
106
|
-
origin: XML_ORIGIN
|
|
107
|
-
},
|
|
108
|
-
position: {
|
|
109
|
-
name: NODE_COLUMNS.position,
|
|
110
|
-
dtype: "f64",
|
|
111
|
-
components: 3,
|
|
112
|
-
role: "position",
|
|
113
|
-
mutable: true,
|
|
114
|
-
nullable: true,
|
|
115
|
-
origin: VIZ_ORIGIN,
|
|
116
|
-
extra: { units: "file" }
|
|
117
|
-
},
|
|
118
|
-
color: {
|
|
119
|
-
name: NODE_COLUMNS.color,
|
|
120
|
-
dtype: "f32",
|
|
121
|
-
components: 4,
|
|
122
|
-
role: "color",
|
|
123
|
-
nullable: true,
|
|
124
|
-
origin: VIZ_ORIGIN
|
|
125
|
-
},
|
|
126
|
-
size: { name: NODE_COLUMNS.size, dtype: "f32", role: "size", nullable: true, origin: VIZ_ORIGIN },
|
|
127
|
-
shape: { name: NODE_COLUMNS.shape, dtype: "dict", role: "shape", nullable: true, origin: VIZ_ORIGIN },
|
|
128
|
-
shapeUri: { name: NODE_COLUMNS.shapeUri, dtype: "string", nullable: true, origin: VIZ_ORIGIN }
|
|
129
|
-
};
|
|
130
|
-
const EDGE_DECLS = {
|
|
131
|
-
id: { name: EDGE_COLUMNS.id, dtype: "string", role: "id", unique: true, nullable: true, origin: XML_ORIGIN },
|
|
132
|
-
label: { name: EDGE_COLUMNS.label, dtype: "string", role: "label", nullable: true, origin: XML_ORIGIN },
|
|
133
|
-
kind: { name: EDGE_COLUMNS.kind, dtype: "dict", role: "kind", nullable: true, origin: XML_ORIGIN },
|
|
134
|
-
start: { name: EDGE_COLUMNS.start, dtype: "f64", role: "start", nullable: true, origin: XML_ORIGIN },
|
|
135
|
-
end: { name: EDGE_COLUMNS.end, dtype: "f64", role: "end", nullable: true, origin: XML_ORIGIN },
|
|
136
|
-
timestamp: { name: EDGE_COLUMNS.timestamp, dtype: "f64", role: "timestamp", nullable: true, origin: XML_ORIGIN },
|
|
137
|
-
spells: {
|
|
138
|
-
name: EDGE_COLUMNS.spells,
|
|
139
|
-
dtype: "list",
|
|
140
|
-
itemDtype: "f64",
|
|
141
|
-
itemComponents: 2,
|
|
142
|
-
role: "spells",
|
|
143
|
-
nullable: true,
|
|
144
|
-
origin: XML_ORIGIN
|
|
145
|
-
},
|
|
146
|
-
timestamps: {
|
|
147
|
-
name: EDGE_COLUMNS.timestamps,
|
|
148
|
-
dtype: "list",
|
|
149
|
-
itemDtype: "f64",
|
|
150
|
-
role: "timestamps",
|
|
151
|
-
nullable: true,
|
|
152
|
-
origin: XML_ORIGIN
|
|
153
|
-
},
|
|
154
|
-
open: { name: EDGE_COLUMNS.open, dtype: "u8", role: "open", nullable: true, origin: XML_ORIGIN },
|
|
155
|
-
spellsOpen: {
|
|
156
|
-
name: EDGE_COLUMNS.spellsOpen,
|
|
157
|
-
dtype: "list",
|
|
158
|
-
itemDtype: "u8",
|
|
159
|
-
role: "spellsOpen",
|
|
160
|
-
nullable: true,
|
|
161
|
-
origin: XML_ORIGIN
|
|
162
|
-
},
|
|
163
|
-
color: {
|
|
164
|
-
name: EDGE_COLUMNS.color,
|
|
165
|
-
dtype: "f32",
|
|
166
|
-
components: 4,
|
|
167
|
-
role: "color",
|
|
168
|
-
nullable: true,
|
|
169
|
-
origin: VIZ_ORIGIN
|
|
170
|
-
},
|
|
171
|
-
thickness: { name: EDGE_COLUMNS.thickness, dtype: "f32", role: "thickness", nullable: true, origin: VIZ_ORIGIN },
|
|
172
|
-
shape: { name: EDGE_COLUMNS.shape, dtype: "dict", role: "shape", nullable: true, origin: VIZ_ORIGIN }
|
|
173
|
-
};
|
|
174
|
-
const OPEN_START = 1;
|
|
175
|
-
const OPEN_END = 2;
|
|
176
|
-
const TEMPORAL_TABLE_PREFIX = "temporal:";
|
|
177
|
-
const TEMPORAL_COLUMNS = Object.freeze({
|
|
178
|
-
element: "element",
|
|
179
|
-
start: "start",
|
|
180
|
-
end: "end",
|
|
181
|
-
value: "value",
|
|
182
|
-
open: "open",
|
|
183
|
-
startText: `start${TIME_TEXT_SUFFIX}`,
|
|
184
|
-
endText: `end${TIME_TEXT_SUFFIX}`,
|
|
185
|
-
valueText: `value${TIME_TEXT_SUFFIX}`
|
|
186
|
-
});
|
|
187
|
-
function temporalTableName(domain, column) {
|
|
188
|
-
return `${TEMPORAL_TABLE_PREFIX}${domain}:${column}`;
|
|
189
|
-
}
|
|
190
|
-
function parseTemporalTableName(name) {
|
|
191
|
-
if (!name.startsWith(TEMPORAL_TABLE_PREFIX)) {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
const rest = name.slice(TEMPORAL_TABLE_PREFIX.length);
|
|
195
|
-
const colon = rest.indexOf(":");
|
|
196
|
-
if (colon < 0) {
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
const domain = rest.slice(0, colon);
|
|
200
|
-
if (domain !== "node" && domain !== "edge") {
|
|
201
|
-
return null;
|
|
202
|
-
}
|
|
203
|
-
return { domain, column: rest.slice(colon + 1) };
|
|
204
|
-
}
|
|
205
|
-
function temporalTableDecls(domain, value, temporalValue) {
|
|
206
|
-
const decls = [
|
|
207
|
-
{ name: TEMPORAL_COLUMNS.element, dtype: "u32", refersTo: domain, nullable: false },
|
|
208
|
-
{ name: TEMPORAL_COLUMNS.start, dtype: "f64", role: "start", nullable: true },
|
|
209
|
-
{ name: TEMPORAL_COLUMNS.end, dtype: "f64", role: "end", nullable: true },
|
|
210
|
-
{ name: TEMPORAL_COLUMNS.value, ...value, nullable: true },
|
|
211
|
-
{
|
|
212
|
-
name: TEMPORAL_COLUMNS.startText,
|
|
213
|
-
dtype: "string",
|
|
214
|
-
role: TIME_TEXT_ROLE,
|
|
215
|
-
nullable: true,
|
|
216
|
-
extra: { for: TEMPORAL_COLUMNS.start }
|
|
217
|
-
},
|
|
218
|
-
{ name: TEMPORAL_COLUMNS.endText, dtype: "string", nullable: true, extra: { for: TEMPORAL_COLUMNS.end } },
|
|
219
|
-
{ name: TEMPORAL_COLUMNS.open, dtype: "u8", role: "open", nullable: true }
|
|
220
|
-
];
|
|
221
|
-
if (temporalValue) {
|
|
222
|
-
decls.push({
|
|
223
|
-
name: TEMPORAL_COLUMNS.valueText,
|
|
224
|
-
dtype: "string",
|
|
225
|
-
nullable: true,
|
|
226
|
-
extra: { for: TEMPORAL_COLUMNS.value }
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
return decls;
|
|
230
|
-
}
|
|
231
|
-
const TYPES_1_2 = /* @__PURE__ */ new Set(["integer", "long", "double", "float", "boolean", "string", "anyURI"]);
|
|
232
|
-
const TYPES_1_3 = /* @__PURE__ */ new Set([
|
|
233
|
-
...TYPES_1_2,
|
|
234
|
-
"bigdecimal",
|
|
235
|
-
"biginteger",
|
|
236
|
-
"byte",
|
|
237
|
-
"char",
|
|
238
|
-
"short",
|
|
239
|
-
"date",
|
|
240
|
-
"dateTime"
|
|
241
|
-
]);
|
|
242
|
-
function isScalarType(type, version) {
|
|
243
|
-
return (version === "1.2" ? TYPES_1_2 : TYPES_1_3).has(type);
|
|
244
|
-
}
|
|
245
|
-
function isListType(type, version) {
|
|
246
|
-
return type.startsWith("list") && type.length > 4 && isScalarType(type.slice(4), "1.3");
|
|
247
|
-
}
|
|
248
|
-
function canonicalScalarType(dtype) {
|
|
249
|
-
switch (dtype) {
|
|
250
|
-
case "bool":
|
|
251
|
-
return "boolean";
|
|
252
|
-
case "i32":
|
|
253
|
-
case "u8":
|
|
254
|
-
return "integer";
|
|
255
|
-
case "u32":
|
|
256
|
-
return "long";
|
|
257
|
-
case "f32":
|
|
258
|
-
return "float";
|
|
259
|
-
case "f64":
|
|
260
|
-
return "double";
|
|
261
|
-
case "dict":
|
|
262
|
-
case "string":
|
|
263
|
-
case "json":
|
|
264
|
-
case "list":
|
|
265
|
-
return "string";
|
|
266
|
-
default: {
|
|
267
|
-
const name = dtype;
|
|
268
|
-
return name;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
8
|
const NOT_GEXF_CODE = "E_NOT_GEXF";
|
|
273
9
|
const MISSING_NODES_CODE = "E_GEXF_MISSING_NODES";
|
|
274
10
|
const EDGE_TYPE_CODE = "E_GEXF_EDGE_TYPE";
|
|
@@ -281,6 +17,7 @@ const ATTVALUE_SHAPE_CODE = "W_GEXF_ATTVALUE_SHAPE";
|
|
|
281
17
|
const TIMED_STATIC_CODE = "W_GEXF_TIMED_VALUE_ON_STATIC";
|
|
282
18
|
const WEIGHT_IGNORED_CODE = "W_GEXF_WEIGHT_IGNORED";
|
|
283
19
|
const VIZ_SKIPPED_CODE = "W_GEXF_VIZ_SKIPPED";
|
|
20
|
+
const UNKNOWN_PID_CODE = "W_GEXF_UNKNOWN_PID";
|
|
284
21
|
const VIZ_DYNAMIC_CODE = "W_GEXF_VIZ_DYNAMIC_DROPPED";
|
|
285
22
|
const SPELL_OPEN_CODE = "W_GEXF_SPELL_OPEN_DROPPED";
|
|
286
23
|
const VIZ_VALUE_CODE = "W_GEXF_VIZ_VALUE";
|
|
@@ -289,6 +26,9 @@ const TIMESTAMP_CONFLICT_CODE = "W_GEXF_TIMESTAMP_CONFLICT";
|
|
|
289
26
|
const VALUE_OUTSIDE_OPTIONS_CODE = "W_GEXF_VALUE_OUTSIDE_OPTIONS";
|
|
290
27
|
const VERSIONS = /* @__PURE__ */ new Set(["1.0", "1.1", "1.2", "1.3"]);
|
|
291
28
|
function namespaceVersion(ns) {
|
|
29
|
+
if (ns !== null && /gephi\.org\/gexf\/?$/.test(ns)) {
|
|
30
|
+
return "1.0";
|
|
31
|
+
}
|
|
292
32
|
const match = ns === null ? null : /gexf\.net\/(1\.[0-3])/.exec(ns);
|
|
293
33
|
return match === null ? null : match[1];
|
|
294
34
|
}
|
|
@@ -335,8 +75,14 @@ function isDateText(text) {
|
|
|
335
75
|
}
|
|
336
76
|
const EDGE_TYPES = /* @__PURE__ */ new Set(["directed", "undirected", "mutual"]);
|
|
337
77
|
function edgeTypeKeyword(text) {
|
|
338
|
-
|
|
78
|
+
const keyword = text.trim().toLowerCase();
|
|
79
|
+
return EDGE_TYPE_ALIASES.get(keyword) ?? keyword;
|
|
339
80
|
}
|
|
81
|
+
const EDGE_TYPE_ALIASES = /* @__PURE__ */ new Map([
|
|
82
|
+
["dir", "directed"],
|
|
83
|
+
["undir", "undirected"],
|
|
84
|
+
["double", "mutual"]
|
|
85
|
+
]);
|
|
340
86
|
const ABORT_CHECK_INTERVAL = 64;
|
|
341
87
|
const NODE_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
342
88
|
"id",
|
|
@@ -472,6 +218,9 @@ class GexfReader {
|
|
|
472
218
|
this.meta = { sourceFormat: GEXF_FORMAT };
|
|
473
219
|
this.metaText = "";
|
|
474
220
|
this.metaField = null;
|
|
221
|
+
this.styleBlock = "";
|
|
222
|
+
this.implicitNodes = /* @__PURE__ */ new Map();
|
|
223
|
+
this.edgesFirst = false;
|
|
475
224
|
this.nodeAttrs = /* @__PURE__ */ new Map();
|
|
476
225
|
this.edgeAttrs = /* @__PURE__ */ new Map();
|
|
477
226
|
this.declaredNodeNames = /* @__PURE__ */ new Set();
|
|
@@ -548,7 +297,7 @@ class GexfReader {
|
|
|
548
297
|
start(name, attrs, line, ns = "") {
|
|
549
298
|
const parent = this.ctx.at(-1) ?? null;
|
|
550
299
|
const local = localName(name);
|
|
551
|
-
if (ns === null && parent !== null && parent !== 14 && parent !== 2 && parent !== 6 && !name.startsWith("viz:")) {
|
|
300
|
+
if (ns === null && parent !== null && parent !== 14 && parent !== 2 && parent !== 6 && parent !== 15 && !name.startsWith("viz:")) {
|
|
552
301
|
this.unknownElement(name, line);
|
|
553
302
|
return;
|
|
554
303
|
}
|
|
@@ -568,7 +317,7 @@ class GexfReader {
|
|
|
568
317
|
this.startInGexf(name, local, attrs, line);
|
|
569
318
|
return;
|
|
570
319
|
case 1:
|
|
571
|
-
this.startInMeta(name, local, line);
|
|
320
|
+
this.startInMeta(name, local, line, ns);
|
|
572
321
|
return;
|
|
573
322
|
case 3:
|
|
574
323
|
this.startInGraph(name, local, attrs, line);
|
|
@@ -602,6 +351,7 @@ class GexfReader {
|
|
|
602
351
|
return;
|
|
603
352
|
case 2:
|
|
604
353
|
case 6:
|
|
354
|
+
case 15:
|
|
605
355
|
case 14:
|
|
606
356
|
this.ctx.push(
|
|
607
357
|
14
|
|
@@ -626,8 +376,21 @@ class GexfReader {
|
|
|
626
376
|
case 2:
|
|
627
377
|
this.finishMetaText();
|
|
628
378
|
return;
|
|
379
|
+
case 15:
|
|
380
|
+
this.report.keepForStyles(this.styleBlock);
|
|
381
|
+
this.styleBlock = "";
|
|
382
|
+
return;
|
|
629
383
|
case 3:
|
|
630
384
|
this.resolveParents();
|
|
385
|
+
if (!this.nodesSeen && this.implicitNodes.size > 0) {
|
|
386
|
+
this.report.error(
|
|
387
|
+
"validation-error",
|
|
388
|
+
MISSING_NODES_CODE,
|
|
389
|
+
"the graph declares <edges> but no <nodes>"
|
|
390
|
+
);
|
|
391
|
+
} else if (!this.options.addMissingNodes) {
|
|
392
|
+
this.dropUndeclaredNodes();
|
|
393
|
+
}
|
|
631
394
|
return;
|
|
632
395
|
case 4:
|
|
633
396
|
this.attributeGroup = null;
|
|
@@ -680,6 +443,11 @@ class GexfReader {
|
|
|
680
443
|
case 6:
|
|
681
444
|
this.attributeTextValue += text;
|
|
682
445
|
return;
|
|
446
|
+
case 15:
|
|
447
|
+
if (this.styleBlock.length <= MAX_STYLE_BLOCK_LENGTH) {
|
|
448
|
+
this.styleBlock += text.slice(0, MAX_STYLE_BLOCK_LENGTH + 1 - this.styleBlock.length);
|
|
449
|
+
}
|
|
450
|
+
return;
|
|
683
451
|
case 14:
|
|
684
452
|
return;
|
|
685
453
|
default:
|
|
@@ -792,8 +560,17 @@ class GexfReader {
|
|
|
792
560
|
* @param name - the element name
|
|
793
561
|
* @param local - its local name
|
|
794
562
|
* @param line - the line
|
|
563
|
+
* @param ns - its namespace
|
|
795
564
|
*/
|
|
796
|
-
startInMeta(name, local, line) {
|
|
565
|
+
startInMeta(name, local, line, ns) {
|
|
566
|
+
if (ns === GRAPHTY_XML_NAMESPACE && local === "styles") {
|
|
567
|
+
this.styleBlock = "";
|
|
568
|
+
this.ctx.push(
|
|
569
|
+
15
|
|
570
|
+
/* StyleBlock */
|
|
571
|
+
);
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
797
574
|
if (local === "creator" || local === "description" || local === "keywords") {
|
|
798
575
|
this.metaField = local;
|
|
799
576
|
this.metaText = "";
|
|
@@ -926,7 +703,9 @@ class GexfReader {
|
|
|
926
703
|
this.beginSection(attrs, "node", line);
|
|
927
704
|
return;
|
|
928
705
|
case "edges":
|
|
929
|
-
if (!this.nodesSeen) {
|
|
706
|
+
if (!this.nodesSeen && this.meta.sourceVersion === "1.0") {
|
|
707
|
+
this.edgesFirst = true;
|
|
708
|
+
} else if (!this.nodesSeen) {
|
|
930
709
|
this.report.error(
|
|
931
710
|
"validation-error",
|
|
932
711
|
MISSING_NODES_CODE,
|
|
@@ -1319,7 +1098,9 @@ class GexfReader {
|
|
|
1319
1098
|
try {
|
|
1320
1099
|
const id = this.coerceId(idText, where);
|
|
1321
1100
|
const existing = sink.indexOf(id);
|
|
1322
|
-
if (existing !== INVALID_INDEX) {
|
|
1101
|
+
if (existing !== INVALID_INDEX && this.implicitNodes.delete(existing)) {
|
|
1102
|
+
index = existing;
|
|
1103
|
+
} else if (existing !== INVALID_INDEX) {
|
|
1323
1104
|
report.warning(
|
|
1324
1105
|
"validation-error",
|
|
1325
1106
|
DUPLICATE_NODE_CODE,
|
|
@@ -1519,20 +1300,8 @@ class GexfReader {
|
|
|
1519
1300
|
return false;
|
|
1520
1301
|
};
|
|
1521
1302
|
for (const ref of refs) {
|
|
1522
|
-
|
|
1523
|
-
if (ref.
|
|
1524
|
-
parent = sink.indexOf(ref.parentId);
|
|
1525
|
-
if (parent === INVALID_INDEX) {
|
|
1526
|
-
report.error(
|
|
1527
|
-
"missing-value",
|
|
1528
|
-
UNKNOWN_PARENT_CODE,
|
|
1529
|
-
`pid "${String(ref.parentId)}" names a node the document does not declare`,
|
|
1530
|
-
ref.where
|
|
1531
|
-
);
|
|
1532
|
-
continue;
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
if (parentOf.get(ref.child) === parent) {
|
|
1303
|
+
const parent = this.parentIndexOf(ref);
|
|
1304
|
+
if (parent === null || parentOf.get(ref.child) === parent) {
|
|
1536
1305
|
continue;
|
|
1537
1306
|
}
|
|
1538
1307
|
if (isAncestorOrSelf(ref.child, parent)) {
|
|
@@ -1558,27 +1327,64 @@ class GexfReader {
|
|
|
1558
1327
|
* @param lists - the queued `<parents>` lists
|
|
1559
1328
|
*/
|
|
1560
1329
|
resolveParentsLists(lists) {
|
|
1561
|
-
const { sink, report } = this;
|
|
1562
1330
|
for (const ref of lists) {
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1331
|
+
this.resolveParentsList(ref);
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
/**
|
|
1335
|
+
* The parent a `pid` or a nesting names.
|
|
1336
|
+
* @param ref - the reference
|
|
1337
|
+
* @returns its index, or null when the id names no node (reported)
|
|
1338
|
+
*/
|
|
1339
|
+
parentIndexOf(ref) {
|
|
1340
|
+
if (ref.parentId === null) {
|
|
1341
|
+
return ref.parentIndex;
|
|
1342
|
+
}
|
|
1343
|
+
const parent = this.sink.indexOf(ref.parentId);
|
|
1344
|
+
if (parent !== INVALID_INDEX) {
|
|
1345
|
+
return parent;
|
|
1346
|
+
}
|
|
1347
|
+
if (this.meta.sourceVersion === "1.0") {
|
|
1348
|
+
this.report.warnOnce(
|
|
1349
|
+
"missing-value",
|
|
1350
|
+
UNKNOWN_PID_CODE,
|
|
1351
|
+
`pid "${String(ref.parentId)}" names no node; GEXF 1.0 files write it on top-level nodes, which stay top-level`,
|
|
1352
|
+
ref.where
|
|
1353
|
+
);
|
|
1354
|
+
} else {
|
|
1355
|
+
this.report.error(
|
|
1356
|
+
"missing-value",
|
|
1357
|
+
UNKNOWN_PARENT_CODE,
|
|
1358
|
+
`pid "${String(ref.parentId)}" names a node the document does not declare`,
|
|
1359
|
+
ref.where
|
|
1360
|
+
);
|
|
1361
|
+
}
|
|
1362
|
+
return null;
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Resolve one `<parents>` list; an id that names no node is reported and left out.
|
|
1366
|
+
* @param ref - the list
|
|
1367
|
+
*/
|
|
1368
|
+
resolveParentsList(ref) {
|
|
1369
|
+
const { sink, report } = this;
|
|
1370
|
+
const indices = [];
|
|
1371
|
+
for (const id of ref.ids) {
|
|
1372
|
+
const parent = sink.indexOf(id);
|
|
1373
|
+
if (parent === INVALID_INDEX) {
|
|
1374
|
+
report.error(
|
|
1375
|
+
"missing-value",
|
|
1376
|
+
UNKNOWN_PARENT_CODE,
|
|
1377
|
+
`<parent for="${String(id)}"> names a node the document does not declare`,
|
|
1378
|
+
ref.where
|
|
1379
|
+
);
|
|
1380
|
+
continue;
|
|
1581
1381
|
}
|
|
1382
|
+
indices.push(parent);
|
|
1383
|
+
}
|
|
1384
|
+
try {
|
|
1385
|
+
this.parentsColumn.set(sink, report, ref.child, indices, ref.where);
|
|
1386
|
+
} catch (err) {
|
|
1387
|
+
report.recordError(err, ref.where);
|
|
1582
1388
|
}
|
|
1583
1389
|
}
|
|
1584
1390
|
// ---------------------------------------------------------------- edges
|
|
@@ -1627,21 +1433,10 @@ class GexfReader {
|
|
|
1627
1433
|
report.counts.skippedEdges++;
|
|
1628
1434
|
return;
|
|
1629
1435
|
}
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
if (!EDGE_TYPES.has(type)) {
|
|
1635
|
-
report.error(
|
|
1636
|
-
"validation-error",
|
|
1637
|
-
EDGE_TYPE_CODE,
|
|
1638
|
-
`edge type "${typeText}" is not directed, undirected or mutual`,
|
|
1639
|
-
where
|
|
1640
|
-
);
|
|
1641
|
-
report.counts.skippedEdges++;
|
|
1642
|
-
return;
|
|
1643
|
-
}
|
|
1644
|
-
kind = type;
|
|
1436
|
+
const kind = this.edgeKindOf(attrs, where);
|
|
1437
|
+
if (kind === null) {
|
|
1438
|
+
report.counts.skippedEdges++;
|
|
1439
|
+
return;
|
|
1645
1440
|
}
|
|
1646
1441
|
if (idText !== void 0 && this.edgeIds.has(idText)) {
|
|
1647
1442
|
report.error(
|
|
@@ -1655,9 +1450,7 @@ class GexfReader {
|
|
|
1655
1450
|
}
|
|
1656
1451
|
let index;
|
|
1657
1452
|
try {
|
|
1658
|
-
const source = this.
|
|
1659
|
-
const target = this.coerceId(targetText, where);
|
|
1660
|
-
this.requireDeclaredEndpoints(source, target, sourceText, targetText);
|
|
1453
|
+
const [source, target] = this.endpoints(sourceText, targetText, where);
|
|
1661
1454
|
const weight = this.xmlWeight(attrs, where);
|
|
1662
1455
|
const before = sink.edgeCount;
|
|
1663
1456
|
index = this.resolver.addEdge(source, target, kind, weight, where);
|
|
@@ -1675,40 +1468,68 @@ class GexfReader {
|
|
|
1675
1468
|
frame.mirror = this.resolver.lastMirror;
|
|
1676
1469
|
frame.xmlWeight = attrs.get("weight") ?? null;
|
|
1677
1470
|
this.edge = frame;
|
|
1678
|
-
this.
|
|
1471
|
+
this.writeEdgeAttributes(attrs, index, where);
|
|
1679
1472
|
}
|
|
1680
1473
|
/**
|
|
1681
|
-
*
|
|
1682
|
-
* @param
|
|
1683
|
-
* @param
|
|
1684
|
-
* @
|
|
1685
|
-
* @param targetText - the target as written
|
|
1474
|
+
* The kind of an `<edge>`: its `type`, else the graph's default.
|
|
1475
|
+
* @param attrs - its attributes
|
|
1476
|
+
* @param where - where it was read
|
|
1477
|
+
* @returns the kind, or null for a type GEXF does not have (reported)
|
|
1686
1478
|
*/
|
|
1687
|
-
|
|
1688
|
-
const
|
|
1689
|
-
if (
|
|
1690
|
-
return;
|
|
1479
|
+
edgeKindOf(attrs, where) {
|
|
1480
|
+
const typeText = attrs.get("type");
|
|
1481
|
+
if (typeText === void 0) {
|
|
1482
|
+
return this.defaultKind;
|
|
1691
1483
|
}
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1484
|
+
const type = edgeTypeKeyword(typeText);
|
|
1485
|
+
if (!EDGE_TYPES.has(type)) {
|
|
1486
|
+
this.report.error(
|
|
1487
|
+
"validation-error",
|
|
1488
|
+
EDGE_TYPE_CODE,
|
|
1489
|
+
`edge type "${typeText}" is not directed, undirected or mutual`,
|
|
1490
|
+
where
|
|
1491
|
+
);
|
|
1492
|
+
return null;
|
|
1696
1493
|
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1494
|
+
return type;
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* An edge's endpoints: in GEXF 1.0 with its edges first, a node no `<node>` declared yet is added for now; without
|
|
1498
|
+
* addMissingNodes, a node the document does not declare throws E_UNKNOWN_NODE.
|
|
1499
|
+
* @param sourceText - the source's id text
|
|
1500
|
+
* @param targetText - the target's id text
|
|
1501
|
+
* @param where - where it was read
|
|
1502
|
+
* @returns the ids
|
|
1503
|
+
*/
|
|
1504
|
+
endpoints(sourceText, targetText, where) {
|
|
1505
|
+
const { sink } = this;
|
|
1506
|
+
const ends = [this.coerceId(sourceText, where), this.coerceId(targetText, where)];
|
|
1507
|
+
if (this.edgesFirst && !this.nodesSeen) {
|
|
1508
|
+
for (const end of ends) {
|
|
1509
|
+
if (sink.indexOf(end) === INVALID_INDEX) {
|
|
1510
|
+
this.implicitNodes.set(sink.addNode(end), end);
|
|
1511
|
+
this.report.counts.nodes++;
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
const texts = [sourceText, targetText];
|
|
1516
|
+
const unknown = this.options.addMissingNodes ? -1 : ends.findIndex((id) => sink.indexOf(id) === INVALID_INDEX);
|
|
1517
|
+
if (unknown !== -1) {
|
|
1518
|
+
throw new GraphFormatError("E_UNKNOWN_NODE", `edge references undeclared node "${texts[unknown]}"`, {
|
|
1519
|
+
id: ends[unknown]
|
|
1700
1520
|
});
|
|
1701
1521
|
}
|
|
1522
|
+
return ends;
|
|
1702
1523
|
}
|
|
1703
1524
|
/**
|
|
1704
|
-
* Write
|
|
1705
|
-
* @param attrs -
|
|
1706
|
-
* @param index -
|
|
1707
|
-
* @param
|
|
1708
|
-
* @param where - the edge's location
|
|
1525
|
+
* Write an added edge's id, label, kind and lifetime.
|
|
1526
|
+
* @param attrs - its attributes
|
|
1527
|
+
* @param index - its index
|
|
1528
|
+
* @param where - where it was read
|
|
1709
1529
|
*/
|
|
1710
|
-
|
|
1530
|
+
writeEdgeAttributes(attrs, index, where) {
|
|
1711
1531
|
const { report, sink } = this;
|
|
1532
|
+
const idText = attrs.get("id");
|
|
1712
1533
|
try {
|
|
1713
1534
|
if (idText !== void 0) {
|
|
1714
1535
|
this.edgeIdColumn.set(sink, report, index, idText, where);
|
|
@@ -1726,6 +1547,25 @@ class GexfReader {
|
|
|
1726
1547
|
report.recordError(err, where);
|
|
1727
1548
|
}
|
|
1728
1549
|
}
|
|
1550
|
+
/**
|
|
1551
|
+
* GEXF 1.0 with its edges first, addMissingNodes false: a node an edge named that no `<node>` declared is an
|
|
1552
|
+
* unknown node, as it is when the nodes come first. It is reported, and it and its edges are removed when the
|
|
1553
|
+
* sink can remove nodes.
|
|
1554
|
+
*/
|
|
1555
|
+
dropUndeclaredNodes() {
|
|
1556
|
+
const { sink, report } = this;
|
|
1557
|
+
const removable = sink;
|
|
1558
|
+
for (const [index, id] of this.implicitNodes) {
|
|
1559
|
+
report.error("validation-error", "E_UNKNOWN_NODE", `edge references undeclared node "${String(id)}"`);
|
|
1560
|
+
if (typeof removable.removeNodeByIndex === "function") {
|
|
1561
|
+
const edges = removable.removeNodeByIndex(index);
|
|
1562
|
+
report.counts.nodes--;
|
|
1563
|
+
report.counts.edges -= edges.length;
|
|
1564
|
+
report.counts.skippedEdges += edges.length;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
this.implicitNodes.clear();
|
|
1568
|
+
}
|
|
1729
1569
|
/**
|
|
1730
1570
|
* The weight argument of one edge from its `weight` XML attribute; undefined when absent (the
|
|
1731
1571
|
* sink records a defaulted weight, design section 3.7).
|
|
@@ -1853,7 +1693,7 @@ class GexfReader {
|
|
|
1853
1693
|
if (index === INVALID_INDEX) {
|
|
1854
1694
|
return;
|
|
1855
1695
|
}
|
|
1856
|
-
const forId = attrs.get("for");
|
|
1696
|
+
const forId = attrs.get("for") ?? attrs.get("id");
|
|
1857
1697
|
const { valueWhere } = this;
|
|
1858
1698
|
valueWhere.line = line;
|
|
1859
1699
|
valueWhere.element = element;
|
|
@@ -2332,6 +2172,43 @@ class GexfReader {
|
|
|
2332
2172
|
}
|
|
2333
2173
|
}
|
|
2334
2174
|
// ---------------------------------------------------------------- viz
|
|
2175
|
+
/**
|
|
2176
|
+
* Write a `<viz:position>` into the node position column, declared on first use with the
|
|
2177
|
+
* dimensions the element writes.
|
|
2178
|
+
* @param attrs - its attributes
|
|
2179
|
+
* @param index - the node's index
|
|
2180
|
+
* @param where - the element's location
|
|
2181
|
+
*/
|
|
2182
|
+
writeVizPosition(attrs, index, where) {
|
|
2183
|
+
const x = vizNumber(attrs, "x");
|
|
2184
|
+
const y = vizNumber(attrs, "y");
|
|
2185
|
+
const z = attrs.has("z") ? vizNumber(attrs, "z") : 0;
|
|
2186
|
+
this.positionColumn ??= new LazyColumn("node", {
|
|
2187
|
+
...NODE_DECLS.position,
|
|
2188
|
+
extra: { ...NODE_DECLS.position.extra, sourceDims: attrs.has("z") ? 3 : 2 }
|
|
2189
|
+
});
|
|
2190
|
+
this.positionColumn.set(this.sink, this.report, index, [x, y, z], where);
|
|
2191
|
+
}
|
|
2192
|
+
/**
|
|
2193
|
+
* Write a `<viz:shape>` into the shape column, and a node's image `uri` beside it.
|
|
2194
|
+
* @param name - the element name as written
|
|
2195
|
+
* @param attrs - its attributes
|
|
2196
|
+
* @param domain - node or edge
|
|
2197
|
+
* @param index - the element's index
|
|
2198
|
+
* @param where - the element's location
|
|
2199
|
+
*/
|
|
2200
|
+
writeVizShape(name, attrs, domain, index, where) {
|
|
2201
|
+
const value = attrs.get("value");
|
|
2202
|
+
if (value === void 0) {
|
|
2203
|
+
throw new GraphFormatError("E_COLUMN_TYPE", "<viz:shape> without a value", { element: name });
|
|
2204
|
+
}
|
|
2205
|
+
const columns = domain === "node" ? this.nodeColumns : this.edgeColumns;
|
|
2206
|
+
columns.shape.set(this.sink, this.report, index, value, where);
|
|
2207
|
+
const uri = attrs.get("uri");
|
|
2208
|
+
if (domain === "node" && uri !== void 0) {
|
|
2209
|
+
this.shapeUriColumn.set(this.sink, this.report, index, uri, where);
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2335
2212
|
/**
|
|
2336
2213
|
* Write one viz element into its role column; a value that does not parse is a recorded
|
|
2337
2214
|
* warning and the element is skipped.
|
|
@@ -2360,10 +2237,10 @@ class GexfReader {
|
|
|
2360
2237
|
try {
|
|
2361
2238
|
switch (local) {
|
|
2362
2239
|
case "color":
|
|
2363
|
-
columns.color.set(sink, report, index,
|
|
2240
|
+
columns.color.set(sink, report, index, this.vizColor(attrs, name, where), where);
|
|
2364
2241
|
break;
|
|
2365
2242
|
case "position":
|
|
2366
|
-
this.
|
|
2243
|
+
this.writeVizPosition(attrs, index, where);
|
|
2367
2244
|
break;
|
|
2368
2245
|
case "size":
|
|
2369
2246
|
this.sizeColumn.set(sink, report, index, vizNumber(attrs, "value"), where);
|
|
@@ -2372,7 +2249,7 @@ class GexfReader {
|
|
|
2372
2249
|
this.thicknessColumn.set(sink, report, index, vizNumber(attrs, "value"), where);
|
|
2373
2250
|
break;
|
|
2374
2251
|
case "shape":
|
|
2375
|
-
this.
|
|
2252
|
+
this.writeVizShape(name, attrs, domain, index, where);
|
|
2376
2253
|
break;
|
|
2377
2254
|
default:
|
|
2378
2255
|
break;
|
|
@@ -2385,41 +2262,45 @@ class GexfReader {
|
|
|
2385
2262
|
}
|
|
2386
2263
|
}
|
|
2387
2264
|
/**
|
|
2388
|
-
*
|
|
2389
|
-
*
|
|
2390
|
-
*
|
|
2391
|
-
* @param
|
|
2392
|
-
*/
|
|
2393
|
-
writePosition(attrs, index, where) {
|
|
2394
|
-
const x = vizNumber(attrs, "x");
|
|
2395
|
-
const y = vizNumber(attrs, "y");
|
|
2396
|
-
const z = attrs.has("z") ? vizNumber(attrs, "z") : 0;
|
|
2397
|
-
this.positionColumn ??= new LazyColumn("node", {
|
|
2398
|
-
...NODE_DECLS.position,
|
|
2399
|
-
extra: { ...NODE_DECLS.position.extra, sourceDims: attrs.has("z") ? 3 : 2 }
|
|
2400
|
-
});
|
|
2401
|
-
this.positionColumn.set(this.sink, this.report, index, [x, y, z], where);
|
|
2402
|
-
}
|
|
2403
|
-
/**
|
|
2404
|
-
* Write a `<viz:shape>` and, on a node, its `uri`.
|
|
2265
|
+
* `<viz:color r g b a hex>` as rgba in 0..1 (design section 5.5: role color, f32 x4). `hex` is read as
|
|
2266
|
+
* `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`; a channel outside 0..255 or an alpha outside 0..1 is clamped and
|
|
2267
|
+
* reported, as Gephi clamps it.
|
|
2268
|
+
* @param attrs - the element's attributes
|
|
2405
2269
|
* @param name - the element name as written
|
|
2406
|
-
* @param attrs - its attributes
|
|
2407
|
-
* @param domain - node or edge
|
|
2408
|
-
* @param index - the element's index
|
|
2409
2270
|
* @param where - the element's location
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
const
|
|
2414
|
-
|
|
2415
|
-
if (
|
|
2416
|
-
|
|
2271
|
+
* @returns [r, g, b, a]
|
|
2272
|
+
*/
|
|
2273
|
+
vizColor(attrs, name, where) {
|
|
2274
|
+
const hex = attrs.get("hex");
|
|
2275
|
+
let rgba;
|
|
2276
|
+
if (hex !== void 0 && !attrs.has("r")) {
|
|
2277
|
+
const c = canonVizColor(hex);
|
|
2278
|
+
if (c === null) {
|
|
2279
|
+
throw new GraphFormatError(
|
|
2280
|
+
"E_COLUMN_TYPE",
|
|
2281
|
+
`viz hex="${hex}" is not a #RRGGBB, #RGB or #RRGGBBAA color`,
|
|
2282
|
+
{ attribute: "hex" }
|
|
2283
|
+
);
|
|
2284
|
+
}
|
|
2285
|
+
rgba = [...c];
|
|
2286
|
+
if (attrs.has("a")) {
|
|
2287
|
+
rgba[3] = vizNumber(attrs, "a");
|
|
2288
|
+
}
|
|
2289
|
+
} else {
|
|
2290
|
+
rgba = [vizNumber(attrs, "r"), vizNumber(attrs, "g"), vizNumber(attrs, "b")];
|
|
2291
|
+
rgba.push(attrs.has("a") ? vizNumber(attrs, "a") : 1);
|
|
2417
2292
|
}
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2293
|
+
const max = [255, 255, 255, 1];
|
|
2294
|
+
if (rgba.some((v, i) => v < 0 || v > max[i])) {
|
|
2295
|
+
this.report.warning(
|
|
2296
|
+
"validation-error",
|
|
2297
|
+
VIZ_VALUE_CODE,
|
|
2298
|
+
`<${name}> has a channel outside 0..255 or an alpha outside 0..1; clamped`,
|
|
2299
|
+
where
|
|
2300
|
+
);
|
|
2301
|
+
rgba = rgba.map((v, i) => Math.max(0, Math.min(max[i], v)));
|
|
2422
2302
|
}
|
|
2303
|
+
return [rgba[0] / 255, rgba[1] / 255, rgba[2] / 255, rgba[3]];
|
|
2423
2304
|
}
|
|
2424
2305
|
// ---------------------------------------------------------------- helpers
|
|
2425
2306
|
/**
|
|
@@ -2555,29 +2436,6 @@ function vizNumber(attrs, name) {
|
|
|
2555
2436
|
}
|
|
2556
2437
|
return value;
|
|
2557
2438
|
}
|
|
2558
|
-
function parseColor(attrs) {
|
|
2559
|
-
let r;
|
|
2560
|
-
let g;
|
|
2561
|
-
let b;
|
|
2562
|
-
const hex = attrs.get("hex");
|
|
2563
|
-
if (hex !== void 0 && !attrs.has("r")) {
|
|
2564
|
-
const digits = hex.startsWith("#") ? hex.slice(1) : hex;
|
|
2565
|
-
if (!/^[0-9a-fA-F]{6}$/.test(digits)) {
|
|
2566
|
-
throw new GraphFormatError("E_COLUMN_TYPE", `viz hex="${hex}" is not a #RRGGBB color`, {
|
|
2567
|
-
attribute: "hex"
|
|
2568
|
-
});
|
|
2569
|
-
}
|
|
2570
|
-
r = Number.parseInt(digits.slice(0, 2), 16);
|
|
2571
|
-
g = Number.parseInt(digits.slice(2, 4), 16);
|
|
2572
|
-
b = Number.parseInt(digits.slice(4, 6), 16);
|
|
2573
|
-
} else {
|
|
2574
|
-
r = vizNumber(attrs, "r");
|
|
2575
|
-
g = vizNumber(attrs, "g");
|
|
2576
|
-
b = vizNumber(attrs, "b");
|
|
2577
|
-
}
|
|
2578
|
-
const a = attrs.has("a") ? vizNumber(attrs, "a") : 1;
|
|
2579
|
-
return [r / 255, g / 255, b / 255, a];
|
|
2580
|
-
}
|
|
2581
2439
|
const XML_START = /^\uFEFF?\s*</;
|
|
2582
2440
|
function sniffGexf(head) {
|
|
2583
2441
|
const text = sniffXmlText(head);
|
|
@@ -2608,6 +2466,7 @@ const gexfImporter = Object.freeze({
|
|
|
2608
2466
|
extensions: Object.freeze([".gexf"]),
|
|
2609
2467
|
mimeTypes: Object.freeze(["application/gexf+xml", "application/xml", "text/xml"]),
|
|
2610
2468
|
sniff: sniffGexf,
|
|
2469
|
+
styles: gexfStyles,
|
|
2611
2470
|
/**
|
|
2612
2471
|
* Read a GEXF document into the sink in one streaming pass.
|
|
2613
2472
|
* @param input - the document as text, bytes, a stream or chunks
|
|
@@ -2637,7 +2496,9 @@ const gexfImporter = Object.freeze({
|
|
|
2637
2496
|
report.fail(EMPTY_INPUT_CODE, "the input is empty (no markup at all)", { line: err.line });
|
|
2638
2497
|
}
|
|
2639
2498
|
if (err instanceof XmlSyntaxError) {
|
|
2640
|
-
report.fail(XML_SYNTAX_CODE, err.message, {
|
|
2499
|
+
report.fail(err instanceof XmlNestingError ? XML_NESTING_CODE : XML_SYNTAX_CODE, err.message, {
|
|
2500
|
+
line: err.line
|
|
2501
|
+
});
|
|
2641
2502
|
}
|
|
2642
2503
|
throw err;
|
|
2643
2504
|
}
|
|
@@ -3711,7 +3572,9 @@ function edgeType(snapshot, e, folding) {
|
|
|
3711
3572
|
}
|
|
3712
3573
|
return "directed";
|
|
3713
3574
|
}
|
|
3714
|
-
function* writeGexf(
|
|
3575
|
+
function* writeGexf(given, options) {
|
|
3576
|
+
const styled = gexfStyledExport(given, options?.styles);
|
|
3577
|
+
const snapshot = styled?.snapshot ?? given;
|
|
3715
3578
|
const plan = planExport(snapshot, options);
|
|
3716
3579
|
const { version } = plan;
|
|
3717
3580
|
const ids = sanitizeIds(snapshot, "any", plan.options.sanitizeIds);
|
|
@@ -3721,7 +3584,7 @@ function* writeGexf(snapshot, options) {
|
|
|
3721
3584
|
yield '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
3722
3585
|
yield `<gexf xmlns="${ns.gexf}" xmlns:viz="${ns.viz}" version="${version}">
|
|
3723
3586
|
`;
|
|
3724
|
-
yield metaElement(meta);
|
|
3587
|
+
yield metaElement(meta, styled);
|
|
3725
3588
|
yield graphStart(snapshot, plan);
|
|
3726
3589
|
yield attributesGroups("node", plan.nodeAttrs, " ");
|
|
3727
3590
|
yield attributesGroups("edge", plan.edgeAttrs, " ");
|
|
@@ -3752,6 +3615,7 @@ function* writeGexf(snapshot, options) {
|
|
|
3752
3615
|
}
|
|
3753
3616
|
body += spellsElement(nodeRoles, i, plan, " ");
|
|
3754
3617
|
body += vizElements(nodeRoles, i, " ", writeZ);
|
|
3618
|
+
body += styled?.node(i, " ") ?? "";
|
|
3755
3619
|
yield body.length === 0 ? ` <node${attrs}/>
|
|
3756
3620
|
` : ` <node${attrs}>
|
|
3757
3621
|
${body} </node>
|
|
@@ -3800,6 +3664,7 @@ ${body} </node>
|
|
|
3800
3664
|
let body = attvaluesElement(plan.edgeAttrs, e, plan, " ");
|
|
3801
3665
|
body += spellsElement(edgeRoles, e, plan, " ");
|
|
3802
3666
|
body += vizElements(edgeRoles, e, " ", false);
|
|
3667
|
+
body += styled?.edge(e, " ") ?? "";
|
|
3803
3668
|
yield body.length === 0 ? ` <edge${attrs}/>
|
|
3804
3669
|
` : ` <edge${attrs}>
|
|
3805
3670
|
${body} </edge>
|
|
@@ -3809,7 +3674,7 @@ ${body} </edge>
|
|
|
3809
3674
|
yield " </graph>\n";
|
|
3810
3675
|
yield "</gexf>\n";
|
|
3811
3676
|
}
|
|
3812
|
-
function metaElement(meta) {
|
|
3677
|
+
function metaElement(meta, styled) {
|
|
3813
3678
|
let body = "";
|
|
3814
3679
|
if (meta.creator !== null) {
|
|
3815
3680
|
body += ` <creator>${escapeXmlText(meta.creator)}</creator>
|
|
@@ -3821,6 +3686,10 @@ function metaElement(meta) {
|
|
|
3821
3686
|
}
|
|
3822
3687
|
if (meta.keywords.length > 0) {
|
|
3823
3688
|
body += ` <keywords>${escapeXmlText(meta.keywords.join(", "))}</keywords>
|
|
3689
|
+
`;
|
|
3690
|
+
}
|
|
3691
|
+
if (styled !== null) {
|
|
3692
|
+
body += ` ${styled.blockElement}
|
|
3824
3693
|
`;
|
|
3825
3694
|
}
|
|
3826
3695
|
const modified = meta.modified === null ? "" : ` lastmodifieddate="${escapeXmlAttribute(meta.modified)}"`;
|
|
@@ -3906,6 +3775,7 @@ const gexfExporter = Object.freeze({
|
|
|
3906
3775
|
format: GEXF_FORMAT,
|
|
3907
3776
|
options: Object.freeze(["version"]),
|
|
3908
3777
|
capabilities: CAPABILITIES_1_3,
|
|
3778
|
+
styles: Object.freeze({ capabilities: GEXF_STYLE_CAPABILITIES }),
|
|
3909
3779
|
/**
|
|
3910
3780
|
* Pre-flight: what export() would lose.
|
|
3911
3781
|
* @param snapshot - the snapshot
|
|
@@ -3913,7 +3783,8 @@ const gexfExporter = Object.freeze({
|
|
|
3913
3783
|
* @returns the loss notes, empty when the export is exact
|
|
3914
3784
|
*/
|
|
3915
3785
|
check(snapshot, options) {
|
|
3916
|
-
|
|
3786
|
+
const styled = gexfStyledExport(snapshot, options?.styles);
|
|
3787
|
+
return Object.freeze([...planExport(styled?.snapshot ?? snapshot, options).notes, ...styled?.notes ?? []]);
|
|
3917
3788
|
},
|
|
3918
3789
|
/**
|
|
3919
3790
|
* Write the snapshot as UTF-8 chunks.
|
|
@@ -3945,6 +3816,8 @@ const GEXF_ISSUE = Object.freeze({
|
|
|
3945
3816
|
COLUMN_TYPE: COLUMN_TYPE_CODE,
|
|
3946
3817
|
/** The XML is not well-formed. The import stops. */
|
|
3947
3818
|
XML_SYNTAX: XML_SYNTAX_CODE,
|
|
3819
|
+
/** Elements are nested more than 100,000 deep. The import stops. */
|
|
3820
|
+
XML_NESTING: XML_NESTING_CODE,
|
|
3948
3821
|
/** The input is not valid UTF-8. The import stops. */
|
|
3949
3822
|
INVALID_UTF8: INVALID_UTF8_CODE,
|
|
3950
3823
|
/**
|
|
@@ -3981,6 +3854,11 @@ const GEXF_ISSUE = Object.freeze({
|
|
|
3981
3854
|
EDGE_TYPE: EDGE_TYPE_CODE,
|
|
3982
3855
|
/** A `pid` / `<parent for>` naming an unknown node, a `<parent>` without for, or the children of a skipped node. */
|
|
3983
3856
|
UNKNOWN_PARENT: UNKNOWN_PARENT_CODE,
|
|
3857
|
+
/**
|
|
3858
|
+
* GEXF 1.0 only: a `pid` naming no node. Gephi 0.6 wrote `pid="0"` on its top-level nodes; the node stays
|
|
3859
|
+
* top-level.
|
|
3860
|
+
*/
|
|
3861
|
+
UNKNOWN_PID: UNKNOWN_PID_CODE,
|
|
3984
3862
|
/** A `pid` / nested containment that would close a parent cycle; that link is dropped. */
|
|
3985
3863
|
PARENT_CYCLE: PARENT_CYCLE_CODE,
|
|
3986
3864
|
/** An inverted interval (start after end) of an element, a spell or a value; it is not kept. */
|
|
@@ -4082,6 +3960,8 @@ export {
|
|
|
4082
3960
|
GEXF_1_2_CAPABILITIES,
|
|
4083
3961
|
GEXF_ISSUE,
|
|
4084
3962
|
GEXF_LOSS,
|
|
3963
|
+
GEXF_STYLE_CAPABILITIES,
|
|
3964
|
+
GRAPHTY_XML_NAMESPACE,
|
|
4085
3965
|
gexfExporter,
|
|
4086
3966
|
gexfImporter
|
|
4087
3967
|
};
|