trustgraph-cli 2.1.11__tar.gz → 2.1.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/PKG-INFO +1 -1
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_graph_rag.py +30 -27
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/query_graph.py +48 -13
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_graph.py +38 -2
- trustgraph_cli-2.1.13/trustgraph/cli_version.py +1 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph_cli.egg-info/PKG-INFO +1 -1
- trustgraph_cli-2.1.11/trustgraph/cli_version.py +0 -1
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/README.md +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/pyproject.toml +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/setup.cfg +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/__init__.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/add_library_document.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/delete_collection.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/delete_config_item.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/delete_flow_blueprint.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/delete_kg_core.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/delete_mcp_tool.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/delete_tool.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/dump_msgpack.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/dump_queues.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/get_config_item.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/get_document_content.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/get_flow_blueprint.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/get_kg_core.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/graph_to_turtle.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/init_pulsar_manager.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/init_trustgraph.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_agent.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_document_embeddings.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_document_rag.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_embeddings.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_graph_embeddings.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_llm.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_mcp_tool.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_nlp_query.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_prompt.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_row_embeddings.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_rows_query.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_structured_query.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/list_collections.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/list_config_items.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/load_doc_embeds.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/load_kg_core.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/load_knowledge.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/load_sample_documents.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/load_structured_data.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/load_turtle.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/put_config_item.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/put_flow_blueprint.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/put_kg_core.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/remove_library_document.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/save_doc_embeds.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/set_collection.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/set_mcp_tool.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/set_prompt.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/set_token_costs.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/set_tool.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_config.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_flow_blueprints.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_flow_state.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_flows.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_kg_cores.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_library_documents.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_library_processing.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_mcp_tools.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_parameter_types.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_processor_state.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_prompts.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_token_costs.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_token_rate.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/show_tools.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/start_flow.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/start_library_processing.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/stop_flow.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/stop_library_processing.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/unload_kg_core.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/verify_system_status.py +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph_cli.egg-info/SOURCES.txt +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph_cli.egg-info/dependency_links.txt +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph_cli.egg-info/entry_points.txt +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph_cli.egg-info/requires.txt +0 -0
- {trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph_cli.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trustgraph-cli
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.13
|
|
4
4
|
Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
|
|
5
5
|
Author-email: "trustgraph.ai" <security@trustgraph.ai>
|
|
6
6
|
Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
|
|
@@ -36,14 +36,14 @@ RDFS_LABEL = "http://www.w3.org/2000/01/rdf-schema#label"
|
|
|
36
36
|
|
|
37
37
|
def _get_event_type(prov_id):
|
|
38
38
|
"""Extract event type from provenance_id"""
|
|
39
|
-
if "
|
|
40
|
-
return "
|
|
41
|
-
elif "
|
|
42
|
-
return "
|
|
43
|
-
elif "
|
|
44
|
-
return "
|
|
45
|
-
elif "
|
|
46
|
-
return "
|
|
39
|
+
if "question" in prov_id:
|
|
40
|
+
return "question"
|
|
41
|
+
elif "exploration" in prov_id:
|
|
42
|
+
return "exploration"
|
|
43
|
+
elif "focus" in prov_id:
|
|
44
|
+
return "focus"
|
|
45
|
+
elif "synthesis" in prov_id:
|
|
46
|
+
return "synthesis"
|
|
47
47
|
return "provenance"
|
|
48
48
|
|
|
49
49
|
|
|
@@ -51,7 +51,7 @@ def _format_provenance_details(event_type, triples):
|
|
|
51
51
|
"""Format provenance details based on event type and triples"""
|
|
52
52
|
lines = []
|
|
53
53
|
|
|
54
|
-
if event_type == "
|
|
54
|
+
if event_type == "question":
|
|
55
55
|
# Show query and timestamp
|
|
56
56
|
for s, p, o in triples:
|
|
57
57
|
if p == TG_QUERY:
|
|
@@ -59,32 +59,32 @@ def _format_provenance_details(event_type, triples):
|
|
|
59
59
|
elif p == PROV_STARTED_AT_TIME:
|
|
60
60
|
lines.append(f" Time: {o}")
|
|
61
61
|
|
|
62
|
-
elif event_type == "
|
|
62
|
+
elif event_type == "exploration":
|
|
63
63
|
# Show edge count
|
|
64
64
|
for s, p, o in triples:
|
|
65
65
|
if p == TG_EDGE_COUNT:
|
|
66
|
-
lines.append(f" Edges
|
|
66
|
+
lines.append(f" Edges explored: {o}")
|
|
67
67
|
|
|
68
|
-
elif event_type == "
|
|
69
|
-
# For
|
|
68
|
+
elif event_type == "focus":
|
|
69
|
+
# For focus, just count edge selection URIs
|
|
70
70
|
# The actual edge details are fetched separately via edge_selections parameter
|
|
71
71
|
edge_sel_uris = []
|
|
72
72
|
for s, p, o in triples:
|
|
73
73
|
if p == TG_SELECTED_EDGE:
|
|
74
74
|
edge_sel_uris.append(o)
|
|
75
75
|
if edge_sel_uris:
|
|
76
|
-
lines.append(f"
|
|
76
|
+
lines.append(f" Focused on {len(edge_sel_uris)} edge(s)")
|
|
77
77
|
|
|
78
|
-
elif event_type == "
|
|
78
|
+
elif event_type == "synthesis":
|
|
79
79
|
# Show content length (not full content - it's already streamed)
|
|
80
80
|
for s, p, o in triples:
|
|
81
81
|
if p == TG_CONTENT:
|
|
82
|
-
lines.append(f"
|
|
82
|
+
lines.append(f" Synthesis length: {len(o)} chars")
|
|
83
83
|
|
|
84
84
|
return lines
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
async def _query_triples_once(ws_url, flow_id, prov_id, user, collection, debug=False):
|
|
87
|
+
async def _query_triples_once(ws_url, flow_id, prov_id, user, collection, graph=None, debug=False):
|
|
88
88
|
"""Query triples for a provenance node (single attempt)"""
|
|
89
89
|
request = {
|
|
90
90
|
"id": "triples-request",
|
|
@@ -97,6 +97,9 @@ async def _query_triples_once(ws_url, flow_id, prov_id, user, collection, debug=
|
|
|
97
97
|
"limit": 100
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
+
# Add graph filter if specified (for named graph queries)
|
|
101
|
+
if graph is not None:
|
|
102
|
+
request["request"]["g"] = graph
|
|
100
103
|
|
|
101
104
|
if debug:
|
|
102
105
|
print(f" [debug] querying triples for s={prov_id}", file=sys.stderr)
|
|
@@ -155,10 +158,10 @@ async def _query_triples_once(ws_url, flow_id, prov_id, user, collection, debug=
|
|
|
155
158
|
return triples
|
|
156
159
|
|
|
157
160
|
|
|
158
|
-
async def _query_triples(ws_url, flow_id, prov_id, user, collection, max_retries=5, retry_delay=0.2, debug=False):
|
|
161
|
+
async def _query_triples(ws_url, flow_id, prov_id, user, collection, graph=None, max_retries=5, retry_delay=0.2, debug=False):
|
|
159
162
|
"""Query triples for a provenance node with retries for race condition"""
|
|
160
163
|
for attempt in range(max_retries):
|
|
161
|
-
triples = await _query_triples_once(ws_url, flow_id, prov_id, user, collection, debug)
|
|
164
|
+
triples = await _query_triples_once(ws_url, flow_id, prov_id, user, collection, graph=graph, debug=debug)
|
|
162
165
|
if triples:
|
|
163
166
|
return triples
|
|
164
167
|
# Wait before retry if empty (triples may not be stored yet)
|
|
@@ -515,14 +518,14 @@ async def _question_explainable(
|
|
|
515
518
|
if message_type == "explain":
|
|
516
519
|
# Display explain event with details
|
|
517
520
|
explain_id = resp.get("explain_id", "")
|
|
518
|
-
|
|
521
|
+
explain_graph = resp.get("explain_graph") # Named graph (e.g., urn:graph:retrieval)
|
|
519
522
|
if explain_id:
|
|
520
523
|
event_type = _get_event_type(explain_id)
|
|
521
524
|
print(f"\n [{event_type}] {explain_id}", file=sys.stderr)
|
|
522
525
|
|
|
523
|
-
# Query triples for this explain node (using
|
|
526
|
+
# Query triples for this explain node (using named graph filter)
|
|
524
527
|
triples = await _query_triples(
|
|
525
|
-
ws_url, flow_id, explain_id, user,
|
|
528
|
+
ws_url, flow_id, explain_id, user, collection, graph=explain_graph, debug=debug
|
|
526
529
|
)
|
|
527
530
|
|
|
528
531
|
# Format and display details
|
|
@@ -530,17 +533,17 @@ async def _question_explainable(
|
|
|
530
533
|
for line in details:
|
|
531
534
|
print(line, file=sys.stderr)
|
|
532
535
|
|
|
533
|
-
# For
|
|
534
|
-
if event_type == "
|
|
536
|
+
# For focus events, query each edge selection for details
|
|
537
|
+
if event_type == "focus":
|
|
535
538
|
for s, p, o in triples:
|
|
536
539
|
if debug:
|
|
537
540
|
print(f" [debug] triple: p={p}, o={o}, o_type={type(o).__name__}", file=sys.stderr)
|
|
538
541
|
if p == TG_SELECTED_EDGE and isinstance(o, str):
|
|
539
542
|
if debug:
|
|
540
543
|
print(f" [debug] querying edge selection: {o}", file=sys.stderr)
|
|
541
|
-
# Query the edge selection entity (using
|
|
544
|
+
# Query the edge selection entity (using named graph filter)
|
|
542
545
|
edge_triples = await _query_triples(
|
|
543
|
-
ws_url, flow_id, o, user,
|
|
546
|
+
ws_url, flow_id, o, user, collection, graph=explain_graph, debug=debug
|
|
544
547
|
)
|
|
545
548
|
if debug:
|
|
546
549
|
print(f" [debug] got {len(edge_triples)} edge triples", file=sys.stderr)
|
|
@@ -743,7 +746,7 @@ def main():
|
|
|
743
746
|
parser.add_argument(
|
|
744
747
|
'-x', '--explainable',
|
|
745
748
|
action='store_true',
|
|
746
|
-
help='Show provenance events
|
|
749
|
+
help='Show provenance events: Question, Exploration, Focus, Synthesis (implies streaming)'
|
|
747
750
|
)
|
|
748
751
|
|
|
749
752
|
parser.add_argument(
|
|
@@ -186,6 +186,12 @@ def build_quoted_triple_term(qt_subject, qt_subject_type,
|
|
|
186
186
|
def format_term(term_dict):
|
|
187
187
|
"""Format a term dict for display in space/pipe output formats.
|
|
188
188
|
|
|
189
|
+
Handles multiple wire format styles:
|
|
190
|
+
- Short form (send): {"t": "i", "i": "..."}, {"t": "l", "v": "..."}
|
|
191
|
+
- Long form (receive): {"type": "i", "iri": "..."}, {"type": "l", "value": "..."}
|
|
192
|
+
- Raw quoted triple: {"s": {...}, "p": {...}, "o": {...}} (no type wrapper)
|
|
193
|
+
- Stringified quoted triple in IRI: {"t": "i", "i": "{\"s\":...}"} (backend quirk)
|
|
194
|
+
|
|
189
195
|
Args:
|
|
190
196
|
term_dict: Wire-format term dict
|
|
191
197
|
|
|
@@ -195,25 +201,53 @@ def format_term(term_dict):
|
|
|
195
201
|
if not term_dict:
|
|
196
202
|
return ""
|
|
197
203
|
|
|
198
|
-
|
|
204
|
+
# Get type - handle both short and long form
|
|
205
|
+
t = term_dict.get("t") or term_dict.get("type")
|
|
206
|
+
|
|
199
207
|
if t == "i":
|
|
200
|
-
|
|
208
|
+
# IRI - handle both "i" and "iri" keys
|
|
209
|
+
iri_value = term_dict.get("i") or term_dict.get("iri", "")
|
|
210
|
+
# Check if IRI value is actually a stringified quoted triple (backend quirk)
|
|
211
|
+
if iri_value.startswith('{"s":') or iri_value.startswith("{\"s\":"):
|
|
212
|
+
try:
|
|
213
|
+
parsed = json.loads(iri_value)
|
|
214
|
+
if "s" in parsed and "p" in parsed and "o" in parsed:
|
|
215
|
+
# It's a stringified quoted triple - format it properly
|
|
216
|
+
s = format_term(parsed.get("s", {}))
|
|
217
|
+
p = format_term(parsed.get("p", {}))
|
|
218
|
+
o = format_term(parsed.get("o", {}))
|
|
219
|
+
return f"<<{s} {p} {o}>>"
|
|
220
|
+
except json.JSONDecodeError:
|
|
221
|
+
pass # Not valid JSON, treat as regular IRI
|
|
222
|
+
return iri_value
|
|
201
223
|
elif t == "l":
|
|
202
|
-
|
|
203
|
-
|
|
224
|
+
# Literal - handle both short and long form keys
|
|
225
|
+
value = term_dict.get("v") or term_dict.get("value", "")
|
|
204
226
|
result = f'"{value}"'
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
result += f'
|
|
227
|
+
# Language tag
|
|
228
|
+
lang = term_dict.get("ln") or term_dict.get("language")
|
|
229
|
+
if lang:
|
|
230
|
+
result += f'@{lang}'
|
|
231
|
+
else:
|
|
232
|
+
# Datatype
|
|
233
|
+
dt = term_dict.get("dt") or term_dict.get("datatype")
|
|
234
|
+
if dt:
|
|
235
|
+
result += f'^^{dt}'
|
|
209
236
|
return result
|
|
210
237
|
elif t == "t":
|
|
211
|
-
#
|
|
212
|
-
tr = term_dict.get("tr", {})
|
|
238
|
+
# Quoted triple - handle both "tr" and "triple" keys
|
|
239
|
+
tr = term_dict.get("tr") or term_dict.get("triple", {})
|
|
213
240
|
s = format_term(tr.get("s", {}))
|
|
214
241
|
p = format_term(tr.get("p", {}))
|
|
215
242
|
o = format_term(tr.get("o", {}))
|
|
216
243
|
return f"<<{s} {p} {o}>>"
|
|
244
|
+
elif t is None and "s" in term_dict and "p" in term_dict and "o" in term_dict:
|
|
245
|
+
# Raw quoted triple without type wrapper (has s, p, o keys directly)
|
|
246
|
+
s = format_term(term_dict.get("s", {}))
|
|
247
|
+
p = format_term(term_dict.get("p", {}))
|
|
248
|
+
o = format_term(term_dict.get("o", {}))
|
|
249
|
+
return f"<<{s} {p} {o}>>"
|
|
250
|
+
|
|
217
251
|
return str(term_dict)
|
|
218
252
|
|
|
219
253
|
|
|
@@ -526,8 +560,9 @@ def main():
|
|
|
526
560
|
else:
|
|
527
561
|
obj_term = None
|
|
528
562
|
|
|
529
|
-
# Graph is
|
|
530
|
-
|
|
563
|
+
# Graph is a plain IRI string, not a Term
|
|
564
|
+
# None = all graphs, "" = default graph only, "uri" = specific graph
|
|
565
|
+
graph_value = args.graph
|
|
531
566
|
|
|
532
567
|
query_graph(
|
|
533
568
|
url=args.api_url,
|
|
@@ -539,7 +574,7 @@ def main():
|
|
|
539
574
|
subject=subject_term,
|
|
540
575
|
predicate=predicate_term,
|
|
541
576
|
obj=obj_term,
|
|
542
|
-
graph=
|
|
577
|
+
graph=graph_value,
|
|
543
578
|
output_format=args.format,
|
|
544
579
|
headers=args.headers,
|
|
545
580
|
token=args.token,
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Connects to the graph query service and dumps all graph edges.
|
|
3
3
|
Uses streaming mode for lower time-to-first-result and reduced memory overhead.
|
|
4
|
+
|
|
5
|
+
Named graphs:
|
|
6
|
+
- Default graph (empty): Core knowledge facts
|
|
7
|
+
- urn:graph:source: Extraction provenance (document/chunk sources)
|
|
8
|
+
- urn:graph:retrieval: Query-time explainability (question, exploration, focus, synthesis)
|
|
4
9
|
"""
|
|
5
10
|
|
|
6
11
|
import argparse
|
|
@@ -12,7 +17,13 @@ default_user = 'trustgraph'
|
|
|
12
17
|
default_collection = 'default'
|
|
13
18
|
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
# Named graph constants for convenience
|
|
21
|
+
GRAPH_DEFAULT = ""
|
|
22
|
+
GRAPH_SOURCE = "urn:graph:source"
|
|
23
|
+
GRAPH_RETRIEVAL = "urn:graph:retrieval"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def show_graph(url, flow_id, user, collection, limit, batch_size, graph=None, show_graph_column=False, token=None):
|
|
16
27
|
|
|
17
28
|
socket = Api(url, token=token).socket()
|
|
18
29
|
flow = socket.flow(flow_id)
|
|
@@ -22,6 +33,7 @@ def show_graph(url, flow_id, user, collection, limit, batch_size, token=None):
|
|
|
22
33
|
user=user,
|
|
23
34
|
collection=collection,
|
|
24
35
|
s=None, p=None, o=None,
|
|
36
|
+
g=graph, # Filter by named graph (None = all graphs)
|
|
25
37
|
limit=limit,
|
|
26
38
|
batch_size=batch_size,
|
|
27
39
|
):
|
|
@@ -29,11 +41,16 @@ def show_graph(url, flow_id, user, collection, limit, batch_size, token=None):
|
|
|
29
41
|
s = triple.get("s", {})
|
|
30
42
|
p = triple.get("p", {})
|
|
31
43
|
o = triple.get("o", {})
|
|
44
|
+
g = triple.get("g") # Named graph (None = default graph)
|
|
32
45
|
# Format terms for display
|
|
33
46
|
s_str = s.get("v", s.get("i", str(s)))
|
|
34
47
|
p_str = p.get("v", p.get("i", str(p)))
|
|
35
48
|
o_str = o.get("v", o.get("i", str(o)))
|
|
36
|
-
|
|
49
|
+
if show_graph_column:
|
|
50
|
+
g_str = g if g else "(default)"
|
|
51
|
+
print(f"[{g_str}]", s_str, p_str, o_str)
|
|
52
|
+
else:
|
|
53
|
+
print(s_str, p_str, o_str)
|
|
37
54
|
finally:
|
|
38
55
|
socket.close()
|
|
39
56
|
|
|
@@ -88,8 +105,25 @@ def main():
|
|
|
88
105
|
help='Triples per streaming batch (default: 20)',
|
|
89
106
|
)
|
|
90
107
|
|
|
108
|
+
parser.add_argument(
|
|
109
|
+
'-g', '--graph',
|
|
110
|
+
default=None,
|
|
111
|
+
help='Filter by named graph (e.g., urn:graph:source, urn:graph:retrieval). Use "" for default graph only.',
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
parser.add_argument(
|
|
115
|
+
'--show-graph',
|
|
116
|
+
action='store_true',
|
|
117
|
+
help='Show graph column in output',
|
|
118
|
+
)
|
|
119
|
+
|
|
91
120
|
args = parser.parse_args()
|
|
92
121
|
|
|
122
|
+
# Handle empty string for default graph filter
|
|
123
|
+
graph = args.graph
|
|
124
|
+
if graph == '""' or graph == "''":
|
|
125
|
+
graph = "" # Filter to default graph only
|
|
126
|
+
|
|
93
127
|
try:
|
|
94
128
|
|
|
95
129
|
show_graph(
|
|
@@ -99,6 +133,8 @@ def main():
|
|
|
99
133
|
collection = args.collection,
|
|
100
134
|
limit = args.limit,
|
|
101
135
|
batch_size = args.batch_size,
|
|
136
|
+
graph = graph,
|
|
137
|
+
show_graph_column = args.show_graph,
|
|
102
138
|
token = args.token,
|
|
103
139
|
)
|
|
104
140
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.1.13"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trustgraph-cli
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.13
|
|
4
4
|
Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
|
|
5
5
|
Author-email: "trustgraph.ai" <security@trustgraph.ai>
|
|
6
6
|
Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.1.11"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph/cli/invoke_document_embeddings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_cli-2.1.11 → trustgraph_cli-2.1.13}/trustgraph_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|