mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-09 13:22:10 +02:00
Fix CLI
This commit is contained in:
parent
157049c440
commit
8d7cfb853a
1 changed files with 9 additions and 4 deletions
|
|
@ -33,11 +33,16 @@ def query(url, flow_id, query_text, user, collection, limit, token=None):
|
|||
for i, match in enumerate(entities, 1):
|
||||
entity = match.get("entity", {})
|
||||
score = match.get("score", 0.0)
|
||||
# Format entity based on type
|
||||
if entity.get("is_uri"):
|
||||
entity_str = entity.get("value", "")
|
||||
# Format entity based on type (wire format uses compact keys)
|
||||
term_type = entity.get("t", "")
|
||||
if term_type == "i": # IRI
|
||||
entity_str = entity.get("i", "")
|
||||
elif term_type == "l": # Literal
|
||||
entity_str = f'"{entity.get("v", "")}"'
|
||||
elif term_type == "b": # Blank node
|
||||
entity_str = f'_:{entity.get("d", "")}'
|
||||
else:
|
||||
entity_str = f'"{entity.get("value", "")}"'
|
||||
entity_str = str(entity)
|
||||
print(f"{i}. {entity_str} (score: {score:.4f})")
|
||||
|
||||
finally:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue