@graphty/graph-io 0.3.38 → 0.3.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{choose-CsO24U-5.js → choose-CS3fvGT1.js} +2 -2
- package/dist/chunks/{choose-CsO24U-5.js.map → choose-CS3fvGT1.js.map} +1 -1
- package/dist/chunks/{constants-BPRiVyBu.js → constants-DqKZT6cH.js} +2 -2
- package/dist/chunks/{constants-BPRiVyBu.js.map → constants-DqKZT6cH.js.map} +1 -1
- package/dist/chunks/{escape-BRcyzD77.js → escape-BJRLd3vJ.js} +4 -3
- package/dist/chunks/escape-BJRLd3vJ.js.map +1 -0
- package/dist/chunks/{export-CTUlibzr.js → export-B-aVCwyG.js} +103 -92
- package/dist/chunks/export-B-aVCwyG.js.map +1 -0
- package/dist/chunks/{exporter-Bf5tZA0X.js → exporter-6ocL_9x_.js} +6 -5
- package/dist/chunks/exporter-6ocL_9x_.js.map +1 -0
- package/dist/chunks/{exporter-Bn4jdYfd.js → exporter-BVXnV9-9.js} +43 -30
- package/dist/chunks/exporter-BVXnV9-9.js.map +1 -0
- package/dist/chunks/{exporter-D-qQuRcG.js → exporter-Bcp-l4Bo.js} +6 -6
- package/dist/chunks/exporter-Bcp-l4Bo.js.map +1 -0
- package/dist/chunks/{exporter-F0vT919P.js → exporter-SFYkDzD0.js} +5 -4
- package/dist/chunks/exporter-SFYkDzD0.js.map +1 -0
- package/dist/chunks/{importer-Bgb9sgZZ.js → importer-AjwOJrn2.js} +6 -8
- package/dist/chunks/importer-AjwOJrn2.js.map +1 -0
- package/dist/chunks/{importer-BuzbaFFY.js → importer-BJlGAOht.js} +28 -13
- package/dist/chunks/importer-BJlGAOht.js.map +1 -0
- package/dist/chunks/{importer-DqMtyYLX.js → importer-BpuS3J8C.js} +12 -14
- package/dist/chunks/importer-BpuS3J8C.js.map +1 -0
- package/dist/chunks/{importer-CEuUmyPe.js → importer-CPqnIY8m.js} +6 -6
- package/dist/chunks/{importer-CEuUmyPe.js.map → importer-CPqnIY8m.js.map} +1 -1
- package/dist/chunks/{importer-yWUPR_nU.js → importer-DEp_fYjf.js} +30 -12
- package/dist/chunks/importer-DEp_fYjf.js.map +1 -0
- package/dist/chunks/{importer-CNMQnHDd.js → importer-D_srHyj6.js} +112 -62
- package/dist/chunks/importer-D_srHyj6.js.map +1 -0
- package/dist/chunks/{importer-oIUx9u_g.js → importer-DcKB97kW.js} +40 -18
- package/dist/chunks/importer-DcKB97kW.js.map +1 -0
- package/dist/chunks/{json-elements-AkglPS3m.js → json-elements-DpO6AXIc.js} +7 -5
- package/dist/chunks/{json-elements-AkglPS3m.js.map → json-elements-DpO6AXIc.js.map} +1 -1
- package/dist/chunks/{ontology-export-DDoG3egY.js → ontology-export-50L9DOV4.js} +2 -2
- package/dist/chunks/{ontology-export-DDoG3egY.js.map → ontology-export-50L9DOV4.js.map} +1 -1
- package/dist/chunks/{records-ChmWZGuz.js → records-r3SFHz11.js} +137 -96
- package/dist/chunks/records-r3SFHz11.js.map +1 -0
- package/dist/chunks/{text-Btw3sBe_.js → text-Bjfa1xYL.js} +2 -2
- package/dist/chunks/{text-Btw3sBe_.js.map → text-Bjfa1xYL.js.map} +1 -1
- package/dist/csv.js +4 -4
- package/dist/cx.js +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +1 -1
- package/dist/gexf.js +6 -4
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +8 -6
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +26 -26
- package/dist/graphml.js +2 -2
- package/dist/json.js +1 -1
- package/dist/neo4j.js +3 -3
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/src/common/direction.js +1 -1
- package/dist/src/common/direction.js.map +1 -1
- package/dist/src/common/export.d.ts.map +1 -1
- package/dist/src/common/export.js +136 -71
- package/dist/src/common/export.js.map +1 -1
- package/dist/src/common/input.js +1 -1
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/json-elements.d.ts.map +1 -1
- package/dist/src/common/json-elements.js +4 -2
- package/dist/src/common/json-elements.js.map +1 -1
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +2 -1
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/formats/csv/records.d.ts.map +1 -1
- package/dist/src/formats/csv/records.js +138 -100
- package/dist/src/formats/csv/records.js.map +1 -1
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +108 -53
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx2/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx2/exporter.js +2 -1
- package/dist/src/formats/cx2/exporter.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +28 -6
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts +6 -0
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +11 -6
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/names.d.ts +5 -0
- package/dist/src/formats/dot/names.d.ts.map +1 -1
- package/dist/src/formats/dot/names.js +5 -0
- package/dist/src/formats/dot/names.js.map +1 -1
- package/dist/src/formats/dot/tokenizer.js +9 -9
- package/dist/src/formats/dot/tokenizer.js.map +1 -1
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +4 -2
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts +6 -0
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +6 -3
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
- package/dist/src/formats/graphml/exporter.js +2 -1
- package/dist/src/formats/graphml/exporter.js.map +1 -1
- package/dist/src/formats/graphml/importer.d.ts.map +1 -1
- package/dist/src/formats/graphml/importer.js +5 -6
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/obo/importer.d.ts.map +1 -1
- package/dist/src/formats/obo/importer.js +2 -1
- package/dist/src/formats/obo/importer.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +4 -5
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts +6 -0
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +33 -10
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +54 -22
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/sniff.js +1 -1
- package/dist/src/sniff.js.map +1 -1
- package/dist/xgmml.js +2 -2
- package/package.json +2 -2
- package/src/common/direction.ts +1 -1
- package/src/common/export.ts +190 -97
- package/src/common/input.ts +1 -1
- package/src/common/json-elements.ts +4 -2
- package/src/common/xml.ts +2 -1
- package/src/formats/csv/records.ts +143 -99
- package/src/formats/cx/importer.ts +140 -58
- package/src/formats/cx2/exporter.ts +2 -1
- package/src/formats/cx2/importer.ts +34 -10
- package/src/formats/dot/importer.ts +35 -4
- package/src/formats/dot/names.ts +6 -0
- package/src/formats/dot/tokenizer.ts +9 -9
- package/src/formats/gexf/exporter.ts +4 -2
- package/src/formats/gml/importer.ts +14 -3
- package/src/formats/graphml/exporter.ts +2 -3
- package/src/formats/graphml/importer.ts +5 -6
- package/src/formats/obo/importer.ts +2 -1
- package/src/formats/pajek/exporter.ts +6 -4
- package/src/formats/xgmml/emit.ts +34 -10
- package/src/formats/xgmml/exporter.ts +63 -23
- package/src/sniff.ts +1 -1
- package/dist/chunks/escape-BRcyzD77.js.map +0 -1
- package/dist/chunks/export-CTUlibzr.js.map +0 -1
- package/dist/chunks/exporter-Bf5tZA0X.js.map +0 -1
- package/dist/chunks/exporter-Bn4jdYfd.js.map +0 -1
- package/dist/chunks/exporter-D-qQuRcG.js.map +0 -1
- package/dist/chunks/exporter-F0vT919P.js.map +0 -1
- package/dist/chunks/importer-Bgb9sgZZ.js.map +0 -1
- package/dist/chunks/importer-BuzbaFFY.js.map +0 -1
- package/dist/chunks/importer-CNMQnHDd.js.map +0 -1
- package/dist/chunks/importer-DqMtyYLX.js.map +0 -1
- package/dist/chunks/importer-oIUx9u_g.js.map +0 -1
- package/dist/chunks/importer-yWUPR_nU.js.map +0 -1
- package/dist/chunks/records-ChmWZGuz.js.map +0 -1
|
@@ -3819,109 +3819,120 @@ const ROLE_WORDS = {
|
|
|
3819
3819
|
};
|
|
3820
3820
|
function checkColumns(table, domain, caps, extras, note) {
|
|
3821
3821
|
for (const column of table) {
|
|
3822
|
-
const {
|
|
3823
|
-
const { name, role } = meta;
|
|
3822
|
+
const { name, role } = column.meta;
|
|
3824
3823
|
if (role !== null && STRUCTURAL_ROLES.has(role)) {
|
|
3825
3824
|
continue;
|
|
3826
3825
|
}
|
|
3827
3826
|
const label = `${domain} column "${name}"`;
|
|
3828
|
-
|
|
3829
|
-
if (role !== null && roleNames !== void 0) {
|
|
3830
|
-
const fixed = roleNames[role];
|
|
3831
|
-
if (fixed !== void 0 && fixed !== name) {
|
|
3832
|
-
note(
|
|
3833
|
-
LOSS.COLUMN_NAME_CHANGED,
|
|
3834
|
-
`${label} (the ${ROLE_WORDS[role] ?? role}) is written as the format's own ${role} and reads back as "${fixed}"`,
|
|
3835
|
-
name,
|
|
3836
|
-
column.length - column.nullCount
|
|
3837
|
-
);
|
|
3838
|
-
}
|
|
3839
|
-
}
|
|
3827
|
+
noteRenamedRole(column, label, roleNamesOf(domain, extras), note);
|
|
3840
3828
|
if (domain === "edge" && role === "id") {
|
|
3841
3829
|
continue;
|
|
3842
3830
|
}
|
|
3843
|
-
|
|
3844
|
-
if (writesAttributes(domain, extras) === false && !named && !(role !== null && (extras.roles?.has(role) ?? false))) {
|
|
3831
|
+
if (isDroppedColumn(column, domain, extras)) {
|
|
3845
3832
|
note(LOSS.COLUMN_DROPPED, `${label} is not written`, name, column.length - column.nullCount);
|
|
3846
3833
|
continue;
|
|
3847
3834
|
}
|
|
3848
|
-
if (
|
|
3849
|
-
|
|
3850
|
-
note(
|
|
3851
|
-
LOSS.TEMPORAL_TEXT,
|
|
3852
|
-
`${label} (the original text of a date or time column) cannot be written`,
|
|
3853
|
-
name,
|
|
3854
|
-
column.length - column.nullCount
|
|
3855
|
-
);
|
|
3856
|
-
}
|
|
3857
|
-
continue;
|
|
3835
|
+
if (!checkSlotRole(column, label, caps, extras, note)) {
|
|
3836
|
+
checkAttributeColumn(column, label, caps, extras, note);
|
|
3858
3837
|
}
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
note(LOSS.TEMPORAL, `${label} (${role}) cannot be written`, name, column.length - column.nullCount);
|
|
3887
|
-
}
|
|
3888
|
-
continue;
|
|
3889
|
-
}
|
|
3890
|
-
if (role === "spells") {
|
|
3891
|
-
if (caps.temporal !== "spells" && caps.temporal !== "dynamic-values") {
|
|
3892
|
-
note(LOSS.SPELLS, `${label} (spells) cannot be written`, name, column.length - column.nullCount);
|
|
3893
|
-
}
|
|
3894
|
-
continue;
|
|
3895
|
-
}
|
|
3896
|
-
if (role === "open" || role === "spellsOpen") {
|
|
3897
|
-
if (extras.openIntervals !== true) {
|
|
3898
|
-
note(
|
|
3899
|
-
LOSS.OPEN_INTERVAL,
|
|
3900
|
-
`${label} (open intervals) cannot be written`,
|
|
3901
|
-
name,
|
|
3902
|
-
column.length - column.nullCount
|
|
3903
|
-
);
|
|
3904
|
-
}
|
|
3905
|
-
continue;
|
|
3906
|
-
}
|
|
3907
|
-
if (role !== null && !(extras.roles?.has(role) ?? false)) {
|
|
3908
|
-
note(
|
|
3909
|
-
LOSS.ROLE,
|
|
3910
|
-
`${label} (${role}) is written as a plain attribute; the format has no ${role} slot and the role is lost`,
|
|
3911
|
-
name,
|
|
3912
|
-
column.length - column.nullCount
|
|
3913
|
-
);
|
|
3914
|
-
}
|
|
3915
|
-
if (meta.dynamic && caps.temporal !== "dynamic-values") {
|
|
3916
|
-
note(LOSS.DYNAMIC_VALUES, `${label} is dynamic; only its static value can be written`, name, null);
|
|
3917
|
-
}
|
|
3918
|
-
checkDtype(column, label, caps, note);
|
|
3919
|
-
if (meta.default !== void 0 && !caps.defaults) {
|
|
3920
|
-
note(LOSS.DEFAULT, `${label} declares a default; the format has no defaults`, name, null);
|
|
3921
|
-
}
|
|
3922
|
-
if (meta.options !== null && !caps.options) {
|
|
3923
|
-
note(LOSS.OPTIONS, `${label} declares options; the format has no enumerations`, name, null);
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3840
|
+
function noteRenamedRole(column, label, roleNames, note) {
|
|
3841
|
+
const { name, role } = column.meta;
|
|
3842
|
+
if (role === null || roleNames === void 0) {
|
|
3843
|
+
return;
|
|
3844
|
+
}
|
|
3845
|
+
const fixed = roleNames[role];
|
|
3846
|
+
if (fixed !== void 0 && fixed !== name) {
|
|
3847
|
+
note(
|
|
3848
|
+
LOSS.COLUMN_NAME_CHANGED,
|
|
3849
|
+
`${label} (the ${ROLE_WORDS[role] ?? role}) is written as the format's own ${role} and reads back as "${fixed}"`,
|
|
3850
|
+
name,
|
|
3851
|
+
column.length - column.nullCount
|
|
3852
|
+
);
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
function isDroppedColumn(column, domain, extras) {
|
|
3856
|
+
const { name, role } = column.meta;
|
|
3857
|
+
const named = extras.writtenColumns?.[domain]?.includes(name) ?? false;
|
|
3858
|
+
return writesAttributes(domain, extras) === false && !named && !(role !== null && (extras.roles?.has(role) ?? false));
|
|
3859
|
+
}
|
|
3860
|
+
function slotRules() {
|
|
3861
|
+
const rules = /* @__PURE__ */ new Map();
|
|
3862
|
+
const add = (roles, rule) => {
|
|
3863
|
+
for (const role of roles) {
|
|
3864
|
+
rules.set(role, rule);
|
|
3924
3865
|
}
|
|
3866
|
+
};
|
|
3867
|
+
add(["timeText"], {
|
|
3868
|
+
code: LOSS.TEMPORAL_TEXT,
|
|
3869
|
+
what: "the original text of a date or time column",
|
|
3870
|
+
written: (_caps, extras) => extras.temporalText === true
|
|
3871
|
+
});
|
|
3872
|
+
add(VIZ_ROLES, { code: LOSS.VIZ, written: (caps) => caps.viz });
|
|
3873
|
+
add(HIERARCHY_ROLES, { code: LOSS.HIERARCHY, written: (caps) => caps.hierarchy });
|
|
3874
|
+
add(TEMPORAL_ROLES, { code: LOSS.TEMPORAL, written: (caps) => caps.temporal !== "none" });
|
|
3875
|
+
add(["spells"], {
|
|
3876
|
+
code: LOSS.SPELLS,
|
|
3877
|
+
what: "spells",
|
|
3878
|
+
written: (caps) => caps.temporal === "spells" || caps.temporal === "dynamic-values"
|
|
3879
|
+
});
|
|
3880
|
+
add(["open", "spellsOpen"], {
|
|
3881
|
+
code: LOSS.OPEN_INTERVAL,
|
|
3882
|
+
what: "open intervals",
|
|
3883
|
+
written: (_caps, extras) => extras.openIntervals === true
|
|
3884
|
+
});
|
|
3885
|
+
return rules;
|
|
3886
|
+
}
|
|
3887
|
+
const SLOT_RULES = slotRules();
|
|
3888
|
+
function checkSlotRole(column, label, caps, extras, note) {
|
|
3889
|
+
const { name, role } = column.meta;
|
|
3890
|
+
if (role === "position") {
|
|
3891
|
+
checkPositionColumn(column, label, caps, extras, note);
|
|
3892
|
+
return true;
|
|
3893
|
+
}
|
|
3894
|
+
const rule = role === null ? void 0 : SLOT_RULES.get(role);
|
|
3895
|
+
if (role === null || rule === void 0) {
|
|
3896
|
+
return false;
|
|
3897
|
+
}
|
|
3898
|
+
if (!rule.written(caps, extras)) {
|
|
3899
|
+
note(rule.code, `${label} (${rule.what ?? role}) cannot be written`, name, column.length - column.nullCount);
|
|
3900
|
+
}
|
|
3901
|
+
return true;
|
|
3902
|
+
}
|
|
3903
|
+
function checkPositionColumn(column, label, caps, extras, note) {
|
|
3904
|
+
const { meta } = column;
|
|
3905
|
+
if (!caps.positions) {
|
|
3906
|
+
note(LOSS.POSITIONS, `${label} (positions) cannot be written`, meta.name, column.length - column.nullCount);
|
|
3907
|
+
} else if (extras.positionDtype !== void 0 && meta.dtype !== extras.positionDtype) {
|
|
3908
|
+
note(
|
|
3909
|
+
LOSS.DTYPE,
|
|
3910
|
+
`${label} (positions) is ${meta.dtype}; the format reads positions back as ${extras.positionDtype}`,
|
|
3911
|
+
meta.name,
|
|
3912
|
+
column.length - column.nullCount
|
|
3913
|
+
);
|
|
3914
|
+
}
|
|
3915
|
+
}
|
|
3916
|
+
function checkAttributeColumn(column, label, caps, extras, note) {
|
|
3917
|
+
const { meta } = column;
|
|
3918
|
+
const { name, role } = meta;
|
|
3919
|
+
if (role !== null && !(extras.roles?.has(role) ?? false)) {
|
|
3920
|
+
note(
|
|
3921
|
+
LOSS.ROLE,
|
|
3922
|
+
`${label} (${role}) is written as a plain attribute; the format has no ${role} slot and the role is lost`,
|
|
3923
|
+
name,
|
|
3924
|
+
column.length - column.nullCount
|
|
3925
|
+
);
|
|
3926
|
+
}
|
|
3927
|
+
if (meta.dynamic && caps.temporal !== "dynamic-values") {
|
|
3928
|
+
note(LOSS.DYNAMIC_VALUES, `${label} is dynamic; only its static value can be written`, name, null);
|
|
3929
|
+
}
|
|
3930
|
+
checkDtype(column, label, caps, note);
|
|
3931
|
+
if (meta.default !== void 0 && !caps.defaults) {
|
|
3932
|
+
note(LOSS.DEFAULT, `${label} declares a default; the format has no defaults`, name, null);
|
|
3933
|
+
}
|
|
3934
|
+
if (meta.options !== null && !caps.options) {
|
|
3935
|
+
note(LOSS.OPTIONS, `${label} declares options; the format has no enumerations`, name, null);
|
|
3925
3936
|
}
|
|
3926
3937
|
}
|
|
3927
3938
|
function checkDtype(column, label, caps, note) {
|
|
@@ -4357,4 +4368,4 @@ export {
|
|
|
4357
4368
|
INVALID_ENCODING_CODE as y,
|
|
4358
4369
|
INVALID_UTF8_CODE as z
|
|
4359
4370
|
};
|
|
4360
|
-
//# sourceMappingURL=export-
|
|
4371
|
+
//# sourceMappingURL=export-B-aVCwyG.js.map
|