mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-21 12:48:06 +02:00
fix: preserve literal types in focus quoted triples and document tracing (#769)
The triples client returns Uri/Literal (str subclasses), not Term objects. _quoted_triple() treated all values as IRIs, so literal objects like skos:definition values were mistyped in focus provenance events, and trace_source_documents could not match them in the store. Added to_term() to convert Uri/Literal back to Term, threaded a term_map from follow_edges_batch through get_subgraph/get_labelgraph into uri_map, and updated _quoted_triple to accept Term objects directly.
This commit is contained in:
parent
4b5bfacab1
commit
e81418c58f
3 changed files with 68 additions and 25 deletions
|
|
@ -465,11 +465,18 @@ def exploration_triples(
|
|||
return triples
|
||||
|
||||
|
||||
def _quoted_triple(s: str, p: str, o: str) -> Term:
|
||||
"""Create a quoted triple term (RDF-star) from string values."""
|
||||
def _quoted_triple(s, p, o) -> Term:
|
||||
"""Create a quoted triple term (RDF-star).
|
||||
|
||||
Accepts either Term objects (preserving original types) or plain
|
||||
strings (treated as IRIs for backward compatibility).
|
||||
"""
|
||||
s_term = s if isinstance(s, Term) else _iri(s)
|
||||
p_term = p if isinstance(p, Term) else _iri(p)
|
||||
o_term = o if isinstance(o, Term) else _iri(o)
|
||||
return Term(
|
||||
type=TRIPLE,
|
||||
triple=Triple(s=_iri(s), p=_iri(p), o=_iri(o))
|
||||
triple=Triple(s=s_term, p=p_term, o=o_term)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue