KnowledgeGraph.add_node()
Add a node to the graph, or update it if the ID already exists.
Usage
KnowledgeGraph.add_node(node)If the graph has an ontology, the node is validated first. In strict mode a ValueError is raised on violations; otherwise a warning is emitted.
Parameters
node: Node- The node to add or update.
Raises
ValueError-
If validation fails and
strict=True.
Examples
kg.add_node(tb.Node(
id="topic-ml",
node_type=tb.NodeType.TOPIC,
name="Machine Learning",
))