trustgraph-cli 2.1.18__tar.gz → 2.1.20__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.18 → trustgraph_cli-2.1.20}/PKG-INFO +1 -1
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/pyproject.toml +1 -1
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_graph_rag.py +4 -4
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_explain_trace.py +3 -3
- trustgraph_cli-2.1.18/trustgraph/cli/show_document_hierarchy.py → trustgraph_cli-2.1.20/trustgraph/cli/show_extraction_provenance.py +43 -67
- trustgraph_cli-2.1.20/trustgraph/cli_version.py +1 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph_cli.egg-info/PKG-INFO +1 -1
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph_cli.egg-info/SOURCES.txt +1 -1
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph_cli.egg-info/entry_points.txt +1 -1
- trustgraph_cli-2.1.18/trustgraph/cli_version.py +0 -1
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/README.md +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/setup.cfg +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/__init__.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/add_library_document.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/delete_collection.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/delete_config_item.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/delete_flow_blueprint.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/delete_kg_core.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/delete_mcp_tool.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/delete_tool.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/dump_msgpack.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/dump_queues.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/get_config_item.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/get_document_content.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/get_flow_blueprint.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/get_kg_core.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/graph_to_turtle.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/init_pulsar_manager.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/init_trustgraph.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_agent.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_document_embeddings.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_document_rag.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_embeddings.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_graph_embeddings.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_llm.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_mcp_tool.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_nlp_query.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_prompt.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_row_embeddings.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_rows_query.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/invoke_structured_query.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/list_collections.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/list_config_items.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/list_explain_traces.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/load_doc_embeds.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/load_kg_core.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/load_knowledge.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/load_sample_documents.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/load_structured_data.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/load_turtle.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/put_config_item.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/put_flow_blueprint.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/put_kg_core.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/query_graph.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/remove_library_document.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/save_doc_embeds.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/set_collection.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/set_mcp_tool.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/set_prompt.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/set_token_costs.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/set_tool.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_config.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_flow_blueprints.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_flow_state.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_flows.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_graph.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_kg_cores.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_library_documents.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_library_processing.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_mcp_tools.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_parameter_types.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_processor_state.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_prompts.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_token_costs.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_token_rate.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/show_tools.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/start_flow.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/start_library_processing.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/stop_flow.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/stop_library_processing.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/unload_kg_core.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph/cli/verify_system_status.py +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph_cli.egg-info/dependency_links.txt +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph_cli.egg-info/requires.txt +0 -0
- {trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/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.20
|
|
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
|
|
@@ -96,7 +96,7 @@ tg-delete-config-item = "trustgraph.cli.delete_config_item:main"
|
|
|
96
96
|
tg-list-collections = "trustgraph.cli.list_collections:main"
|
|
97
97
|
tg-set-collection = "trustgraph.cli.set_collection:main"
|
|
98
98
|
tg-delete-collection = "trustgraph.cli.delete_collection:main"
|
|
99
|
-
tg-show-
|
|
99
|
+
tg-show-extraction-provenance = "trustgraph.cli.show_extraction_provenance:main"
|
|
100
100
|
tg-list-explain-traces = "trustgraph.cli.list_explain_traces:main"
|
|
101
101
|
tg-show-explain-trace = "trustgraph.cli.show_explain_trace:main"
|
|
102
102
|
|
|
@@ -36,7 +36,7 @@ TG_SELECTED_EDGE = TG + "selectedEdge"
|
|
|
36
36
|
TG_EDGE = TG + "edge"
|
|
37
37
|
TG_REASONING = TG + "reasoning"
|
|
38
38
|
TG_CONTENT = TG + "content"
|
|
39
|
-
|
|
39
|
+
TG_CONTAINS = TG + "contains"
|
|
40
40
|
PROV = "http://www.w3.org/ns/prov#"
|
|
41
41
|
PROV_STARTED_AT_TIME = PROV + "startedAtTime"
|
|
42
42
|
PROV_WAS_DERIVED_FROM = PROV + "wasDerivedFrom"
|
|
@@ -185,18 +185,18 @@ async def _query_edge_provenance(ws_url, flow_id, edge_s, edge_p, edge_o, user,
|
|
|
185
185
|
"""
|
|
186
186
|
Query for provenance of an edge (s, p, o) in the knowledge graph.
|
|
187
187
|
|
|
188
|
-
Finds
|
|
188
|
+
Finds subgraphs that contain the edge via tg:contains, then follows
|
|
189
189
|
prov:wasDerivedFrom to find source documents.
|
|
190
190
|
|
|
191
191
|
Returns list of source URIs (chunks, pages, documents).
|
|
192
192
|
"""
|
|
193
|
-
# Query for
|
|
193
|
+
# Query for subgraphs that contain this edge: ?subgraph tg:contains <<s p o>>
|
|
194
194
|
request = {
|
|
195
195
|
"id": "edge-prov-request",
|
|
196
196
|
"service": "triples",
|
|
197
197
|
"flow": flow_id,
|
|
198
198
|
"request": {
|
|
199
|
-
"p": {"t": "i", "i":
|
|
199
|
+
"p": {"t": "i", "i": TG_CONTAINS},
|
|
200
200
|
"o": {
|
|
201
201
|
"t": "t", # Quoted triple type
|
|
202
202
|
"tr": {
|
|
@@ -40,7 +40,7 @@ SOURCE_GRAPH = "urn:graph:source"
|
|
|
40
40
|
|
|
41
41
|
# Provenance predicates for edge tracing
|
|
42
42
|
TG = "https://trustgraph.ai/ns/"
|
|
43
|
-
|
|
43
|
+
TG_CONTAINS = TG + "contains"
|
|
44
44
|
PROV = "http://www.w3.org/ns/prov#"
|
|
45
45
|
PROV_WAS_DERIVED_FROM = PROV + "wasDerivedFrom"
|
|
46
46
|
|
|
@@ -79,10 +79,10 @@ def trace_edge_provenance(flow, user, collection, edge, label_cache, explain_cli
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
# Query: ?
|
|
82
|
+
# Query: ?subgraph tg:contains <<edge>>
|
|
83
83
|
try:
|
|
84
84
|
results = flow.triples_query(
|
|
85
|
-
p=
|
|
85
|
+
p=TG_CONTAINS,
|
|
86
86
|
o=quoted_triple,
|
|
87
87
|
g=SOURCE_GRAPH,
|
|
88
88
|
user=user,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Show
|
|
2
|
+
Show extraction provenance: Document -> Pages -> Chunks -> Edges.
|
|
3
3
|
|
|
4
4
|
Given a document ID, traverses and displays all derived entities
|
|
5
5
|
(pages, chunks, extracted edges) using prov:wasDerivedFrom relationships.
|
|
6
6
|
|
|
7
7
|
Examples:
|
|
8
|
-
tg-show-
|
|
9
|
-
tg-show-
|
|
8
|
+
tg-show-extraction-provenance -U trustgraph -C default "urn:trustgraph:doc:abc123"
|
|
9
|
+
tg-show-extraction-provenance --show-content --max-content 500 "urn:trustgraph:doc:abc123"
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
import argparse
|
|
@@ -25,10 +25,22 @@ PROV_WAS_DERIVED_FROM = "http://www.w3.org/ns/prov#wasDerivedFrom"
|
|
|
25
25
|
RDFS_LABEL = "http://www.w3.org/2000/01/rdf-schema#label"
|
|
26
26
|
RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
|
27
27
|
TG = "https://trustgraph.ai/ns/"
|
|
28
|
-
|
|
28
|
+
TG_CONTAINS = TG + "contains"
|
|
29
|
+
TG_DOCUMENT_TYPE = TG + "Document"
|
|
30
|
+
TG_PAGE_TYPE = TG + "Page"
|
|
31
|
+
TG_CHUNK_TYPE = TG + "Chunk"
|
|
32
|
+
TG_SUBGRAPH_TYPE = TG + "Subgraph"
|
|
29
33
|
DC_TITLE = "http://purl.org/dc/terms/title"
|
|
30
34
|
DC_FORMAT = "http://purl.org/dc/terms/format"
|
|
31
35
|
|
|
36
|
+
# Map TrustGraph type URIs to display names
|
|
37
|
+
TYPE_MAP = {
|
|
38
|
+
TG_DOCUMENT_TYPE: "document",
|
|
39
|
+
TG_PAGE_TYPE: "page",
|
|
40
|
+
TG_CHUNK_TYPE: "chunk",
|
|
41
|
+
TG_SUBGRAPH_TYPE: "subgraph",
|
|
42
|
+
}
|
|
43
|
+
|
|
32
44
|
# Source graph
|
|
33
45
|
SOURCE_GRAPH = "urn:graph:source"
|
|
34
46
|
|
|
@@ -109,15 +121,15 @@ def extract_value(term):
|
|
|
109
121
|
|
|
110
122
|
|
|
111
123
|
def get_node_metadata(socket, flow_id, user, collection, node_uri):
|
|
112
|
-
"""Get metadata for a node (label,
|
|
124
|
+
"""Get metadata for a node (label, types, title, format)."""
|
|
113
125
|
triples = query_triples(socket, flow_id, user, collection, s=node_uri, g=SOURCE_GRAPH)
|
|
114
126
|
|
|
115
|
-
metadata = {"uri": node_uri}
|
|
127
|
+
metadata = {"uri": node_uri, "types": []}
|
|
116
128
|
for s, p, o in triples:
|
|
117
129
|
if p == RDFS_LABEL:
|
|
118
130
|
metadata["label"] = o
|
|
119
131
|
elif p == RDF_TYPE:
|
|
120
|
-
metadata["
|
|
132
|
+
metadata["types"].append(o)
|
|
121
133
|
elif p == DC_TITLE:
|
|
122
134
|
metadata["title"] = o
|
|
123
135
|
elif p == DC_FORMAT:
|
|
@@ -126,6 +138,14 @@ def get_node_metadata(socket, flow_id, user, collection, node_uri):
|
|
|
126
138
|
return metadata
|
|
127
139
|
|
|
128
140
|
|
|
141
|
+
def classify_node(metadata):
|
|
142
|
+
"""Classify a node based on its rdf:type values."""
|
|
143
|
+
for type_uri in metadata.get("types", []):
|
|
144
|
+
if type_uri in TYPE_MAP:
|
|
145
|
+
return TYPE_MAP[type_uri]
|
|
146
|
+
return "unknown"
|
|
147
|
+
|
|
148
|
+
|
|
129
149
|
def get_children(socket, flow_id, user, collection, parent_uri):
|
|
130
150
|
"""Get children of a node via prov:wasDerivedFrom."""
|
|
131
151
|
triples = query_triples(
|
|
@@ -135,29 +155,6 @@ def get_children(socket, flow_id, user, collection, parent_uri):
|
|
|
135
155
|
return [s for s, p, o in triples]
|
|
136
156
|
|
|
137
157
|
|
|
138
|
-
def get_edges_from_chunk(socket, flow_id, user, collection, chunk_uri):
|
|
139
|
-
"""Get edges that were derived from a chunk (via tg:reifies)."""
|
|
140
|
-
# Query for triples where: ?stmt prov:wasDerivedFrom chunk_uri
|
|
141
|
-
# Then get the tg:reifies value
|
|
142
|
-
derived_triples = query_triples(
|
|
143
|
-
socket, flow_id, user, collection,
|
|
144
|
-
p=PROV_WAS_DERIVED_FROM, o=chunk_uri, g=SOURCE_GRAPH
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
edges = []
|
|
148
|
-
for stmt_uri, _, _ in derived_triples:
|
|
149
|
-
# Get what this statement reifies
|
|
150
|
-
reifies_triples = query_triples(
|
|
151
|
-
socket, flow_id, user, collection,
|
|
152
|
-
s=stmt_uri, p=TG_REIFIES, g=SOURCE_GRAPH
|
|
153
|
-
)
|
|
154
|
-
for _, _, edge in reifies_triples:
|
|
155
|
-
if isinstance(edge, dict):
|
|
156
|
-
edges.append(edge)
|
|
157
|
-
|
|
158
|
-
return edges
|
|
159
|
-
|
|
160
|
-
|
|
161
158
|
def get_document_content(api, user, doc_id, max_content):
|
|
162
159
|
"""Fetch document content from librarian API."""
|
|
163
160
|
try:
|
|
@@ -176,32 +173,6 @@ def get_document_content(api, user, doc_id, max_content):
|
|
|
176
173
|
return f"[Error fetching content: {e}]"
|
|
177
174
|
|
|
178
175
|
|
|
179
|
-
def classify_uri(uri):
|
|
180
|
-
"""Classify a URI as document, page, or chunk based on patterns."""
|
|
181
|
-
if not isinstance(uri, str):
|
|
182
|
-
return "unknown"
|
|
183
|
-
|
|
184
|
-
# Common patterns in trustgraph URIs
|
|
185
|
-
if "/c" in uri and uri.split("/c")[-1].isdigit():
|
|
186
|
-
return "chunk"
|
|
187
|
-
if "/p" in uri and any(uri.split("/p")[-1].replace("/", "").isdigit() for _ in [1]):
|
|
188
|
-
# Check for page pattern like /p1 or /p1/
|
|
189
|
-
parts = uri.split("/p")
|
|
190
|
-
if len(parts) > 1:
|
|
191
|
-
remainder = parts[-1].split("/")[0]
|
|
192
|
-
if remainder.isdigit():
|
|
193
|
-
return "page"
|
|
194
|
-
|
|
195
|
-
if "chunk" in uri.lower():
|
|
196
|
-
return "chunk"
|
|
197
|
-
if "page" in uri.lower():
|
|
198
|
-
return "page"
|
|
199
|
-
if "doc" in uri.lower():
|
|
200
|
-
return "document"
|
|
201
|
-
|
|
202
|
-
return "unknown"
|
|
203
|
-
|
|
204
|
-
|
|
205
176
|
def build_hierarchy(socket, flow_id, user, collection, root_uri, api=None, show_content=False, max_content=200, visited=None):
|
|
206
177
|
"""Build document hierarchy tree recursively."""
|
|
207
178
|
if visited is None:
|
|
@@ -212,7 +183,7 @@ def build_hierarchy(socket, flow_id, user, collection, root_uri, api=None, show_
|
|
|
212
183
|
visited.add(root_uri)
|
|
213
184
|
|
|
214
185
|
metadata = get_node_metadata(socket, flow_id, user, collection, root_uri)
|
|
215
|
-
node_type =
|
|
186
|
+
node_type = classify_node(metadata)
|
|
216
187
|
|
|
217
188
|
node = {
|
|
218
189
|
"uri": root_uri,
|
|
@@ -232,10 +203,20 @@ def build_hierarchy(socket, flow_id, user, collection, root_uri, api=None, show_
|
|
|
232
203
|
children_uris = get_children(socket, flow_id, user, collection, root_uri)
|
|
233
204
|
|
|
234
205
|
for child_uri in children_uris:
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if child_type
|
|
206
|
+
child_metadata = get_node_metadata(socket, flow_id, user, collection, child_uri)
|
|
207
|
+
child_type = classify_node(child_metadata)
|
|
208
|
+
|
|
209
|
+
if child_type == "subgraph":
|
|
210
|
+
# Subgraphs contain extracted edges — inline them
|
|
211
|
+
contains_triples = query_triples(
|
|
212
|
+
socket, flow_id, user, collection,
|
|
213
|
+
s=child_uri, p=TG_CONTAINS, g=SOURCE_GRAPH
|
|
214
|
+
)
|
|
215
|
+
for _, _, edge in contains_triples:
|
|
216
|
+
if isinstance(edge, dict):
|
|
217
|
+
node["edges"].append(edge)
|
|
218
|
+
else:
|
|
219
|
+
# Recurse into pages, chunks, etc.
|
|
239
220
|
child_node = build_hierarchy(
|
|
240
221
|
socket, flow_id, user, collection, child_uri,
|
|
241
222
|
api=api, show_content=show_content, max_content=max_content,
|
|
@@ -244,11 +225,6 @@ def build_hierarchy(socket, flow_id, user, collection, root_uri, api=None, show_
|
|
|
244
225
|
if child_node:
|
|
245
226
|
node["children"].append(child_node)
|
|
246
227
|
|
|
247
|
-
# Get edges for chunks
|
|
248
|
-
if node_type == "chunk":
|
|
249
|
-
edges = get_edges_from_chunk(socket, flow_id, user, collection, root_uri)
|
|
250
|
-
node["edges"] = edges
|
|
251
|
-
|
|
252
228
|
# Sort children by URI for consistent output
|
|
253
229
|
node["children"].sort(key=lambda x: x.get("uri", ""))
|
|
254
230
|
|
|
@@ -332,7 +308,7 @@ def print_json(node):
|
|
|
332
308
|
|
|
333
309
|
def main():
|
|
334
310
|
parser = argparse.ArgumentParser(
|
|
335
|
-
prog='tg-show-
|
|
311
|
+
prog='tg-show-extraction-provenance',
|
|
336
312
|
description=__doc__,
|
|
337
313
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
338
314
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.1.20"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trustgraph-cli
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.20
|
|
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
|
|
@@ -52,8 +52,8 @@ trustgraph/cli/set_prompt.py
|
|
|
52
52
|
trustgraph/cli/set_token_costs.py
|
|
53
53
|
trustgraph/cli/set_tool.py
|
|
54
54
|
trustgraph/cli/show_config.py
|
|
55
|
-
trustgraph/cli/show_document_hierarchy.py
|
|
56
55
|
trustgraph/cli/show_explain_trace.py
|
|
56
|
+
trustgraph/cli/show_extraction_provenance.py
|
|
57
57
|
trustgraph/cli/show_flow_blueprints.py
|
|
58
58
|
trustgraph/cli/show_flow_state.py
|
|
59
59
|
trustgraph/cli/show_flows.py
|
|
@@ -48,8 +48,8 @@ tg-set-prompt = trustgraph.cli.set_prompt:main
|
|
|
48
48
|
tg-set-token-costs = trustgraph.cli.set_token_costs:main
|
|
49
49
|
tg-set-tool = trustgraph.cli.set_tool:main
|
|
50
50
|
tg-show-config = trustgraph.cli.show_config:main
|
|
51
|
-
tg-show-document-hierarchy = trustgraph.cli.show_document_hierarchy:main
|
|
52
51
|
tg-show-explain-trace = trustgraph.cli.show_explain_trace:main
|
|
52
|
+
tg-show-extraction-provenance = trustgraph.cli.show_extraction_provenance:main
|
|
53
53
|
tg-show-flow-blueprints = trustgraph.cli.show_flow_blueprints:main
|
|
54
54
|
tg-show-flow-state = trustgraph.cli.show_flow_state:main
|
|
55
55
|
tg-show-flows = trustgraph.cli.show_flows:main
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.1.18"
|
|
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.18 → trustgraph_cli-2.1.20}/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
|
|
File without changes
|
|
File without changes
|
{trustgraph_cli-2.1.18 → trustgraph_cli-2.1.20}/trustgraph_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|