@graphty/graph-io 0.3.25 → 0.3.26
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/README.md +49 -414
- package/dist/chunks/children-CL3Cy0ez.js.map +1 -1
- package/dist/chunks/choose-BbJI55dx.js +56 -0
- package/dist/chunks/choose-BbJI55dx.js.map +1 -0
- package/dist/chunks/constants-BCsFsMj4.js +231 -0
- package/dist/chunks/constants-BCsFsMj4.js.map +1 -0
- package/dist/chunks/{escape-B-tkk_Cl.js → escape-D0g6NNUy.js} +382 -92
- package/dist/chunks/escape-D0g6NNUy.js.map +1 -0
- package/dist/chunks/export-BTI4yQgy.js +4333 -0
- package/dist/chunks/export-BTI4yQgy.js.map +1 -0
- package/dist/chunks/exporter-BMqk5oxW.js +3465 -0
- package/dist/chunks/exporter-BMqk5oxW.js.map +1 -0
- package/dist/chunks/{importer-eUREhBGj.js → exporter-Cra2GYcN.js} +4969 -3201
- package/dist/chunks/exporter-Cra2GYcN.js.map +1 -0
- package/dist/chunks/{exporter-BGrsWamJ.js → exporter-Dxh231ZF.js} +38 -229
- package/dist/chunks/exporter-Dxh231ZF.js.map +1 -0
- package/dist/chunks/{exporter-DIeGJXAZ.js → exporter-tne475KK.js} +22 -20
- package/dist/chunks/exporter-tne475KK.js.map +1 -0
- package/dist/chunks/importer-90YWhJoF.js +2811 -0
- package/dist/chunks/importer-90YWhJoF.js.map +1 -0
- package/dist/chunks/{importer-D_e7e7LX.js → importer-Bcl1d4xH.js} +398 -145
- package/dist/chunks/importer-Bcl1d4xH.js.map +1 -0
- package/dist/chunks/{importer-BWY2FFc5.js → importer-BfIsp1f9.js} +255 -77
- package/dist/chunks/importer-BfIsp1f9.js.map +1 -0
- package/dist/chunks/{importer-zGLo8Dg_.js → importer-C_TEA1zJ.js} +484 -157
- package/dist/chunks/importer-C_TEA1zJ.js.map +1 -0
- package/dist/chunks/{importer-DET1tg6s.js → importer-DCjOvO7U.js} +1687 -310
- package/dist/chunks/importer-DCjOvO7U.js.map +1 -0
- package/dist/chunks/{importer-vi3bSdtw.js → importer-DfVu6j59.js} +509 -76
- package/dist/chunks/importer-DfVu6j59.js.map +1 -0
- package/dist/chunks/{importer-DIrbbnAf.js → importer-Dku_VAIY.js} +585 -226
- package/dist/chunks/importer-Dku_VAIY.js.map +1 -0
- package/dist/chunks/json-elements-3tnyt5uZ.js +1225 -0
- package/dist/chunks/json-elements-3tnyt5uZ.js.map +1 -0
- package/dist/chunks/ontology-export-B9Tcf37D.js +357 -0
- package/dist/chunks/ontology-export-B9Tcf37D.js.map +1 -0
- package/dist/chunks/{records-dbRkxwaq.js → records-CQXT__mY.js} +298 -114
- package/dist/chunks/records-CQXT__mY.js.map +1 -0
- package/dist/chunks/{text-Dr0Ifpag.js → text-DmcUs5_Q.js} +29 -11
- package/dist/chunks/text-DmcUs5_Q.js.map +1 -0
- package/dist/chunks/{writer-C7flM-Ih.js → writer-DxjgHwSe.js} +19 -1
- package/dist/chunks/writer-DxjgHwSe.js.map +1 -0
- package/dist/csv.js +951 -261
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +6 -3
- package/dist/cx2.js +2 -2
- package/dist/cys.js +6 -3
- package/dist/dot.js +1 -1
- package/dist/gexf.js +554 -122
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +342 -85
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +1105 -213
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +3 -2
- package/dist/graphml.js.map +1 -1
- package/dist/json.js +3 -2
- package/dist/neo4j.js +564 -157
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +6 -3
- package/dist/pajek.js +1 -1
- package/dist/src/children.d.ts +18 -6
- package/dist/src/children.d.ts.map +1 -1
- package/dist/src/children.js +6 -3
- package/dist/src/children.js.map +1 -1
- package/dist/src/common/attributes.d.ts +29 -11
- package/dist/src/common/attributes.d.ts.map +1 -1
- package/dist/src/common/attributes.js +25 -7
- package/dist/src/common/attributes.js.map +1 -1
- package/dist/src/common/cell-budget.d.ts +9 -2
- package/dist/src/common/cell-budget.d.ts.map +1 -1
- package/dist/src/common/cell-budget.js +11 -3
- package/dist/src/common/cell-budget.js.map +1 -1
- package/dist/src/common/choose.d.ts +19 -0
- package/dist/src/common/choose.d.ts.map +1 -0
- package/dist/src/common/choose.js +72 -0
- package/dist/src/common/choose.js.map +1 -0
- package/dist/src/common/codes.d.ts +456 -66
- package/dist/src/common/codes.d.ts.map +1 -1
- package/dist/src/common/codes.js +458 -66
- package/dist/src/common/codes.js.map +1 -1
- package/dist/src/common/compare.d.ts +81 -0
- package/dist/src/common/compare.d.ts.map +1 -0
- package/dist/src/common/compare.js +394 -0
- package/dist/src/common/compare.js.map +1 -0
- package/dist/src/common/cx-export.d.ts +123 -0
- package/dist/src/common/cx-export.d.ts.map +1 -0
- package/dist/src/common/cx-export.js +334 -0
- package/dist/src/common/cx-export.js.map +1 -0
- package/dist/src/common/declared-types.d.ts +22 -2
- package/dist/src/common/declared-types.d.ts.map +1 -1
- package/dist/src/common/declared-types.js +19 -1
- package/dist/src/common/declared-types.js.map +1 -1
- package/dist/src/common/direction.d.ts +74 -50
- package/dist/src/common/direction.d.ts.map +1 -1
- package/dist/src/common/direction.js +47 -27
- package/dist/src/common/direction.js.map +1 -1
- package/dist/src/common/escape.d.ts +21 -9
- package/dist/src/common/escape.d.ts.map +1 -1
- package/dist/src/common/escape.js +33 -17
- package/dist/src/common/escape.js.map +1 -1
- package/dist/src/common/export.d.ts +144 -32
- package/dist/src/common/export.d.ts.map +1 -1
- package/dist/src/common/export.js +216 -42
- package/dist/src/common/export.js.map +1 -1
- package/dist/src/common/format.d.ts +23 -1
- package/dist/src/common/format.d.ts.map +1 -1
- package/dist/src/common/format.js +26 -1
- package/dist/src/common/format.js.map +1 -1
- package/dist/src/common/ids.d.ts +9 -2
- package/dist/src/common/ids.d.ts.map +1 -1
- package/dist/src/common/ids.js +6 -2
- package/dist/src/common/ids.js.map +1 -1
- package/dist/src/common/input.d.ts +122 -28
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +890 -124
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/json-elements.d.ts +144 -20
- package/dist/src/common/json-elements.d.ts.map +1 -1
- package/dist/src/common/json-elements.js +868 -188
- package/dist/src/common/json-elements.js.map +1 -1
- package/dist/src/common/line-format.d.ts +90 -0
- package/dist/src/common/line-format.d.ts.map +1 -0
- package/dist/src/common/line-format.js +185 -0
- package/dist/src/common/line-format.js.map +1 -0
- package/dist/src/common/lists.d.ts +6 -1
- package/dist/src/common/lists.d.ts.map +1 -1
- package/dist/src/common/lists.js +2 -0
- package/dist/src/common/lists.js.map +1 -1
- package/dist/src/common/ontology-export.d.ts +167 -0
- package/dist/src/common/ontology-export.d.ts.map +1 -0
- package/dist/src/common/ontology-export.js +359 -0
- package/dist/src/common/ontology-export.js.map +1 -0
- package/dist/src/common/ontology.d.ts +25 -3
- package/dist/src/common/ontology.d.ts.map +1 -1
- package/dist/src/common/ontology.js +30 -9
- package/dist/src/common/ontology.js.map +1 -1
- package/dist/src/common/options.d.ts +62 -12
- package/dist/src/common/options.d.ts.map +1 -1
- package/dist/src/common/options.js +89 -11
- package/dist/src/common/options.js.map +1 -1
- package/dist/src/common/plural.d.ts +31 -0
- package/dist/src/common/plural.d.ts.map +1 -0
- package/dist/src/common/plural.js +46 -0
- package/dist/src/common/plural.js.map +1 -0
- package/dist/src/common/report.d.ts +72 -14
- package/dist/src/common/report.d.ts.map +1 -1
- package/dist/src/common/report.js +146 -22
- package/dist/src/common/report.js.map +1 -1
- package/dist/src/common/temporal.d.ts +22 -5
- package/dist/src/common/temporal.d.ts.map +1 -1
- package/dist/src/common/temporal.js +13 -2
- package/dist/src/common/temporal.js.map +1 -1
- package/dist/src/common/text.d.ts +39 -23
- package/dist/src/common/text.d.ts.map +1 -1
- package/dist/src/common/text.js +51 -21
- package/dist/src/common/text.js.map +1 -1
- package/dist/src/common/weights.d.ts +37 -4
- package/dist/src/common/weights.d.ts.map +1 -1
- package/dist/src/common/weights.js +61 -2
- package/dist/src/common/weights.js.map +1 -1
- package/dist/src/common/writer.d.ts +19 -3
- package/dist/src/common/writer.d.ts.map +1 -1
- package/dist/src/common/writer.js +30 -2
- package/dist/src/common/writer.js.map +1 -1
- package/dist/src/common/xml.d.ts +125 -9
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +400 -83
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/common/zip.d.ts +44 -4
- package/dist/src/common/zip.d.ts.map +1 -1
- package/dist/src/common/zip.js +134 -5
- package/dist/src/common/zip.js.map +1 -1
- package/dist/src/formats/csv/exporter.d.ts +80 -24
- package/dist/src/formats/csv/exporter.d.ts.map +1 -1
- package/dist/src/formats/csv/exporter.js +145 -32
- package/dist/src/formats/csv/exporter.js.map +1 -1
- package/dist/src/formats/csv/header.d.ts +38 -9
- package/dist/src/formats/csv/header.d.ts.map +1 -1
- package/dist/src/formats/csv/header.js +46 -10
- package/dist/src/formats/csv/header.js.map +1 -1
- package/dist/src/formats/csv/importer.d.ts +187 -37
- package/dist/src/formats/csv/importer.d.ts.map +1 -1
- package/dist/src/formats/csv/importer.js +835 -204
- package/dist/src/formats/csv/importer.js.map +1 -1
- package/dist/src/formats/csv/index.d.ts +100 -19
- package/dist/src/formats/csv/index.d.ts.map +1 -1
- package/dist/src/formats/csv/index.js +94 -21
- package/dist/src/formats/csv/index.js.map +1 -1
- package/dist/src/formats/csv/records.d.ts +95 -10
- package/dist/src/formats/csv/records.d.ts.map +1 -1
- package/dist/src/formats/csv/records.js +333 -122
- package/dist/src/formats/csv/records.js.map +1 -1
- package/dist/src/formats/csv/values.d.ts +1 -0
- package/dist/src/formats/csv/values.d.ts.map +1 -1
- package/dist/src/formats/csv/values.js +1 -0
- package/dist/src/formats/csv/values.js.map +1 -1
- package/dist/src/formats/cx/exporter.d.ts +102 -0
- package/dist/src/formats/cx/exporter.d.ts.map +1 -0
- package/dist/src/formats/cx/exporter.js +1217 -0
- package/dist/src/formats/cx/exporter.js.map +1 -0
- package/dist/src/formats/cx/importer.d.ts +79 -32
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +680 -285
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx/index.d.ts +4 -3
- package/dist/src/formats/cx/index.d.ts.map +1 -1
- package/dist/src/formats/cx/index.js +4 -3
- package/dist/src/formats/cx/index.js.map +1 -1
- package/dist/src/formats/cx2/exporter.d.ts +29 -11
- package/dist/src/formats/cx2/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx2/exporter.js +39 -268
- package/dist/src/formats/cx2/exporter.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts +78 -28
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +226 -79
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cx2/index.d.ts +2 -1
- package/dist/src/formats/cx2/index.d.ts.map +1 -1
- package/dist/src/formats/cx2/index.js +2 -1
- package/dist/src/formats/cx2/index.js.map +1 -1
- package/dist/src/formats/cys/constants.d.ts +66 -17
- package/dist/src/formats/cys/constants.d.ts.map +1 -1
- package/dist/src/formats/cys/constants.js +59 -18
- package/dist/src/formats/cys/constants.js.map +1 -1
- package/dist/src/formats/cys/exporter.d.ts +118 -0
- package/dist/src/formats/cys/exporter.d.ts.map +1 -0
- package/dist/src/formats/cys/exporter.js +1072 -0
- package/dist/src/formats/cys/exporter.js.map +1 -0
- package/dist/src/formats/cys/importer.d.ts +22 -8
- package/dist/src/formats/cys/importer.d.ts.map +1 -1
- package/dist/src/formats/cys/importer.js +510 -149
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/index.d.ts +4 -2
- package/dist/src/formats/cys/index.d.ts.map +1 -1
- package/dist/src/formats/cys/index.js +4 -2
- package/dist/src/formats/cys/index.js.map +1 -1
- package/dist/src/formats/cys/session.d.ts +46 -7
- package/dist/src/formats/cys/session.d.ts.map +1 -1
- package/dist/src/formats/cys/session.js +98 -24
- package/dist/src/formats/cys/session.js.map +1 -1
- package/dist/src/formats/cys/tables.d.ts +9 -2
- package/dist/src/formats/cys/tables.d.ts.map +1 -1
- package/dist/src/formats/cys/tables.js +29 -7
- package/dist/src/formats/cys/tables.js.map +1 -1
- package/dist/src/formats/dot/exporter.d.ts +42 -14
- package/dist/src/formats/dot/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +56 -29
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts +91 -29
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +190 -39
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/index.d.ts +2 -1
- package/dist/src/formats/dot/index.d.ts.map +1 -1
- package/dist/src/formats/dot/index.js +2 -1
- package/dist/src/formats/dot/index.js.map +1 -1
- package/dist/src/formats/dot/names.d.ts +44 -11
- package/dist/src/formats/dot/names.d.ts.map +1 -1
- package/dist/src/formats/dot/names.js +44 -11
- package/dist/src/formats/dot/names.js.map +1 -1
- package/dist/src/formats/dot/tokenizer.d.ts +9 -2
- package/dist/src/formats/dot/tokenizer.d.ts.map +1 -1
- package/dist/src/formats/dot/tokenizer.js +20 -5
- package/dist/src/formats/dot/tokenizer.js.map +1 -1
- package/dist/src/formats/gexf/exporter.d.ts +46 -15
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +45 -15
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts +87 -23
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +471 -90
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/index.d.ts +84 -21
- package/dist/src/formats/gexf/index.d.ts.map +1 -1
- package/dist/src/formats/gexf/index.js +80 -23
- package/dist/src/formats/gexf/index.js.map +1 -1
- package/dist/src/formats/gexf/schema.d.ts +67 -15
- package/dist/src/formats/gexf/schema.d.ts.map +1 -1
- package/dist/src/formats/gexf/schema.js +59 -13
- package/dist/src/formats/gexf/schema.js.map +1 -1
- package/dist/src/formats/gml/exporter.d.ts +69 -21
- package/dist/src/formats/gml/exporter.d.ts.map +1 -1
- package/dist/src/formats/gml/exporter.js +74 -29
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts +116 -25
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +290 -61
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +87 -24
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +79 -26
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/gml/syntax.d.ts +67 -18
- package/dist/src/formats/gml/syntax.d.ts.map +1 -1
- package/dist/src/formats/gml/syntax.js +108 -26
- package/dist/src/formats/gml/syntax.js.map +1 -1
- package/dist/src/formats/graphml/constants.d.ts +174 -44
- package/dist/src/formats/graphml/constants.d.ts.map +1 -1
- package/dist/src/formats/graphml/constants.js +165 -44
- package/dist/src/formats/graphml/constants.js.map +1 -1
- package/dist/src/formats/graphml/exporter.d.ts +17 -9
- package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
- package/dist/src/formats/graphml/exporter.js +33 -12
- package/dist/src/formats/graphml/exporter.js.map +1 -1
- package/dist/src/formats/graphml/importer.d.ts +19 -7
- package/dist/src/formats/graphml/importer.d.ts.map +1 -1
- package/dist/src/formats/graphml/importer.js +466 -39
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/graphml/index.d.ts +2 -1
- package/dist/src/formats/graphml/index.d.ts.map +1 -1
- package/dist/src/formats/graphml/index.js +2 -1
- package/dist/src/formats/graphml/index.js.map +1 -1
- package/dist/src/formats/graphml/tree.d.ts +6 -2
- package/dist/src/formats/graphml/tree.d.ts.map +1 -1
- package/dist/src/formats/graphml/tree.js +6 -2
- package/dist/src/formats/graphml/tree.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts +8 -3
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +36 -15
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/dialect.d.ts +88 -24
- package/dist/src/formats/json/dialect.d.ts.map +1 -1
- package/dist/src/formats/json/dialect.js +109 -19
- package/dist/src/formats/json/dialect.js.map +1 -1
- package/dist/src/formats/json/exporter.d.ts +134 -22
- package/dist/src/formats/json/exporter.d.ts.map +1 -1
- package/dist/src/formats/json/exporter.js +135 -54
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +173 -52
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +899 -220
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/index.d.ts +3 -2
- package/dist/src/formats/json/index.d.ts.map +1 -1
- package/dist/src/formats/json/index.js +3 -2
- package/dist/src/formats/json/index.js.map +1 -1
- package/dist/src/formats/json/obographs-export.d.ts +68 -0
- package/dist/src/formats/json/obographs-export.d.ts.map +1 -0
- package/dist/src/formats/json/obographs-export.js +941 -0
- package/dist/src/formats/json/obographs-export.js.map +1 -0
- package/dist/src/formats/json/obographs.d.ts +26 -0
- package/dist/src/formats/json/obographs.d.ts.map +1 -1
- package/dist/src/formats/json/obographs.js +297 -80
- package/dist/src/formats/json/obographs.js.map +1 -1
- package/dist/src/formats/neo4j/exporter.d.ts +109 -21
- package/dist/src/formats/neo4j/exporter.d.ts.map +1 -1
- package/dist/src/formats/neo4j/exporter.js +238 -85
- package/dist/src/formats/neo4j/exporter.js.map +1 -1
- package/dist/src/formats/neo4j/header.d.ts +17 -4
- package/dist/src/formats/neo4j/header.d.ts.map +1 -1
- package/dist/src/formats/neo4j/header.js +36 -4
- package/dist/src/formats/neo4j/header.js.map +1 -1
- package/dist/src/formats/neo4j/importer.d.ts +107 -27
- package/dist/src/formats/neo4j/importer.d.ts.map +1 -1
- package/dist/src/formats/neo4j/importer.js +415 -63
- package/dist/src/formats/neo4j/importer.js.map +1 -1
- package/dist/src/formats/neo4j/index.d.ts +73 -23
- package/dist/src/formats/neo4j/index.d.ts.map +1 -1
- package/dist/src/formats/neo4j/index.js +65 -25
- package/dist/src/formats/neo4j/index.js.map +1 -1
- package/dist/src/formats/obo/exporter.d.ts +150 -0
- package/dist/src/formats/obo/exporter.d.ts.map +1 -0
- package/dist/src/formats/obo/exporter.js +1736 -0
- package/dist/src/formats/obo/exporter.js.map +1 -0
- package/dist/src/formats/obo/importer.d.ts +95 -19
- package/dist/src/formats/obo/importer.d.ts.map +1 -1
- package/dist/src/formats/obo/importer.js +475 -104
- package/dist/src/formats/obo/importer.js.map +1 -1
- package/dist/src/formats/obo/index.d.ts +6 -3
- package/dist/src/formats/obo/index.d.ts.map +1 -1
- package/dist/src/formats/obo/index.js +6 -3
- package/dist/src/formats/obo/index.js.map +1 -1
- package/dist/src/formats/obo/syntax.d.ts +108 -4
- package/dist/src/formats/obo/syntax.d.ts.map +1 -1
- package/dist/src/formats/obo/syntax.js +211 -34
- package/dist/src/formats/obo/syntax.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts +54 -16
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +66 -34
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +84 -22
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +303 -83
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/index.d.ts +2 -1
- package/dist/src/formats/pajek/index.d.ts.map +1 -1
- package/dist/src/formats/pajek/index.js +2 -1
- package/dist/src/formats/pajek/index.js.map +1 -1
- package/dist/src/formats/pajek/syntax.d.ts +77 -14
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +183 -51
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/columns.d.ts +1 -0
- package/dist/src/formats/xgmml/columns.d.ts.map +1 -1
- package/dist/src/formats/xgmml/columns.js +4 -0
- package/dist/src/formats/xgmml/columns.js.map +1 -1
- package/dist/src/formats/xgmml/constants.d.ts +186 -56
- package/dist/src/formats/xgmml/constants.d.ts.map +1 -1
- package/dist/src/formats/xgmml/constants.js +181 -57
- package/dist/src/formats/xgmml/constants.js.map +1 -1
- package/dist/src/formats/xgmml/document.d.ts +65 -11
- package/dist/src/formats/xgmml/document.d.ts.map +1 -1
- package/dist/src/formats/xgmml/document.js +157 -28
- package/dist/src/formats/xgmml/document.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts +61 -3
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +129 -26
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/exporter.d.ts +13 -6
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +20 -21
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/importer.d.ts +33 -12
- package/dist/src/formats/xgmml/importer.d.ts.map +1 -1
- package/dist/src/formats/xgmml/importer.js +35 -72
- package/dist/src/formats/xgmml/importer.js.map +1 -1
- package/dist/src/formats/xgmml/index.d.ts +1 -0
- package/dist/src/formats/xgmml/index.d.ts.map +1 -1
- package/dist/src/formats/xgmml/index.js +1 -0
- package/dist/src/formats/xgmml/index.js.map +1 -1
- package/dist/src/formats/xgmml/values.d.ts +8 -1
- package/dist/src/formats/xgmml/values.d.ts.map +1 -1
- package/dist/src/formats/xgmml/values.js +7 -2
- package/dist/src/formats/xgmml/values.js.map +1 -1
- package/dist/src/index.d.ts +23 -18
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +28 -16
- package/dist/src/index.js.map +1 -1
- package/dist/src/registry.d.ts +478 -92
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +807 -88
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sniff.d.ts +61 -19
- package/dist/src/sniff.d.ts.map +1 -1
- package/dist/src/sniff.js +121 -29
- package/dist/src/sniff.js.map +1 -1
- package/dist/src/types.d.ts +362 -112
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +28 -7
- package/dist/src/types.js.map +1 -1
- package/dist/xgmml.js +2 -2
- package/docs/samples/README.md +25 -0
- package/docs/samples/got-edges.csv +353 -0
- package/docs/samples/got-network.graphml +1384 -0
- package/docs/samples/got-nodes.csv +108 -0
- package/docs/samples/got.cx +930 -0
- package/docs/samples/got.cx2 +465 -0
- package/docs/samples/got.gexf +471 -0
- package/docs/samples/got.gml +2650 -0
- package/docs/samples/got.json +2546 -0
- package/docs/samples/got.net +461 -0
- package/docs/samples/movies-nodes.csv +9 -0
- package/docs/samples/movies-rels.csv +8 -0
- package/docs/samples/networks.cys +0 -0
- package/docs/samples/proteins.xgmml +9 -0
- package/docs/samples/teams.gv +24 -0
- package/docs/samples/vehicles.obo +25 -0
- package/package.json +9 -4
- package/src/children.ts +18 -6
- package/src/common/attributes.ts +29 -11
- package/src/common/cell-budget.ts +11 -3
- package/src/common/choose.ts +89 -0
- package/src/common/codes.ts +490 -66
- package/src/common/compare.ts +472 -0
- package/src/common/cx-export.ts +432 -0
- package/src/common/declared-types.ts +38 -4
- package/src/common/direction.ts +78 -51
- package/src/common/escape.ts +33 -17
- package/src/common/export.ts +284 -47
- package/src/common/format.ts +30 -1
- package/src/common/ids.ts +14 -3
- package/src/common/input.ts +1057 -134
- package/src/common/json-elements.ts +1034 -198
- package/src/common/line-format.ts +249 -0
- package/src/common/lists.ts +6 -1
- package/src/common/ontology-export.ts +461 -0
- package/src/common/ontology.ts +31 -9
- package/src/common/options.ts +110 -15
- package/src/common/plural.ts +49 -0
- package/src/common/report.ts +168 -25
- package/src/common/temporal.ts +22 -5
- package/src/common/text.ts +62 -23
- package/src/common/weights.ts +74 -4
- package/src/common/writer.ts +37 -3
- package/src/common/xml.ts +477 -88
- package/src/common/zip.ts +169 -7
- package/src/formats/csv/exporter.ts +201 -46
- package/src/formats/csv/header.ts +50 -11
- package/src/formats/csv/importer.ts +1133 -245
- package/src/formats/csv/index.ts +106 -19
- package/src/formats/csv/records.ts +396 -122
- package/src/formats/csv/values.ts +1 -0
- package/src/formats/cx/exporter.ts +1483 -0
- package/src/formats/cx/importer.ts +888 -300
- package/src/formats/cx/index.ts +4 -3
- package/src/formats/cx2/exporter.ts +61 -338
- package/src/formats/cx2/importer.ts +317 -86
- package/src/formats/cx2/index.ts +2 -1
- package/src/formats/cys/constants.ts +62 -17
- package/src/formats/cys/exporter.ts +1368 -0
- package/src/formats/cys/importer.ts +659 -157
- package/src/formats/cys/index.ts +4 -2
- package/src/formats/cys/session.ts +139 -31
- package/src/formats/cys/tables.ts +47 -9
- package/src/formats/dot/exporter.ts +83 -37
- package/src/formats/dot/importer.ts +248 -54
- package/src/formats/dot/index.ts +2 -1
- package/src/formats/dot/names.ts +44 -11
- package/src/formats/dot/tokenizer.ts +25 -6
- package/src/formats/gexf/exporter.ts +57 -18
- package/src/formats/gexf/importer.ts +636 -105
- package/src/formats/gexf/index.ts +90 -21
- package/src/formats/gexf/schema.ts +67 -15
- package/src/formats/gml/exporter.ts +90 -36
- package/src/formats/gml/importer.ts +388 -67
- package/src/formats/gml/index.ts +85 -24
- package/src/formats/gml/syntax.ts +111 -26
- package/src/formats/graphml/constants.ts +178 -44
- package/src/formats/graphml/exporter.ts +52 -18
- package/src/formats/graphml/importer.ts +640 -60
- package/src/formats/graphml/index.ts +2 -1
- package/src/formats/graphml/tree.ts +6 -2
- package/src/formats/graphml/yfiles.ts +37 -15
- package/src/formats/json/dialect.ts +128 -29
- package/src/formats/json/exporter.ts +205 -68
- package/src/formats/json/importer.ts +1163 -253
- package/src/formats/json/index.ts +3 -1
- package/src/formats/json/obographs-export.ts +1197 -0
- package/src/formats/json/obographs.ts +353 -92
- package/src/formats/neo4j/exporter.ts +320 -101
- package/src/formats/neo4j/header.ts +44 -6
- package/src/formats/neo4j/importer.ts +512 -73
- package/src/formats/neo4j/index.ts +75 -23
- package/src/formats/obo/exporter.ts +2210 -0
- package/src/formats/obo/importer.ts +622 -109
- package/src/formats/obo/index.ts +6 -3
- package/src/formats/obo/syntax.ts +232 -37
- package/src/formats/pajek/exporter.ts +89 -41
- package/src/formats/pajek/importer.ts +407 -93
- package/src/formats/pajek/index.ts +2 -1
- package/src/formats/pajek/syntax.ts +213 -52
- package/src/formats/xgmml/columns.ts +10 -0
- package/src/formats/xgmml/constants.ts +183 -56
- package/src/formats/xgmml/document.ts +212 -34
- package/src/formats/xgmml/emit.ts +175 -34
- package/src/formats/xgmml/exporter.ts +35 -27
- package/src/formats/xgmml/importer.ts +64 -86
- package/src/formats/xgmml/index.ts +1 -0
- package/src/formats/xgmml/values.ts +11 -3
- package/src/index.ts +81 -11
- package/src/registry.ts +1121 -135
- package/src/sniff.ts +163 -32
- package/src/types.ts +385 -114
- package/dist/chunks/escape-B-tkk_Cl.js.map +0 -1
- package/dist/chunks/export-Bh60Dv-n.js +0 -582
- package/dist/chunks/export-Bh60Dv-n.js.map +0 -1
- package/dist/chunks/exporter-BGrsWamJ.js.map +0 -1
- package/dist/chunks/exporter-DIeGJXAZ.js.map +0 -1
- package/dist/chunks/importer-BWY2FFc5.js.map +0 -1
- package/dist/chunks/importer-DD-xv9_Y.js +0 -1471
- package/dist/chunks/importer-DD-xv9_Y.js.map +0 -1
- package/dist/chunks/importer-DET1tg6s.js.map +0 -1
- package/dist/chunks/importer-DEcKhsmQ.js +0 -1614
- package/dist/chunks/importer-DEcKhsmQ.js.map +0 -1
- package/dist/chunks/importer-DIrbbnAf.js.map +0 -1
- package/dist/chunks/importer-D_e7e7LX.js.map +0 -1
- package/dist/chunks/importer-eUREhBGj.js.map +0 -1
- package/dist/chunks/importer-vi3bSdtw.js.map +0 -1
- package/dist/chunks/importer-zGLo8Dg_.js.map +0 -1
- package/dist/chunks/json-elements-DDS8N2Dd.js +0 -779
- package/dist/chunks/json-elements-DDS8N2Dd.js.map +0 -1
- package/dist/chunks/ontology-BnrJ4I98.js +0 -113
- package/dist/chunks/ontology-BnrJ4I98.js.map +0 -1
- package/dist/chunks/records-dbRkxwaq.js.map +0 -1
- package/dist/chunks/report-B1z4WT9e.js +0 -2372
- package/dist/chunks/report-B1z4WT9e.js.map +0 -1
- package/dist/chunks/text-Dr0Ifpag.js.map +0 -1
- package/dist/chunks/weights-Dzba96G3.js +0 -176
- package/dist/chunks/weights-Dzba96G3.js.map +0 -1
- package/dist/chunks/writer-C7flM-Ih.js.map +0 -1
|
@@ -8,12 +8,16 @@
|
|
|
8
8
|
* / `graph`), the d3 lineage of the same shape (`links`, `name` ids, integer index endpoints),
|
|
9
9
|
* JSON Graph Format v2 (`graph.nodes` keyed by id, per-edge `directed`, hyperedges), Cytoscape.js
|
|
10
10
|
* elements (`data.id` / `data.source` / `data.target`, `position`, `classes`, `data.parent`),
|
|
11
|
-
* graphology
|
|
11
|
+
* graphology serialization (`key` / `attributes`, `undirected` edges, `options.type` / `multi`) and
|
|
12
12
|
* vis.js (`from` / `to`); read only: NetworkX adjacency_data (`nodes` + `adjacency`) and tree_data
|
|
13
13
|
* (nested `id` / `children`).
|
|
14
14
|
*/
|
|
15
15
|
import { capabilities } from "../../common/export.js";
|
|
16
|
-
|
|
16
|
+
import { trimTrailingZeros } from "../../common/text.js";
|
|
17
|
+
/**
|
|
18
|
+
* Every dialect name, for option checking and messages.
|
|
19
|
+
* @category Built-in formats
|
|
20
|
+
*/
|
|
17
21
|
export const JSON_DIALECTS = Object.freeze([
|
|
18
22
|
"node-link",
|
|
19
23
|
"d3",
|
|
@@ -21,20 +25,39 @@ export const JSON_DIALECTS = Object.freeze([
|
|
|
21
25
|
"cytoscape",
|
|
22
26
|
"graphology",
|
|
23
27
|
"vis",
|
|
28
|
+
"obographs",
|
|
24
29
|
]);
|
|
25
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Every dialect the importer reads, for option checking and messages.
|
|
32
|
+
* @category Plugin helpers
|
|
33
|
+
*/
|
|
26
34
|
export const JSON_IMPORT_DIALECTS = Object.freeze([
|
|
27
35
|
...JSON_DIALECTS,
|
|
28
36
|
"adjacency",
|
|
29
37
|
"tree",
|
|
30
|
-
"obographs",
|
|
31
38
|
]);
|
|
32
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* The key under `meta.extra` that holds the shape record (design section 8.5).
|
|
41
|
+
* @category Plugin helpers
|
|
42
|
+
*/
|
|
33
43
|
export const META_KEY = "json";
|
|
44
|
+
/**
|
|
45
|
+
* What a JSON import recorded about the document's shape: the dialect it was read as
|
|
46
|
+
* (`jsonShapeOf(snapshot)?.dialect`), the keys it used, and so on. A JSON export with default
|
|
47
|
+
* options writes the same shape back.
|
|
48
|
+
* @param snapshot - a graph read from a JSON document
|
|
49
|
+
* @returns the shape, or null for a graph that was not read from JSON
|
|
50
|
+
* @category Built-in formats
|
|
51
|
+
*/
|
|
52
|
+
export function jsonShapeOf(snapshot) {
|
|
53
|
+
const shape = snapshot.meta.extra[META_KEY];
|
|
54
|
+
return isJsonObject(shape) ? shape : null;
|
|
55
|
+
}
|
|
34
56
|
/**
|
|
35
57
|
* Whether a value is a plain JSON object (not null, not an array).
|
|
36
58
|
* @param value - any value
|
|
37
59
|
* @returns true for an object that is not an array
|
|
60
|
+
* @category Plugin helpers
|
|
38
61
|
*/
|
|
39
62
|
export function isJsonObject(value) {
|
|
40
63
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -45,6 +68,7 @@ export function isJsonObject(value) {
|
|
|
45
68
|
* @param record - the record
|
|
46
69
|
* @param key - the key
|
|
47
70
|
* @returns true when the key is an own property
|
|
71
|
+
* @category Plugin helpers
|
|
48
72
|
*/
|
|
49
73
|
export function hasKey(record, key) {
|
|
50
74
|
return Object.prototype.hasOwnProperty.call(record, key);
|
|
@@ -53,6 +77,7 @@ export function hasKey(record, key) {
|
|
|
53
77
|
* Whether a text names a dialect.
|
|
54
78
|
* @param value - any value
|
|
55
79
|
* @returns true for one of JSON_DIALECTS
|
|
80
|
+
* @category Plugin helpers
|
|
56
81
|
*/
|
|
57
82
|
export function isJsonDialect(value) {
|
|
58
83
|
return typeof value === "string" && JSON_DIALECTS.includes(value);
|
|
@@ -61,6 +86,7 @@ export function isJsonDialect(value) {
|
|
|
61
86
|
* Whether a text names a dialect the importer reads.
|
|
62
87
|
* @param value - any value
|
|
63
88
|
* @returns true for one of JSON_IMPORT_DIALECTS
|
|
89
|
+
* @category Plugin helpers
|
|
64
90
|
*/
|
|
65
91
|
export function isJsonImportDialect(value) {
|
|
66
92
|
return typeof value === "string" && JSON_IMPORT_DIALECTS.includes(value);
|
|
@@ -70,13 +96,15 @@ export function isJsonImportDialect(value) {
|
|
|
70
96
|
* `elements` or a top-level array of `{ data }` elements; OBO Graphs: `graphs[]` whose first graph
|
|
71
97
|
* has an edge with `sub` (or `subj`) and `obj` or a `pred`, or a node with `lbl`, `meta` or an OWL
|
|
72
98
|
* `type`; JGF: `graph.nodes` / `graph.edges` or any other `graphs[]`; graphology: `options.type` / `options.multi`, `key` nodes without `id`, edges with
|
|
73
|
-
* `undirected` or an `attributes` record
|
|
99
|
+
* `undirected` or an `attributes` record, and vis: edges with `from` / `to`, both only without
|
|
100
|
+
* NetworkX's `links` / `directed` / `multigraph` / `graph` keys; d3: `links` without
|
|
74
101
|
* `directed` / `multigraph` / `graph`; NetworkX adjacency_data: `nodes` and `adjacency` without
|
|
75
102
|
* `links` / `edges`; NetworkX tree_data: `children` without `nodes` / `links` / `edges`; else
|
|
76
103
|
* node-link). Pure: the importer wraps it with its issue
|
|
77
104
|
* codes, the registry's sniff() uses it on a head that parses as a whole document.
|
|
78
105
|
* @param root - the parsed document
|
|
79
106
|
* @returns the dialect, or null when the document is not a graph document in any dialect
|
|
107
|
+
* @category Plugin helpers
|
|
80
108
|
*/
|
|
81
109
|
export function sniffJsonDialect(root) {
|
|
82
110
|
if (Array.isArray(root)) {
|
|
@@ -93,7 +121,8 @@ export function sniffJsonDialect(root) {
|
|
|
93
121
|
return "jgf";
|
|
94
122
|
}
|
|
95
123
|
if (Array.isArray(root.graphs)) {
|
|
96
|
-
|
|
124
|
+
// any graph decides: an ontology's first graph may be an empty stub before its imports
|
|
125
|
+
return root.graphs.some((g) => isJsonObject(g) && isOboGraph(g)) ? "obographs" : "jgf";
|
|
97
126
|
}
|
|
98
127
|
if (!hasKey(root, "edges") && !hasKey(root, "links")) {
|
|
99
128
|
if (hasKey(root, "nodes") && hasKey(root, "adjacency")) {
|
|
@@ -108,15 +137,22 @@ export function sniffJsonDialect(root) {
|
|
|
108
137
|
if (isJsonObject(root.options) && (hasKey(root.options, "type") || hasKey(root.options, "multi"))) {
|
|
109
138
|
return "graphology";
|
|
110
139
|
}
|
|
111
|
-
|
|
140
|
+
// NetworkX's own keys (links, directed, multigraph, graph) settle node-link: one attribute named
|
|
141
|
+
// like a graphology or vis field (`attributes`, `undirected`, `key`, `from`) must not re-route it
|
|
142
|
+
const networkx = hasKey(root, "links") || hasKey(root, "directed") || hasKey(root, "multigraph") || hasKey(root, "graph");
|
|
143
|
+
if (!networkx && firstNode !== null && hasKey(firstNode, "key") && !hasKey(firstNode, "id")) {
|
|
112
144
|
return "graphology";
|
|
113
145
|
}
|
|
114
|
-
if (firstEdge !== null && !hasKey(firstEdge, "from")) {
|
|
146
|
+
if (!networkx && firstEdge !== null && !hasKey(firstEdge, "from")) {
|
|
115
147
|
if (hasKey(firstEdge, "undirected") || isJsonObject(firstEdge.attributes)) {
|
|
116
148
|
return "graphology";
|
|
117
149
|
}
|
|
118
150
|
}
|
|
119
|
-
if (
|
|
151
|
+
if (!networkx &&
|
|
152
|
+
firstEdge !== null &&
|
|
153
|
+
hasKey(firstEdge, "from") &&
|
|
154
|
+
hasKey(firstEdge, "to") &&
|
|
155
|
+
!hasKey(firstEdge, "source")) {
|
|
120
156
|
return "vis";
|
|
121
157
|
}
|
|
122
158
|
const bare = !hasKey(root, "directed") && !hasKey(root, "multigraph") && !hasKey(root, "graph");
|
|
@@ -158,6 +194,7 @@ function firstJsonObject(value) {
|
|
|
158
194
|
* from the JSON importer.
|
|
159
195
|
* @param meta - the snapshot's metadata
|
|
160
196
|
* @returns the fields found under `meta.extra.json`, each only when it has the expected type
|
|
197
|
+
* @category Plugin helpers
|
|
161
198
|
*/
|
|
162
199
|
export function shapeMetaOf(meta) {
|
|
163
200
|
const raw = meta.extra[META_KEY];
|
|
@@ -180,7 +217,10 @@ export function shapeMetaOf(meta) {
|
|
|
180
217
|
cytoscape: isJsonObject(raw.cytoscape) ? raw.cytoscape : undefined,
|
|
181
218
|
};
|
|
182
219
|
}
|
|
183
|
-
/**
|
|
220
|
+
/**
|
|
221
|
+
* The direction a dialect assumes when the file declares none (design section 8.4, `defaultDirected`).
|
|
222
|
+
* @category Plugin helpers
|
|
223
|
+
*/
|
|
184
224
|
export const DIALECT_DEFAULT_DIRECTED = Object.freeze({
|
|
185
225
|
"node-link": false,
|
|
186
226
|
d3: false,
|
|
@@ -259,9 +299,18 @@ const TABLES = Object.freeze({
|
|
|
259
299
|
hierarchy: false,
|
|
260
300
|
graphAttributes: false,
|
|
261
301
|
}),
|
|
302
|
+
// the OBO flat file's table: no column of the snapshot's own reads back as a column (the
|
|
303
|
+
// vocabulary columns have their places; every other one becomes property values or edge meta)
|
|
304
|
+
obographs: capabilities({
|
|
305
|
+
mixedDirection: false,
|
|
306
|
+
multiEdges: true,
|
|
307
|
+
selfLoops: true,
|
|
308
|
+
edgeIds: "none",
|
|
309
|
+
idCharset: "any",
|
|
310
|
+
}),
|
|
262
311
|
});
|
|
263
312
|
/**
|
|
264
|
-
* What one dialect can express
|
|
313
|
+
* What one dialect can express: positions and visual columns are written as
|
|
265
314
|
* plain attributes (an array for a multi-component column) and read back without their role,
|
|
266
315
|
* except Cytoscape's `position` object; containment only as the Cytoscape `data.parent`; mixed
|
|
267
316
|
* direction only where the dialect carries a per-edge flag (JGF `directed`, graphology
|
|
@@ -269,11 +318,15 @@ const TABLES = Object.freeze({
|
|
|
269
318
|
* graph attributes everywhere but d3 (the bare shape) and vis.
|
|
270
319
|
* @param dialect - the dialect
|
|
271
320
|
* @returns its frozen capability table
|
|
321
|
+
* @category Built-in formats
|
|
272
322
|
*/
|
|
273
323
|
export function dialectCapabilities(dialect) {
|
|
274
324
|
return TABLES[dialect];
|
|
275
325
|
}
|
|
276
|
-
/**
|
|
326
|
+
/**
|
|
327
|
+
* The Cytoscape element-level keys (everything else on an element lives under `data`).
|
|
328
|
+
* @category Plugin helpers
|
|
329
|
+
*/
|
|
277
330
|
export const CYTOSCAPE_ELEMENT_KEYS = new Set([
|
|
278
331
|
"selected",
|
|
279
332
|
"selectable",
|
|
@@ -284,12 +337,16 @@ export const CYTOSCAPE_ELEMENT_KEYS = new Set([
|
|
|
284
337
|
"scratch",
|
|
285
338
|
"renderedPosition",
|
|
286
339
|
]);
|
|
287
|
-
/**
|
|
340
|
+
/**
|
|
341
|
+
* The Cytoscape element keys the importer maps structurally rather than to columns.
|
|
342
|
+
* @category Plugin helpers
|
|
343
|
+
*/
|
|
288
344
|
export const CYTOSCAPE_STRUCTURAL_KEYS = new Set(["data", "group", "position", "classes"]);
|
|
289
345
|
/**
|
|
290
346
|
* The suffix the importer appends to a column name that collides with a structural column or a
|
|
291
347
|
* reserved key of its dialect (design section 5.6 names collisions deterministically); the exporter
|
|
292
348
|
* strips it when the value goes back to the level the suffix names.
|
|
349
|
+
* @category Plugin helpers
|
|
293
350
|
*/
|
|
294
351
|
export const SUFFIX = Object.freeze({
|
|
295
352
|
/** A Cytoscape `data` key or a JGF / graphology attribute that collides with a structural column. */
|
|
@@ -297,14 +354,47 @@ export const SUFFIX = Object.freeze({
|
|
|
297
354
|
/** An element-level key the dialect does not define (Cytoscape, JGF, graphology). */
|
|
298
355
|
element: "#element",
|
|
299
356
|
});
|
|
300
|
-
/**
|
|
357
|
+
/**
|
|
358
|
+
* The default source keys of a node-link edge record, tried in order (as fromRecords does).
|
|
359
|
+
* @category Plugin helpers
|
|
360
|
+
*/
|
|
301
361
|
export const NODE_LINK_SOURCE_KEYS = Object.freeze(["source", "src", "from"]);
|
|
302
|
-
/**
|
|
362
|
+
/**
|
|
363
|
+
* The default target keys of a node-link edge record, tried in order.
|
|
364
|
+
* @category Plugin helpers
|
|
365
|
+
*/
|
|
303
366
|
export const NODE_LINK_TARGET_KEYS = Object.freeze(["target", "dst", "to"]);
|
|
304
|
-
/**
|
|
367
|
+
/**
|
|
368
|
+
* The name of the position column every JSON dialect writes / reads (design section 5.2).
|
|
369
|
+
* @category Plugin helpers
|
|
370
|
+
*/
|
|
305
371
|
export const POSITION_COLUMN = "position";
|
|
306
|
-
/**
|
|
372
|
+
/**
|
|
373
|
+
* The name of the Cytoscape classes column (a list of strings with role "classes").
|
|
374
|
+
* @category Plugin helpers
|
|
375
|
+
*/
|
|
307
376
|
export const CLASSES_COLUMN = "classes";
|
|
308
|
-
/**
|
|
377
|
+
/**
|
|
378
|
+
* The name of the Cytoscape parent column (u32 refersTo node, role "parent").
|
|
379
|
+
* @category Plugin helpers
|
|
380
|
+
*/
|
|
309
381
|
export const PARENT_COLUMN = "parent";
|
|
382
|
+
/**
|
|
383
|
+
* An integer text beyond 2^53 in exponent form (`100000000000000000000` -> `1e+20`, the same
|
|
384
|
+
* digits): the importer reads an integer literal that large as its exact digits (a string), so
|
|
385
|
+
* a number must not be written as one.
|
|
386
|
+
* @param text - the shortest decimal text of a finite number
|
|
387
|
+
* @returns the text, or its exponent form for an integer literal of 16 or more digits
|
|
388
|
+
* @category Plugin helpers
|
|
389
|
+
*/
|
|
390
|
+
export function exponentIfUnsafe(text) {
|
|
391
|
+
const match = /^(-?)(\d{16,})$/.exec(text);
|
|
392
|
+
if (match === null || Number.isSafeInteger(Number(text))) {
|
|
393
|
+
return text;
|
|
394
|
+
}
|
|
395
|
+
const [, sign, digits] = match;
|
|
396
|
+
const mantissa = trimTrailingZeros(digits);
|
|
397
|
+
const fraction = mantissa.length > 1 ? `.${mantissa.slice(1)}` : "";
|
|
398
|
+
return `${sign}${mantissa[0]}${fraction}e+${digits.length - 1}`;
|
|
399
|
+
}
|
|
310
400
|
//# sourceMappingURL=dialect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialect.js","sourceRoot":"","sources":["../../../../src/formats/json/dialect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"dialect.js","sourceRoot":"","sources":["../../../../src/formats/json/dialect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAA2B,MAAM,CAAC,MAAM,CAAC;IAC/D,WAAW;IACX,IAAI;IACJ,KAAK;IACL,WAAW;IACX,YAAY;IACZ,KAAK;IACL,WAAW;CACd,CAAC,CAAC;AAUH;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAiC,MAAM,CAAC,MAAM,CAAC;IAC5E,GAAG,aAAa;IAChB,WAAW;IACX,MAAM;CACT,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AA+B/B;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,QAAuB;IAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CA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C,CAAC,EAAE,CAAC;QACvD,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;IAC/B,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACpE,OAAO,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,KAAK,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;AACpE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The JSON exporter (design section 8.5): one GraphExporter with a `dialect` option writing
|
|
3
3
|
* NetworkX node-link (the default), d3 (`links`, optional index endpoints), JSON Graph Format v2,
|
|
4
|
-
* Cytoscape.js elements, graphology
|
|
4
|
+
* Cytoscape.js elements, graphology serialization or vis.js. The dialect defaults to the one the
|
|
5
5
|
* importer recorded under `meta.extra.json` so a JSON file re-exported as JSON keeps its shape,
|
|
6
6
|
* and to node-link for a snapshot from any other source.
|
|
7
7
|
*
|
|
@@ -17,48 +17,113 @@
|
|
|
17
17
|
* value is its JSON text; an unset row writes no key (design section 5.3). Non-finite numbers,
|
|
18
18
|
* which JSON cannot carry, become null and are reported.
|
|
19
19
|
*/
|
|
20
|
-
import { type ExportCapabilities, type GraphExporter } from "../../types.js";
|
|
20
|
+
import { type CommonExportOptions, type ExportCapabilities, type GraphExporter } from "../../types.js";
|
|
21
21
|
import { type JsonDialect } from "./dialect.js";
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The format-specific options of the JSON exporter.
|
|
24
|
+
* @category Built-in formats
|
|
25
|
+
*/
|
|
26
|
+
export interface JsonExportOptions extends CommonExportOptions {
|
|
27
|
+
/**
|
|
28
|
+
* The dialect to write. The default is the dialect a JSON import read, else "node-link".
|
|
29
|
+
* Attributes are written under their own names; vis.js shows the `label` attribute, so rename
|
|
30
|
+
* the attribute you want shown to `label` first (`snapshot.nodes.rename("name", "label")`). A CSV
|
|
31
|
+
* dialect name ("gephi", "generic"), from an options object shared with CSV saves, is ignored.
|
|
32
|
+
* @defaultValue as read, else "node-link"
|
|
33
|
+
*/
|
|
25
34
|
dialect?: JsonDialect | undefined;
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
/**
|
|
36
|
+
* The indentation of one level: a number of spaces, or the text itself (spaces or tabs, such as
|
|
37
|
+
* "\t"). 0 or "" writes compact JSON on one line.
|
|
38
|
+
* @defaultValue 0
|
|
39
|
+
*/
|
|
40
|
+
indent?: number | string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* node-link and d3: the key of the edge array. The default is the key a JSON import read, else
|
|
43
|
+
* "edges" ("links" for d3).
|
|
44
|
+
* @defaultValue as read, else "edges"
|
|
45
|
+
*/
|
|
29
46
|
edgesKey?: string | undefined;
|
|
30
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* node-link, d3 and vis: the node id key. The default is the key a JSON import read, else "id".
|
|
49
|
+
* @defaultValue as read, else "id"
|
|
50
|
+
*/
|
|
31
51
|
nodeIdKey?: string | undefined;
|
|
32
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* node-link and d3: write edge ends as positions in the node array instead of ids. The default
|
|
54
|
+
* is what a JSON import read, else false.
|
|
55
|
+
* @defaultValue as read, else false
|
|
56
|
+
*/
|
|
33
57
|
indexLinks?: boolean | undefined;
|
|
34
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* node-link, d3 and vis: the source key. The default is the key a JSON import read, else
|
|
60
|
+
* "source" ("from" for vis). graph-io finds "source", "src" and "from" by itself; for another
|
|
61
|
+
* key, read the file back with the same `sourceKey` import option. Without it every edge is an
|
|
62
|
+
* `E_MISSING_ENDPOINT` error and is skipped, and a file with more edges than `errorLimit` (100 by
|
|
63
|
+
* default) fails to load with an `ImportError`. `checkExport()` does not warn about this.
|
|
64
|
+
* @defaultValue as read, else "source"
|
|
65
|
+
*/
|
|
35
66
|
sourceKey?: string | undefined;
|
|
36
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* node-link, d3 and vis: the target key. The default is the key a JSON import read, else
|
|
69
|
+
* "target" ("to" for vis). graph-io finds "target", "dst" and "to" by itself; for another key,
|
|
70
|
+
* read the file back with the same `targetKey` import option, as for `sourceKey`.
|
|
71
|
+
* @defaultValue as read, else "target"
|
|
72
|
+
*/
|
|
37
73
|
targetKey?: string | undefined;
|
|
38
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* The key the weight is written under, in every dialect but OBO Graphs, which always writes the
|
|
76
|
+
* weight as "weight" in each edge's `meta` (checkExport() then returns W_OBOGRAPHS_EDGE_COLUMN_AS_META).
|
|
77
|
+
* The default is the key a JSON import read the weights from, else "weight". For another key,
|
|
78
|
+
* read the file back with `weightFrom` set to it, or the weights come back as a plain edge
|
|
79
|
+
* attribute.
|
|
80
|
+
* @defaultValue as read, else "weight"
|
|
81
|
+
*/
|
|
39
82
|
weightKey?: string | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* OBO Graphs: the graph id written when the graph has none. A graph read from an OBO Graphs
|
|
85
|
+
* document keeps its own graph id, which this option does not change. Node ids are written in
|
|
86
|
+
* the form graph-io reads back as the same id: an IRI as it is, a prefixed id such as
|
|
87
|
+
* `GO:0008150` as its OBO address, and an id without a prefix (`a`) under the default OBO
|
|
88
|
+
* address (`http://purl.obolibrary.org/obo/graph.owl#a`), or as it is when you pass another IRI
|
|
89
|
+
* here. The default is `http://purl.obolibrary.org/obo/<ontology>.owl`.
|
|
90
|
+
* @defaultValue the ontology's OBO address
|
|
91
|
+
*/
|
|
92
|
+
ontologyIri?: string | undefined;
|
|
40
93
|
}
|
|
41
94
|
/**
|
|
42
95
|
* The LossNote codes of the JSON exporter's check(): the dialect-specific ones and, aliased, the
|
|
43
96
|
* shared ones it records (`LOSS` holds the rest of the generic pre-flight's codes). A key is the
|
|
44
97
|
* code without its severity prefix.
|
|
98
|
+
* @category Built-in formats
|
|
45
99
|
*/
|
|
46
100
|
export declare const JSON_LOSS: Readonly<{
|
|
47
101
|
/** Non-finite numbers (columns, weights) are written as null. */
|
|
48
102
|
NONFINITE_AS_NULL: "W_NONFINITE_AS_NULL";
|
|
49
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* The file cannot record direction: an undirected graph's edges read back as directed, or the whole graph reads
|
|
105
|
+
* back with the importer's default direction.
|
|
106
|
+
*/
|
|
50
107
|
DIRECTION_DROPPED: "W_DIRECTION_DROPPED";
|
|
51
108
|
/** GEXF mutual pairs are written as two directed edges. */
|
|
52
109
|
MUTUAL_EXPANDED: "W_MUTUAL_EXPANDED";
|
|
53
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* JGF keys its nodes by text, so number ids read back as text, unless you read the file with `ids: "canonical"`.
|
|
112
|
+
*/
|
|
54
113
|
NUMERIC_IDS_STRINGIFIED: "W_NUMERIC_IDS_STRINGIFIED";
|
|
55
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Two node ids would be written as the same text (the number 5 and the text "5"); the save fails with
|
|
116
|
+
* E_INVALID_ID.
|
|
117
|
+
*/
|
|
56
118
|
ID_TEXT_COLLISION: "E_ID_TEXT_COLLISION";
|
|
57
|
-
/**
|
|
119
|
+
/** The nodes read back in a different order. */
|
|
58
120
|
NODE_ORDER: "W_NODE_ORDER";
|
|
59
121
|
/** A column named like a reserved key of the dialect (id, source, target, ...) is skipped. */
|
|
60
122
|
RESERVED_KEY: "W_RESERVED_KEY";
|
|
61
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* An attribute without the weight role is named like the key weights are written under; it reads back as the edge
|
|
125
|
+
* weight, or is not written when the graph has weights of its own.
|
|
126
|
+
*/
|
|
62
127
|
WEIGHT_KEY_CLASH: "W_WEIGHT_KEY_CLASH";
|
|
63
128
|
/** A position column without a slot (every dialect but Cytoscape) is a plain array attribute; the role is lost. */
|
|
64
129
|
POSITIONS_DROPPED: "W_POSITIONS_DROPPED";
|
|
@@ -66,24 +131,71 @@ export declare const JSON_LOSS: Readonly<{
|
|
|
66
131
|
POSITION_Z_DROPPED: "W_POSITION_Z_DROPPED";
|
|
67
132
|
/** Cytoscape has a single parent; a `parents` list column cannot be written. */
|
|
68
133
|
PARENTS_DROPPED: "W_PARENTS_DROPPED";
|
|
69
|
-
/**
|
|
134
|
+
/** Node-link / d3 have no edge id slot; the id column is written as a plain attribute. */
|
|
70
135
|
EDGE_IDS_DROPPED: "W_EDGE_IDS_DROPPED";
|
|
71
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* A number attribute whose values are all whole numbers reads back as integers, because the format does not record
|
|
138
|
+
* the type.
|
|
139
|
+
*/
|
|
72
140
|
INTEGRAL_F64_AS_I32: "W_INTEGRAL_F64_AS_I32";
|
|
73
|
-
/**
|
|
141
|
+
/** An attribute with a role the format has no place for is written as a plain attribute; the role is lost. */
|
|
74
142
|
ROLE_DROPPED: "W_ROLE_DROPPED";
|
|
75
143
|
/** A column without a set cell is not written (JSON declares no columns). */
|
|
76
144
|
EMPTY_COLUMN_DROPPED: "W_EMPTY_COLUMN_DROPPED";
|
|
145
|
+
/**
|
|
146
|
+
* Obographs: an edge column (or the explicit weights) is written into each edge's meta and reads back inside the
|
|
147
|
+
* meta column.
|
|
148
|
+
*/
|
|
149
|
+
OBOGRAPHS_EDGE_COLUMN_AS_META: "W_OBOGRAPHS_EDGE_COLUMN_AS_META";
|
|
150
|
+
/**
|
|
151
|
+
* Obographs: a node id or relation is written as an IRI the importer's default oboIds "curie" reads back as
|
|
152
|
+
* another id.
|
|
153
|
+
*/
|
|
154
|
+
OBOGRAPHS_ID_CHANGED: "W_OBOGRAPHS_ID_CHANGED";
|
|
155
|
+
/** Obographs: a property_value's xsd datatype has no place in basicPropertyValues and reads back unset. */
|
|
156
|
+
OBOGRAPHS_DATATYPE_DROPPED: "W_OBOGRAPHS_DATATYPE_DROPPED";
|
|
157
|
+
/** Obographs: a node column outside the OBO vocabulary reads back inside the property_value column. */
|
|
158
|
+
COLUMN_AS_PROPERTY_VALUE: "W_COLUMN_AS_PROPERTY_VALUE";
|
|
159
|
+
/** Obographs: an edge without a relation is written with the pred is_a. */
|
|
160
|
+
RELATION_ASSUMED: "W_RELATION_ASSUMED";
|
|
161
|
+
/**
|
|
162
|
+
* Obographs: Typedef nodes are written as PROPERTY nodes, which read back as nodes only under typedefs: "nodes".
|
|
163
|
+
*/
|
|
164
|
+
TYPEDEF_NODES: "W_TYPEDEF_NODES";
|
|
165
|
+
/**
|
|
166
|
+
* OBO Graphs: a graph attribute is written into the graph's `meta` and reads back in
|
|
167
|
+
* `snapshot.meta.extra.obographs`.
|
|
168
|
+
*/
|
|
169
|
+
GRAPH_COLUMN_AS_METADATA: "W_GRAPH_COLUMN_AS_METADATA";
|
|
170
|
+
/** Obographs: numeric node ids are written as text and read back as strings. */
|
|
171
|
+
ID_TEXT_TYPE: "W_ID_TEXT_TYPE";
|
|
172
|
+
/**
|
|
173
|
+
* An attribute without a role is written where the format keeps a role (for example, a `name` column as the label), and
|
|
174
|
+
* reads back with that role.
|
|
175
|
+
*/
|
|
176
|
+
ROLE_ASSUMED: "W_ROLE_ASSUMED";
|
|
177
|
+
/**
|
|
178
|
+
* An attribute with a role (for example, the label) is written where the format keeps that role, and reads back under the
|
|
179
|
+
* name the format's importer gives it.
|
|
180
|
+
*/
|
|
181
|
+
COLUMN_NAME_CHANGED: "W_COLUMN_NAME_CHANGED";
|
|
182
|
+
/**
|
|
183
|
+
* OBO Graphs: an OBO attribute stored as text where graph-io uses a dictionary (or the other way round); it reads
|
|
184
|
+
* back with graph-io's usual type. The values are the same.
|
|
185
|
+
*/
|
|
186
|
+
DTYPE_UNSUPPORTED: "W_DTYPE_UNSUPPORTED";
|
|
77
187
|
}>;
|
|
78
188
|
/**
|
|
79
|
-
* The JSON exporter plugin
|
|
189
|
+
* The JSON exporter plugin. `capabilities` is the node-link table (the
|
|
80
190
|
* default dialect); check() applies the table of the dialect actually selected.
|
|
191
|
+
* @category Built-in formats
|
|
81
192
|
*/
|
|
82
193
|
export declare const jsonExporter: GraphExporter<JsonExportOptions>;
|
|
83
194
|
/**
|
|
84
195
|
* The capability table of one dialect, for callers that pick a dialect before check().
|
|
85
196
|
* @param dialect - the dialect
|
|
86
197
|
* @returns the frozen table
|
|
198
|
+
* @category Built-in formats
|
|
87
199
|
*/
|
|
88
200
|
export declare function jsonCapabilities(dialect: JsonDialect): ExportCapabilities;
|
|
89
201
|
//# sourceMappingURL=exporter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../../src/formats/json/exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../../src/formats/json/exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAaH,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAiB,MAAM,gBAAgB,CAAC;AACtH,OAAO,EAOH,KAAK,WAAW,EAInB,MAAM,cAAc,CAAC;AAGtB;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC1D;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAClC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;;;OAIG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