ExposoGraph.exporter

Export and parse the knowledge graph as interactive HTML, Plotly HTML, JS, JSON, and GEXF.

All engine-based export helpers accept a visibility argument so you can export:

  • the full graph (all)

  • validated content only (validated_only)

  • exploratory content only (exploratory_only)

Export the knowledge graph to HTML, Plotly HTML, JSON, graph-data.js, and GEXF.

ExposoGraph.exporter.parse_graph_data_text(raw)[source]

Parse JS/HTML text that contains a GRAPH_DATA object assignment.

Uses a JSON5 parser to handle unquoted keys, single-line comments, and trailing commas that are valid in JavaScript but not in JSON.

Parameters:

raw (str)

Return type:

KnowledgeGraph

ExposoGraph.exporter.parse_graph_data_js(path)[source]

Parse a graph-data.js file.

Parameters:

path (str | Path)

Return type:

KnowledgeGraph

ExposoGraph.exporter.parse_graph_html(path)[source]

Parse a standalone HTML graph export with embedded GRAPH_DATA.

Parameters:

path (str | Path)

Return type:

KnowledgeGraph

ExposoGraph.exporter.parse_graph_artifact(path)[source]

Parse JSON, JS, or HTML graph artifacts.

Parameters:

path (str | Path)

Return type:

KnowledgeGraph

ExposoGraph.exporter.to_graph_data_js(engine, path, *, visibility=GraphVisibility.ALL)[source]

Write a graph-data.js file consumable by the D3 viewer.

Parameters:
Return type:

Path

ExposoGraph.exporter.to_plotly_figure(engine, *, visibility=GraphVisibility.ALL, title=None)[source]

Build an interactive Plotly figure for the graph.

Parameters:
Return type:

Any

ExposoGraph.exporter.to_plotly_html_string(engine, *, visibility=GraphVisibility.ALL, title=None, include_plotlyjs=True)[source]

Render a standalone Plotly HTML document.

Parameters:
Return type:

str

ExposoGraph.exporter.to_plotly_html(engine, path, *, visibility=GraphVisibility.ALL, title=None, include_plotlyjs=True)[source]

Write a standalone Plotly HTML file.

Parameters:
Return type:

Path

ExposoGraph.exporter.to_interactive_html_string(engine, *, template_path=None, visibility=GraphVisibility.ALL)[source]

Render a self-contained interactive HTML document.

Parameters:
Return type:

str

ExposoGraph.exporter.bundle_to_html_string(template_path, graph_data_path)[source]

Render a viewer bundle directory as a self-contained HTML document.

Parameters:
Return type:

str

ExposoGraph.exporter.to_interactive_html(engine, path, *, template_path=None, visibility=GraphVisibility.ALL)[source]

Write a standalone interactive HTML file with embedded graph data.

Parameters:
Return type:

Path

ExposoGraph.exporter.ensure_viewer_bundle(output_dir, *, template_dir=None)[source]

Ensure output_dir is a usable D3 viewer bundle directory.

When template_dir contains an index.html file, it is copied into the output directory if missing so the generated graph-data.js has a viewer to pair with.

Parameters:
Return type:

Path

ExposoGraph.exporter.export_viewer_bundle(engine, output_dir, *, template_dir=None, visibility=GraphVisibility.ALL)[source]

Write a complete viewer bundle directory.

The resulting folder contains graph-data.js and, when a template is available, index.html.

Parameters:
Return type:

Path

ExposoGraph.exporter.to_json(engine, path, *, visibility=GraphVisibility.ALL)[source]

Write a plain JSON export.

Parameters:
Return type:

Path

ExposoGraph.exporter.to_gexf(engine, path, *, visibility=GraphVisibility.ALL)[source]

Write GEXF (Gephi) format.

Non-scalar node/edge attributes (lists, dicts) are serialized to JSON strings since GEXF only supports primitive attribute types.

Parameters:
Return type:

Path