From 4bd251201e4238af779e052b99a0cd4dfc233dc6 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Tue, 27 Jan 2026 13:34:21 +0000 Subject: [PATCH] Fix qdrant write --- .../storage/graph_embeddings/qdrant/write.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/trustgraph-flow/trustgraph/storage/graph_embeddings/qdrant/write.py b/trustgraph-flow/trustgraph/storage/graph_embeddings/qdrant/write.py index e3c2b6bc..bdc5fa70 100755 --- a/trustgraph-flow/trustgraph/storage/graph_embeddings/qdrant/write.py +++ b/trustgraph-flow/trustgraph/storage/graph_embeddings/qdrant/write.py @@ -12,10 +12,25 @@ import logging from .... base import GraphEmbeddingsStoreService, CollectionConfigHandler from .... base import AsyncProcessor, Consumer, Producer from .... base import ConsumerMetrics, ProducerMetrics +from .... schema import IRI, LITERAL # Module logger logger = logging.getLogger(__name__) + +def get_term_value(term): + """Extract the string value from a Term""" + if term is None: + return None + if term.type == IRI: + return term.iri + elif term.type == LITERAL: + return term.value + else: + # For blank nodes or other types, use id or value + return term.id or term.value + + default_ident = "ge-write" default_store_uri = 'http://localhost:6333' @@ -51,8 +66,10 @@ class Processor(CollectionConfigHandler, GraphEmbeddingsStoreService): return for entity in message.entities: + entity_value = get_term_value(entity.entity) - if entity.entity.value == "" or entity.entity.value is None: return + if entity_value == "" or entity_value is None: + continue for vec in entity.vectors: @@ -80,7 +97,7 @@ class Processor(CollectionConfigHandler, GraphEmbeddingsStoreService): id=str(uuid.uuid4()), vector=vec, payload={ - "entity": entity.entity.value, + "entity": entity_value, } ) ]