ExposoGraph.storage

SQLite-backed graph revision storage for local mode.

Revision summaries carry a visibility field so saved revisions can track whether they contain the full graph or a filtered validated/exploratory slice. GraphRepository also supports context-manager usage for clean SQLite connection shutdown.

class ExposoGraph.storage.GraphRevisionSummary(revision_id: 'int', graph_key: 'str', graph_name: 'str', revision_number: 'int', created_at: 'str', node_count: 'int', edge_count: 'int', note: 'str | None' = None, visibility: 'GraphVisibility' = <GraphVisibility.ALL: 'all'>)[source]
Parameters:
revision_id: int
graph_key: str
graph_name: str
revision_number: int
created_at: str
node_count: int
edge_count: int
note: str | None = None
visibility: GraphVisibility = 'all'
class ExposoGraph.storage.GraphRevision(revision_id: 'int', graph_key: 'str', graph_name: 'str', revision_number: 'int', created_at: 'str', node_count: 'int', edge_count: 'int', note: 'str | None' = None, visibility: 'GraphVisibility' = <GraphVisibility.ALL: 'all'>, graph_json: 'str' = '', html: 'str' = '')[source]
Parameters:
graph_json: str = ''
html: str = ''
to_knowledge_graph()[source]
Return type:

KnowledgeGraph

class ExposoGraph.storage.GraphRepository(db_path)[source]

Persist graphs and their revisions in a local SQLite database.

Parameters:

db_path (str | Path)

property connection: Connection

Return the persistent connection, reconnecting if closed.

close()[source]

Close the persistent connection.

Return type:

None

save_graph(*, graph_key, graph_name, kg, html, visibility=GraphVisibility.ALL, note=None)[source]
Parameters:
Return type:

GraphRevisionSummary

save_engine(*, graph_key, graph_name, engine, template_path=None, visibility=GraphVisibility.ALL, note=None)[source]
Parameters:
Return type:

GraphRevisionSummary

list_graphs()[source]
Return type:

list[GraphRevisionSummary]

list_revisions(graph_key)[source]
Parameters:

graph_key (str)

Return type:

list[GraphRevisionSummary]

get_revision(revision_id)[source]
Parameters:

revision_id (int)

Return type:

GraphRevision | None

get_latest_revision(graph_key)[source]
Parameters:

graph_key (str)

Return type:

GraphRevision | None