The KnowledgeGraph
class manages interactions with the graph database.
KnowledgeGraph
class is responsible for adding, updating, and querying entities and relationships in the graph database, based on a provided ontology.
__init__(self, ontology: KnowledgeOntology, use_neo4j: bool = False)
KnowledgeGraph
class.
ontology
(KnowledgeOntology): The ontology defining the graph’s structure.use_neo4j
(bool, optional): Whether to use Neo4j as the backend. Defaults to False
.query(self, query: str)
query
(str): The natural language query to execute.update_knowledge(self, knowledge: str)
knowledge
(str): A string of unstructured knowledge to add to the graph.close(self)