From 7769b29203daf210c54795fd93487381336de4c0 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Tue, 27 Jan 2026 13:18:38 +0000 Subject: [PATCH] Fixed Term evaluation in messaging translation --- trustgraph-base/trustgraph/schema/core/primitives.py | 4 +--- trustgraph-flow/trustgraph/librarian/service.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/trustgraph-base/trustgraph/schema/core/primitives.py b/trustgraph-base/trustgraph/schema/core/primitives.py index 67d203a3..78676eb0 100644 --- a/trustgraph-base/trustgraph/schema/core/primitives.py +++ b/trustgraph-base/trustgraph/schema/core/primitives.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from dataclasses import dataclass, field # Term type constants @@ -40,7 +38,7 @@ class Term: language: str = "" # Language tag (mutually exclusive with datatype) # For quoted triples (type == TRIPLE) - triple: Triple | None = None + triple: "Triple | None" = None @dataclass diff --git a/trustgraph-flow/trustgraph/librarian/service.py b/trustgraph-flow/trustgraph/librarian/service.py index 7c1e428c..4d972a5a 100755 --- a/trustgraph-flow/trustgraph/librarian/service.py +++ b/trustgraph-flow/trustgraph/librarian/service.py @@ -378,6 +378,17 @@ class Processor(AsyncProcessor): logger.info(f"Handling librarian input {id}...") + # Debug: log types of nested objects + if hasattr(v, 'document_metadata') and v.document_metadata: + dm = v.document_metadata + logger.debug(f"document_metadata type: {type(dm)}") + if hasattr(dm, 'metadata'): + logger.debug(f"metadata type: {type(dm.metadata)}") + if dm.metadata: + logger.debug(f"first triple type: {type(dm.metadata[0])}") + if hasattr(dm.metadata[0], 's'): + logger.debug(f"triple.s type: {type(dm.metadata[0].s)}") + try: resp = await self.process_request(v) @@ -402,6 +413,7 @@ class Processor(AsyncProcessor): return except Exception as e: + logger.error(f"Unexpected error processing request: {e}", exc_info=True) resp = LibrarianResponse( error = Error( type = "unexpected-error",