mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-10 07:42:38 +02:00
tg-put-kg-core command (#369)
This commit is contained in:
parent
8080b54328
commit
f7123ac57f
7 changed files with 298 additions and 22 deletions
|
|
@ -36,9 +36,9 @@ class KnowledgeManager:
|
|||
)
|
||||
)
|
||||
|
||||
async def fetch_kg_core(self, request, respond):
|
||||
async def get_kg_core(self, request, respond):
|
||||
|
||||
print("Fetch core...", flush=True)
|
||||
print("Get core...", flush=True)
|
||||
|
||||
async def publish_triples(t):
|
||||
await respond(
|
||||
|
|
@ -76,7 +76,7 @@ class KnowledgeManager:
|
|||
publish_ge,
|
||||
)
|
||||
|
||||
print("Fetch complete", flush=True)
|
||||
print("Get complete", flush=True)
|
||||
|
||||
await respond(
|
||||
KnowledgeResponse(
|
||||
|
|
@ -102,3 +102,23 @@ class KnowledgeManager:
|
|||
)
|
||||
)
|
||||
|
||||
async def put_kg_core(self, request, respond):
|
||||
|
||||
if request.triples:
|
||||
await self.table_store.add_triples(request.triples)
|
||||
|
||||
if request.graph_embeddings:
|
||||
await self.table_store.add_graph_embeddings(
|
||||
request.graph_embeddings
|
||||
)
|
||||
|
||||
await respond(
|
||||
KnowledgeResponse(
|
||||
error = None,
|
||||
ids = None,
|
||||
eos = False,
|
||||
triples = None,
|
||||
graph_embeddings = None
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue