KnowledgeGraph.add_edge()

Add an edge to the graph, or update it if the key already exists.

Usage

Source

KnowledgeGraph.add_edge(edge)

If the graph has an ontology, the edge is validated first. In strict mode a ValueError is raised on violations; otherwise a warning is emitted.

Parameters

edge: Edge
The edge to add or update. The (source, target, relation) triple is the primary key.

Raises

KeyError

If source or target node does not exist.

ValueError
If validation fails and strict=True.