Bases: WiseAgentsYAMLObject
Abstract class to define the interface for a WiseAgentGraphDB.
Source code in wiseagents/graphdb/wise_agent_graph_db.py
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142 | class WiseAgentGraphDB(WiseAgentsYAMLObject):
"""Abstract class to define the interface for a WiseAgentGraphDB."""
def __init__(self):
enforce_no_abstract_class_instances(self.__class__, WiseAgentGraphDB)
@abstractmethod
def get_schema(self) -> str:
"""
Get the schema of the graph DB.
Returns:
str: the schema of the graph DB
"""
...
@abstractmethod
def refresh_schema(self):
"""
Refresh the schema of the graph DB.
"""
...
@abstractmethod
def query(self, query: str, params: Optional[dict] = None) -> Any:
"""
Query the graph DB.
Args:
query (str): the query to execute
params (dict): the optional parameters for the query
Returns:
Any: the result of the query
"""
...
@abstractmethod
def insert_entity(self, entity: Entity, source: Source):
"""
Insert an entity into the graph DB.
Args:
entity (Entity): the entity to insert
source (Source): information about the source from which the entity has been derived from
"""
...
@abstractmethod
def insert_relationship(self, relationship: Relationship, source: Source):
"""
Insert a relationship into the graph DB.
Args:
relationship (Relationship): the relationship to insert
source (Source): information about the source from which the relationship has been derived from
"""
...
@abstractmethod
def insert_graph_documents(self, graph_documents: List[GraphDocument]):
"""
Insert a list of graph documents into the graph DB.
Args:
graph_documents (List[GraphDocuments]): the graph documents to insert
"""
...
|
get_schema()
abstractmethod
Get the schema of the graph DB.
Returns: |
-
str ( str
) –
the schema of the graph DB
|
Source code in wiseagents/graphdb/wise_agent_graph_db.py
77
78
79
80
81
82
83
84
85 | @abstractmethod
def get_schema(self) -> str:
"""
Get the schema of the graph DB.
Returns:
str: the schema of the graph DB
"""
...
|
insert_entity(entity, source)
abstractmethod
Insert an entity into the graph DB.
Parameters: |
-
entity
(Entity )
–
-
source
(Source )
–
information about the source from which the entity has been derived from
|
Source code in wiseagents/graphdb/wise_agent_graph_db.py
109
110
111
112
113
114
115
116
117
118
119 | @abstractmethod
def insert_entity(self, entity: Entity, source: Source):
"""
Insert an entity into the graph DB.
Args:
entity (Entity): the entity to insert
source (Source): information about the source from which the entity has been derived from
"""
...
|
insert_graph_documents(graph_documents)
abstractmethod
Insert a list of graph documents into the graph DB.
Parameters: |
-
graph_documents
(List[GraphDocuments] )
–
the graph documents to insert
|
Source code in wiseagents/graphdb/wise_agent_graph_db.py
133
134
135
136
137
138
139
140
141
142 | @abstractmethod
def insert_graph_documents(self, graph_documents: List[GraphDocument]):
"""
Insert a list of graph documents into the graph DB.
Args:
graph_documents (List[GraphDocuments]): the graph documents to insert
"""
...
|
insert_relationship(relationship, source)
abstractmethod
Insert a relationship into the graph DB.
Parameters: |
-
relationship
(Relationship )
–
the relationship to insert
-
source
(Source )
–
information about the source from which the relationship has been derived from
|
Source code in wiseagents/graphdb/wise_agent_graph_db.py
121
122
123
124
125
126
127
128
129
130
131 | @abstractmethod
def insert_relationship(self, relationship: Relationship, source: Source):
"""
Insert a relationship into the graph DB.
Args:
relationship (Relationship): the relationship to insert
source (Source): information about the source from which the relationship has been derived from
"""
...
|
query(query, params=None)
abstractmethod
Query the graph DB.
Parameters: |
-
query
(str )
–
-
params
(dict , default:
None
)
–
the optional parameters for the query
|
Source code in wiseagents/graphdb/wise_agent_graph_db.py
94
95
96
97
98
99
100
101
102
103
104
105
106
107 | @abstractmethod
def query(self, query: str, params: Optional[dict] = None) -> Any:
"""
Query the graph DB.
Args:
query (str): the query to execute
params (dict): the optional parameters for the query
Returns:
Any: the result of the query
"""
...
|
refresh_schema()
abstractmethod
Refresh the schema of the graph DB.
Source code in wiseagents/graphdb/wise_agent_graph_db.py
| @abstractmethod
def refresh_schema(self):
"""
Refresh the schema of the graph DB.
"""
...
|