trustgraph-cli 2.9.11__tar.gz → 2.10.1__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.9.11 → trustgraph_cli-2.10.1}/PKG-INFO +2 -2
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/pyproject.toml +1 -1
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_document_embeddings.py +19 -2
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_graph_embeddings.py +29 -2
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_row_embeddings.py +18 -1
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/load_knowledge.py +21 -15
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/load_turtle.py +12 -15
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/nquads.py +30 -13
- trustgraph_cli-2.10.1/trustgraph/cli_version.py +1 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph_cli.egg-info/PKG-INFO +2 -2
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph_cli.egg-info/requires.txt +1 -1
- trustgraph_cli-2.9.11/trustgraph/cli_version.py +0 -1
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/README.md +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/setup.cfg +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/__init__.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/_iam.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/add_library_document.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/bootstrap_iam.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/change_password.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/create_api_key.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/create_user.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/create_workspace.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/delete_collection.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/delete_config_item.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/delete_flow_blueprint.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/delete_kg_core.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/delete_mcp_tool.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/delete_tool.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/delete_user.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/describe_image.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/disable_user.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/dump_msgpack.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/dump_queues.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/enable_user.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/export_workspace.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/export_workspace_config.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/get_config_item.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/get_de_core.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/get_document_content.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/get_flow_blueprint.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/get_kg_core.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/graph_to_turtle.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/import_workspace.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/import_workspace_config.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/init_pulsar_manager.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_agent.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_document_rag.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_embeddings.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_graph_rag.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_llm.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_mcp_tool.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_nlp_query.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_prompt.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_reranker.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_rows_query.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_sparql_query.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_structured_query.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/list_api_keys.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/list_collections.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/list_config_items.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/list_explain_traces.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/list_my_workspaces.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/list_users.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/list_workspaces.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/load_doc_embeds.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/load_kg_core.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/load_sample_documents.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/load_structured_data.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/login.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/monitor_prompts.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/put_config_item.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/put_de_core.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/put_flow_blueprint.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/put_kg_core.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/query_graph.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/remove_library_document.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/reset_password.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/revoke_api_key.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/__init__.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/belgian-beer.md +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/bronze-age-collapse.pdf +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/corporate-scandals.pdf +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/history-of-pets.md +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/metadata.json +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/mil-fortifications-america-19th-c.md +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/recipes.md +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/trade-routes-europe.md +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/save_doc_embeds.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/set_collection.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/set_mcp_tool.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/set_prompt.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/set_token_costs.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/set_tool.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_config.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_explain_trace.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_extraction_provenance.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_flow_blueprints.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_flow_state.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_flows.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_graph.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_kg_cores.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_library_documents.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_library_processing.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_mcp_tools.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_parameter_types.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_processor_state.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_prompts.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_token_costs.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_token_rate.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_tools.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/start_flow.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/start_library_processing.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/stop_flow.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/stop_library_processing.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/unload_kg_core.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/update_user.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/verify_system_status.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/whoami.py +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph_cli.egg-info/SOURCES.txt +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph_cli.egg-info/dependency_links.txt +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph_cli.egg-info/entry_points.txt +0 -0
- {trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/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.
|
|
3
|
+
Version: 2.10.1
|
|
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
|
|
@@ -8,7 +8,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
8
8
|
Classifier: Operating System :: OS Independent
|
|
9
9
|
Requires-Python: >=3.10
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
|
-
Requires-Dist: trustgraph-base<2.
|
|
11
|
+
Requires-Dist: trustgraph-base<2.11,>=2.10
|
|
12
12
|
Requires-Dist: requests
|
|
13
13
|
Requires-Dist: pulsar-client
|
|
14
14
|
Requires-Dist: aiohttp
|
|
@@ -10,7 +10,7 @@ description = "TrustGraph provides a means to run a pipeline of flexible AI proc
|
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.10"
|
|
12
12
|
dependencies = [
|
|
13
|
-
"trustgraph-base>=2.
|
|
13
|
+
"trustgraph-base>=2.10,<2.11",
|
|
14
14
|
"requests",
|
|
15
15
|
"pulsar-client",
|
|
16
16
|
"aiohttp",
|
{trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/invoke_document_embeddings.py
RENAMED
|
@@ -11,7 +11,10 @@ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
|
11
11
|
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
|
12
12
|
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
|
|
13
13
|
|
|
14
|
-
def query(
|
|
14
|
+
def query(
|
|
15
|
+
url, flow_id, query_text, collection, limit,
|
|
16
|
+
attributes=None, token=None, workspace="default",
|
|
17
|
+
):
|
|
15
18
|
|
|
16
19
|
# Create API client
|
|
17
20
|
api = Api(url=url, token=token, workspace=workspace)
|
|
@@ -23,7 +26,8 @@ def query(url, flow_id, query_text, collection, limit, token=None, workspace="de
|
|
|
23
26
|
result = flow.document_embeddings_query(
|
|
24
27
|
text=query_text,
|
|
25
28
|
collection=collection,
|
|
26
|
-
limit=limit
|
|
29
|
+
limit=limit,
|
|
30
|
+
attributes=attributes,
|
|
27
31
|
)
|
|
28
32
|
|
|
29
33
|
chunks = result.get("chunks", [])
|
|
@@ -83,6 +87,13 @@ def main():
|
|
|
83
87
|
help='Maximum number of results (default: 10)',
|
|
84
88
|
)
|
|
85
89
|
|
|
90
|
+
parser.add_argument(
|
|
91
|
+
'-a', '--attribute',
|
|
92
|
+
action='append',
|
|
93
|
+
default=[],
|
|
94
|
+
help='Filter attribute as key=value (repeatable)',
|
|
95
|
+
)
|
|
96
|
+
|
|
86
97
|
parser.add_argument(
|
|
87
98
|
'query',
|
|
88
99
|
nargs=1,
|
|
@@ -91,6 +102,11 @@ def main():
|
|
|
91
102
|
|
|
92
103
|
args = parser.parse_args()
|
|
93
104
|
|
|
105
|
+
attributes = {}
|
|
106
|
+
for attr in args.attribute:
|
|
107
|
+
k, _, v = attr.partition('=')
|
|
108
|
+
attributes[k] = v
|
|
109
|
+
|
|
94
110
|
try:
|
|
95
111
|
|
|
96
112
|
query(
|
|
@@ -99,6 +115,7 @@ def main():
|
|
|
99
115
|
query_text=args.query[0],
|
|
100
116
|
collection=args.collection,
|
|
101
117
|
limit=args.limit,
|
|
118
|
+
attributes=attributes or None,
|
|
102
119
|
token=args.token,
|
|
103
120
|
workspace=args.workspace,
|
|
104
121
|
)
|
|
@@ -4,6 +4,7 @@ Returns a list of matching graph entities.
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
import argparse
|
|
7
|
+
import json
|
|
7
8
|
import os
|
|
8
9
|
from trustgraph.api import Api
|
|
9
10
|
|
|
@@ -11,7 +12,11 @@ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
|
11
12
|
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
|
12
13
|
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
|
|
13
14
|
|
|
14
|
-
def query(
|
|
15
|
+
def query(
|
|
16
|
+
url, flow_id, query_text, collection, limit,
|
|
17
|
+
rdf_type=None, attributes=None,
|
|
18
|
+
token=None, workspace="default",
|
|
19
|
+
):
|
|
15
20
|
|
|
16
21
|
# Create API client
|
|
17
22
|
api = Api(url=url, token=token, workspace=workspace)
|
|
@@ -23,7 +28,9 @@ def query(url, flow_id, query_text, collection, limit, token=None, workspace="de
|
|
|
23
28
|
result = flow.graph_embeddings_query(
|
|
24
29
|
text=query_text,
|
|
25
30
|
collection=collection,
|
|
26
|
-
limit=limit
|
|
31
|
+
limit=limit,
|
|
32
|
+
rdf_type=rdf_type,
|
|
33
|
+
attributes=attributes,
|
|
27
34
|
)
|
|
28
35
|
|
|
29
36
|
entities = result.get("entities", [])
|
|
@@ -93,6 +100,19 @@ def main():
|
|
|
93
100
|
help='Maximum number of results (default: 10)',
|
|
94
101
|
)
|
|
95
102
|
|
|
103
|
+
parser.add_argument(
|
|
104
|
+
'--rdf-type',
|
|
105
|
+
default=None,
|
|
106
|
+
help='RDF type IRI to filter results (optional)',
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
parser.add_argument(
|
|
110
|
+
'-a', '--attribute',
|
|
111
|
+
action='append',
|
|
112
|
+
default=[],
|
|
113
|
+
help='Filter attribute as key=value (repeatable)',
|
|
114
|
+
)
|
|
115
|
+
|
|
96
116
|
parser.add_argument(
|
|
97
117
|
'query',
|
|
98
118
|
nargs=1,
|
|
@@ -101,6 +121,11 @@ def main():
|
|
|
101
121
|
|
|
102
122
|
args = parser.parse_args()
|
|
103
123
|
|
|
124
|
+
attributes = {}
|
|
125
|
+
for attr in args.attribute:
|
|
126
|
+
k, _, v = attr.partition('=')
|
|
127
|
+
attributes[k] = v
|
|
128
|
+
|
|
104
129
|
try:
|
|
105
130
|
|
|
106
131
|
query(
|
|
@@ -109,6 +134,8 @@ def main():
|
|
|
109
134
|
query_text=args.query[0],
|
|
110
135
|
collection=args.collection,
|
|
111
136
|
limit=args.limit,
|
|
137
|
+
rdf_type=args.rdf_type,
|
|
138
|
+
attributes=attributes or None,
|
|
112
139
|
token=args.token,
|
|
113
140
|
workspace=args.workspace,
|
|
114
141
|
)
|
|
@@ -11,7 +11,10 @@ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
|
11
11
|
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
|
12
12
|
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
|
|
13
13
|
|
|
14
|
-
def query(
|
|
14
|
+
def query(
|
|
15
|
+
url, flow_id, query_text, schema_name, collection, index_name, limit,
|
|
16
|
+
attributes=None, token=None, workspace="default",
|
|
17
|
+
):
|
|
15
18
|
|
|
16
19
|
# Create API client
|
|
17
20
|
api = Api(url=url, token=token, workspace=workspace)
|
|
@@ -25,6 +28,7 @@ def query(url, flow_id, query_text, schema_name, collection, index_name, limit,
|
|
|
25
28
|
schema_name=schema_name,
|
|
26
29
|
collection=collection,
|
|
27
30
|
index_name=index_name,
|
|
31
|
+
attributes=attributes,
|
|
28
32
|
limit=limit
|
|
29
33
|
)
|
|
30
34
|
|
|
@@ -96,6 +100,13 @@ def main():
|
|
|
96
100
|
help='Maximum number of results (default: 10)',
|
|
97
101
|
)
|
|
98
102
|
|
|
103
|
+
parser.add_argument(
|
|
104
|
+
'-a', '--attribute',
|
|
105
|
+
action='append',
|
|
106
|
+
default=[],
|
|
107
|
+
help='Filter attribute as key=value (repeatable)',
|
|
108
|
+
)
|
|
109
|
+
|
|
99
110
|
parser.add_argument(
|
|
100
111
|
'query',
|
|
101
112
|
nargs=1,
|
|
@@ -104,6 +115,11 @@ def main():
|
|
|
104
115
|
|
|
105
116
|
args = parser.parse_args()
|
|
106
117
|
|
|
118
|
+
attributes = {}
|
|
119
|
+
for attr in args.attribute:
|
|
120
|
+
k, _, v = attr.partition('=')
|
|
121
|
+
attributes[k] = v
|
|
122
|
+
|
|
107
123
|
try:
|
|
108
124
|
|
|
109
125
|
query(
|
|
@@ -114,6 +130,7 @@ def main():
|
|
|
114
130
|
collection=args.collection,
|
|
115
131
|
index_name=args.index_name,
|
|
116
132
|
limit=args.limit,
|
|
133
|
+
attributes=attributes or None,
|
|
117
134
|
token=args.token,
|
|
118
135
|
workspace=args.workspace,
|
|
119
136
|
)
|
|
@@ -9,6 +9,7 @@ import rdflib
|
|
|
9
9
|
from typing import Iterator, Tuple
|
|
10
10
|
|
|
11
11
|
from trustgraph.api import Api, Triple
|
|
12
|
+
from trustgraph.api.types import Uri, Literal
|
|
12
13
|
from trustgraph.log_level import LogLevel
|
|
13
14
|
|
|
14
15
|
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
@@ -26,6 +27,7 @@ class KnowledgeLoader:
|
|
|
26
27
|
document_id,
|
|
27
28
|
url=default_url,
|
|
28
29
|
token=None, workspace="default",
|
|
30
|
+
graph="",
|
|
29
31
|
):
|
|
30
32
|
self.files = files
|
|
31
33
|
self.flow = flow
|
|
@@ -34,6 +36,7 @@ class KnowledgeLoader:
|
|
|
34
36
|
self.url = url
|
|
35
37
|
self.token = token
|
|
36
38
|
self.workspace = workspace
|
|
39
|
+
self.graph = graph
|
|
37
40
|
|
|
38
41
|
def load_triples_from_file(self, file) -> Iterator[Triple]:
|
|
39
42
|
"""Generator that yields Triple objects from a Turtle file"""
|
|
@@ -42,23 +45,19 @@ class KnowledgeLoader:
|
|
|
42
45
|
g.parse(file, format="turtle")
|
|
43
46
|
|
|
44
47
|
for e in g:
|
|
45
|
-
s_value = str(e[0])
|
|
46
|
-
p_value = str(e[1])
|
|
47
|
-
o_value = str(e[2])
|
|
48
|
-
|
|
49
|
-
o_datatype = ""
|
|
50
|
-
o_language = ""
|
|
48
|
+
s_value = Uri(str(e[0]))
|
|
49
|
+
p_value = Uri(str(e[1]))
|
|
51
50
|
|
|
52
51
|
if isinstance(e[2], rdflib.term.Literal):
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
52
|
+
o_value = Literal(
|
|
53
|
+
str(e[2]),
|
|
54
|
+
datatype=str(e[2].datatype) if e[2].datatype else None,
|
|
55
|
+
language=str(e[2].language) if e[2].language else None,
|
|
56
|
+
)
|
|
57
|
+
else:
|
|
58
|
+
o_value = Uri(str(e[2]))
|
|
59
|
+
|
|
60
|
+
yield Triple(s=s_value, p=p_value, o=o_value, g=self.graph)
|
|
62
61
|
|
|
63
62
|
def load_entity_contexts_from_file(self, file) -> Iterator[Tuple[str, str]]:
|
|
64
63
|
"""Generator that yields (entity, context) tuples from a Turtle file"""
|
|
@@ -184,6 +183,12 @@ def main():
|
|
|
184
183
|
help=f'Collection ID (default: {default_collection})'
|
|
185
184
|
)
|
|
186
185
|
|
|
186
|
+
parser.add_argument(
|
|
187
|
+
'-g', '--graph',
|
|
188
|
+
default="",
|
|
189
|
+
help='Named graph URI (e.g. urn:graph:policy). Default: default graph'
|
|
190
|
+
)
|
|
191
|
+
|
|
187
192
|
parser.add_argument(
|
|
188
193
|
'files', nargs='+',
|
|
189
194
|
help=f'Turtle files to load'
|
|
@@ -202,6 +207,7 @@ def main():
|
|
|
202
207
|
files=args.files,
|
|
203
208
|
collection=args.collection,
|
|
204
209
|
workspace=args.workspace,
|
|
210
|
+
graph=args.graph,
|
|
205
211
|
)
|
|
206
212
|
|
|
207
213
|
loader.run()
|
|
@@ -9,6 +9,7 @@ import rdflib
|
|
|
9
9
|
from typing import Iterator
|
|
10
10
|
|
|
11
11
|
from trustgraph.api import Api, Triple
|
|
12
|
+
from trustgraph.api.types import Uri, Literal
|
|
12
13
|
from trustgraph.log_level import LogLevel
|
|
13
14
|
|
|
14
15
|
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
@@ -42,23 +43,19 @@ class Loader:
|
|
|
42
43
|
g.parse(file, format="turtle")
|
|
43
44
|
|
|
44
45
|
for e in g:
|
|
45
|
-
s_value = str(e[0])
|
|
46
|
-
p_value = str(e[1])
|
|
47
|
-
o_value = str(e[2])
|
|
48
|
-
|
|
49
|
-
o_datatype = ""
|
|
50
|
-
o_language = ""
|
|
46
|
+
s_value = Uri(str(e[0]))
|
|
47
|
+
p_value = Uri(str(e[1]))
|
|
51
48
|
|
|
52
49
|
if isinstance(e[2], rdflib.term.Literal):
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
50
|
+
o_value = Literal(
|
|
51
|
+
str(e[2]),
|
|
52
|
+
datatype=str(e[2].datatype) if e[2].datatype else None,
|
|
53
|
+
language=str(e[2].language) if e[2].language else None,
|
|
54
|
+
)
|
|
55
|
+
else:
|
|
56
|
+
o_value = Uri(str(e[2]))
|
|
57
|
+
|
|
58
|
+
yield Triple(s=s_value, p=p_value, o=o_value)
|
|
62
59
|
|
|
63
60
|
def run(self):
|
|
64
61
|
"""Load triples using Python API"""
|
|
@@ -13,7 +13,7 @@ import re
|
|
|
13
13
|
import rdflib
|
|
14
14
|
|
|
15
15
|
from trustgraph.schema import IRI, LITERAL
|
|
16
|
-
from trustgraph.api.types import Triple
|
|
16
|
+
from trustgraph.api.types import Triple, Uri, Literal
|
|
17
17
|
|
|
18
18
|
# RDF-star quoted triples have no standard N-Quads encoding; they are
|
|
19
19
|
# skipped with a count so callers can surface the omission.
|
|
@@ -39,6 +39,21 @@ _BAD_IRI = re.compile(r'[\x00-\x20<>"{}|^\x60\\]')
|
|
|
39
39
|
_LANGTAG = re.compile(r"[a-zA-Z]+(?:-[a-zA-Z0-9]+)*")
|
|
40
40
|
|
|
41
41
|
|
|
42
|
+
def valid_language_tag(language):
|
|
43
|
+
"""True when language can be emitted after the '@' of a LANGTAG.
|
|
44
|
+
|
|
45
|
+
The wire schema types the language field as a free-form str, so an
|
|
46
|
+
unusable tag arrives here as data, not as a bug.
|
|
47
|
+
"""
|
|
48
|
+
return isinstance(language, str) and _LANGTAG.fullmatch(language) is not None
|
|
49
|
+
|
|
50
|
+
# The body of the LANGTAG production, [a-zA-Z]+ ('-' [a-zA-Z0-9]+)*, which
|
|
51
|
+
# Turtle shares and which is the shape rdflib's Literal(lang=...) accepts.
|
|
52
|
+
# fullmatch, not a trailing $: $ also matches before a trailing newline, so
|
|
53
|
+
# "en\n" would pass and split the quad across two lines.
|
|
54
|
+
_LANGTAG = re.compile(r"[a-zA-Z]+(?:-[a-zA-Z0-9]+)*")
|
|
55
|
+
|
|
56
|
+
|
|
42
57
|
def valid_language_tag(language):
|
|
43
58
|
"""True when language can be emitted after the '@' of a LANGTAG.
|
|
44
59
|
|
|
@@ -135,22 +150,24 @@ def serialize_nquads(batches, graph_iri, out):
|
|
|
135
150
|
return written, skipped
|
|
136
151
|
|
|
137
152
|
|
|
138
|
-
def
|
|
139
|
-
"""Convert an rdflib term to
|
|
153
|
+
def _rdflib_to_object(term):
|
|
154
|
+
"""Convert an rdflib term to a Uri or Literal."""
|
|
140
155
|
if isinstance(term, rdflib.Literal):
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
156
|
+
return Literal(
|
|
157
|
+
str(term),
|
|
158
|
+
datatype=str(term.datatype) if term.datatype else None,
|
|
159
|
+
language=str(term.language) if term.language else None,
|
|
160
|
+
)
|
|
161
|
+
return Uri(str(term))
|
|
145
162
|
|
|
146
163
|
|
|
147
164
|
def parse_nquads(data):
|
|
148
165
|
"""Parse N-Quads bytes back into api Triple values.
|
|
149
166
|
|
|
150
167
|
Preserves datatype, language tag and IRI-vs-literal distinctions
|
|
151
|
-
via
|
|
152
|
-
|
|
153
|
-
|
|
168
|
+
via Literal's datatype and language attributes. The whole member is
|
|
169
|
+
materialized in memory (bundles are bounded by --triples-limit at
|
|
170
|
+
export); line-streaming is a possible follow-up.
|
|
154
171
|
|
|
155
172
|
:param data: N-Quads bytes (one bundle member)
|
|
156
173
|
:returns: list of Triple
|
|
@@ -159,9 +176,9 @@ def parse_nquads(data):
|
|
|
159
176
|
ds.parse(data=data.decode("utf-8"), format="nquads")
|
|
160
177
|
result = []
|
|
161
178
|
for s, p, o, _g in ds.quads((None, None, None, None)):
|
|
162
|
-
o_val, o_dt, o_lang = _term_to_triple_field(o)
|
|
163
179
|
result.append(Triple(
|
|
164
|
-
s=str(s)
|
|
165
|
-
|
|
180
|
+
s=Uri(str(s)),
|
|
181
|
+
p=Uri(str(p)),
|
|
182
|
+
o=_rdflib_to_object(o),
|
|
166
183
|
))
|
|
167
184
|
return result
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.10.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trustgraph-cli
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.10.1
|
|
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
|
|
@@ -8,7 +8,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
8
8
|
Classifier: Operating System :: OS Independent
|
|
9
9
|
Requires-Python: >=3.10
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
|
-
Requires-Dist: trustgraph-base<2.
|
|
11
|
+
Requires-Dist: trustgraph-base<2.11,>=2.10
|
|
12
12
|
Requires-Dist: requests
|
|
13
13
|
Requires-Dist: pulsar-client
|
|
14
14
|
Requires-Dist: aiohttp
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.9.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
|
|
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.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/belgian-beer.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/history-of-pets.md
RENAMED
|
File without changes
|
{trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/sample_documents/metadata.json
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
|
{trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph/cli/show_extraction_provenance.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
|
{trustgraph_cli-2.9.11 → trustgraph_cli-2.10.1}/trustgraph_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|