topologicpy.Kuzu module
- class topologicpy.Kuzu.Kuzu
Bases:
objectMethods
GraphsByOntologyClass(manager, ontologyClass)Returns TopologicPy graphs whose stored graph ontology_class matches the input class.
GraphsByQuery(manager, query[, parameters, ...])Executes a Kuzu query and returns a list containing a TopologicPy graph constructed from the returned rows.
OntologyClasses(manager[, elementType, silent])Returns ontology class counts for graphs, vertices, edges, or all stored elements.
UpsertGraph(manager, graph[, graphIDKey, ...])Upserts a TopologicPy graph into Kuzu using the canonical GraphDB schema.
VerticesByOntologyClass(manager, ontologyClass)Returns stored vertex rows matching the input ontology class.
ByCSVPath
CandidateCountsForLabels
Connection
Database
DeleteGraph
EmptyDatabase
EnsureSchema
Execute
FetchAllPairs
FindBestExampleForLabel
GraphByID
ListGraphs
Manager
MaxNeighborsForLabel
Query
- static ByCSVPath(manager, path, graphIDHeader='graph_id', graphLabelHeader='label', graphFeaturesHeader='feat', graphFeaturesKeys=None, edgeSRCHeader='src_id', edgeDSTHeader='dst_id', edgeLabelHeader='label', edgeTrainMaskHeader='train_mask', edgeValidateMaskHeader='val_mask', edgeTestMaskHeader='test_mask', edgeFeaturesHeader='feat', edgeFeaturesKeys=None, nodeIDHeader='node_id', nodeLabelHeader='label', nodeTrainMaskHeader='train_mask', nodeValidateMaskHeader='val_mask', nodeTestMaskHeader='test_mask', nodeFeaturesHeader='feat', nodeXHeader='X', nodeYHeader='Y', nodeZHeader='Z', nodeFeaturesKeys=None, tolerance=0.0001, ontology: bool = True, silent=False)
- static CandidateCountsForLabels(manager, labels, excludeLabels=None, limit: int = 50, silent: bool = False) list[dict]
- static Connection(manager, silent: bool = False)
- static Database(path: str, silent: bool = False)
- static DeleteGraph(manager, graphID: str, silent: bool = False) bool
- static EmptyDatabase(manager, dropSchema: bool = False, recreateSchema: bool = True, silent: bool = False) bool
- static EnsureSchema(manager, silent: bool = False) bool
- static Execute(manager, query: str, parameters: dict = None, write: bool = False, silent: bool = False)
- static FetchAllPairs(manager, undirected: bool = True, silent: bool = False) list[dict]
- static FindBestExampleForLabel(manager, label, attachTo=None, silent: bool = False)
- static GraphByID(manager, graphID: str, ontology: bool = True, silent: bool = False)
- static GraphsByOntologyClass(manager, ontologyClass: str, silent: bool = False)
Returns TopologicPy graphs whose stored graph ontology_class matches the input class.
- static GraphsByQuery(manager, query: str, parameters: dict = None, params: dict = None, ontology: bool = True, silent: bool = False)
Executes a Kuzu query and returns a list containing a TopologicPy graph constructed from the returned rows. If rows return graph_id/gid only, full graphs are reconstructed using GraphByID.
- static ListGraphs(manager, where: dict = None, limit: int = 100, offset: int = 0, silent: bool = False) list[dict]
- static Manager(path: str, silent: bool = False)
- static MaxNeighborsForLabel(manager, label, silent: bool = False)
- static OntologyClasses(manager, elementType: str = 'all', silent: bool = False)
Returns ontology class counts for graphs, vertices, edges, or all stored elements.
- Parameters
- managerKuzu manager
The input Kuzu manager.
- elementTypestr , optional
One of “graph”, “vertex”, “edge”, or “all”. Default is “all”.
- silentbool , optional
If True, suppresses warning/error messages. Default is False.
- Returns
- list
A list of dictionaries with element_type, ontology_class, and count.
- static Query(manager, query: str, parameters: dict = None, silent: bool = False)
- static UpsertGraph(manager, graph, graphIDKey: str = 'id', vertexIDKey: str = 'id', vertexLabelKey: str = 'label', defaultVertexLabel: str = 'Node', vertexCategoryKey: str = 'category', defaultVertexCategory='Node', edgeLabelKey: str = 'label', defaultEdgeLabel: str = 'CONNECTED_TO', edgeCategoryKey: str = 'category', defaultEdgeCategory='Edge', bidirectional: bool = True, overwrite: bool = False, mantissa: int = 6, tolerance: float = 0.0001, database: str = None, ontology: bool = True, silent: bool = False) str
Upserts a TopologicPy graph into Kuzu using the canonical GraphDB schema.
The signature mirrors Neo4j.UpsertGraph. The database argument is accepted for GraphDB compatibility and ignored because Kuzu database identity is the manager/path. If ontology is True, the graph, vertices, and edges are annotated with TopologicPy ontology metadata before persistence.
- static VerticesByOntologyClass(manager, ontologyClass: str, graphID: str = None, silent: bool = False)
Returns stored vertex rows matching the input ontology class.
- Parameters
- managerKuzu manager
The input Kuzu manager.
- ontologyClassstr
The ontology class, for example “top:Room”.
- graphIDstr , optional
Optional graph id filter. Default is None.
- silentbool , optional
If True, suppresses warning/error messages. Default is False.
- Returns
- list
A list of vertex row dictionaries. The props value is decoded when possible.