trustgraph-cli 2.11.5__tar.gz → 2.11.6__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.11.5 → trustgraph_cli-2.11.6}/PKG-INFO +1 -1
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/pyproject.toml +3 -0
- trustgraph_cli-2.11.6/trustgraph/cli/delete_ontology.py +73 -0
- trustgraph_cli-2.11.6/trustgraph/cli/get_ontology.py +97 -0
- trustgraph_cli-2.11.6/trustgraph/cli/put_ontology.py +137 -0
- trustgraph_cli-2.11.6/trustgraph/cli_version.py +1 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph_cli.egg-info/PKG-INFO +1 -1
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph_cli.egg-info/SOURCES.txt +3 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph_cli.egg-info/entry_points.txt +3 -0
- trustgraph_cli-2.11.5/trustgraph/cli_version.py +0 -1
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/README.md +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/setup.cfg +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/__init__.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/_iam.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/add_library_document.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/bootstrap_iam.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/change_password.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/create_api_key.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/create_user.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/create_workspace.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/delete_collection.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/delete_config_item.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/delete_flow_blueprint.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/delete_kg_core.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/delete_mcp_tool.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/delete_tool.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/delete_user.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/describe_image.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/disable_user.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/dump_msgpack.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/dump_queues.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/enable_user.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/export_workspace.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/export_workspace_config.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/get_config_item.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/get_de_core.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/get_document_content.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/get_flow_blueprint.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/get_kg_core.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/graph_to_turtle.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/import_workspace.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/import_workspace_config.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/init_pulsar_manager.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_agent.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_cloze.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_decision_scoring.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_document_embeddings.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_document_rag.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_embeddings.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_field_extraction.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_graph_embeddings.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_graph_rag.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_llm.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_mcp_tool.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_nl_sparql.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_nlp_query.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_ontology_subset.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_prompt.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_reranker.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_row_embeddings.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_rows_query.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_sparql_nl_query.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_sparql_query.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/invoke_structured_query.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/list_api_keys.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/list_cloze_models.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/list_collections.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/list_config_items.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/list_explain_traces.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/list_models.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/list_my_workspaces.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/list_ontologies.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/list_users.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/list_workspaces.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/load_doc_embeds.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/load_kg_core.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/load_knowledge.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/load_sample_documents.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/load_structured_data.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/load_turtle.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/login.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/mint_token.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/monitor_prompts.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/nquads.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/put_config_item.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/put_de_core.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/put_flow_blueprint.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/put_kg_core.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/query_graph.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/remove_library_document.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/reset_password.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/revoke_api_key.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/__init__.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/belgian-beer.md +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/bronze-age-collapse.pdf +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/corporate-scandals.pdf +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/history-of-pets.md +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/metadata.json +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/mil-fortifications-america-19th-c.md +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/recipes.md +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/trade-routes-europe.md +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/save_doc_embeds.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/set_collection.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/set_mcp_tool.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/set_prompt.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/set_token_costs.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/set_tool.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_config.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_explain_trace.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_extraction_provenance.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_flow_blueprints.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_flow_state.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_flows.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_graph.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_kg_cores.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_library_documents.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_library_processing.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_mcp_tools.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_parameter_types.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_processor_state.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_prompts.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_token_costs.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_token_rate.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/show_tools.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/start_flow.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/start_library_processing.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/stop_flow.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/stop_library_processing.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/unload_kg_core.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/update_user.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/verify_system_status.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/whoami.py +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph_cli.egg-info/dependency_links.txt +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph_cli.egg-info/requires.txt +0 -0
- {trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/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.11.
|
|
3
|
+
Version: 2.11.6
|
|
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
|
|
@@ -79,6 +79,9 @@ tg-invoke-sparql-query = "trustgraph.cli.invoke_sparql_query:main"
|
|
|
79
79
|
tg-invoke-nl-sparql = "trustgraph.cli.invoke_nl_sparql:main"
|
|
80
80
|
tg-invoke-sparql-nl-query = "trustgraph.cli.invoke_sparql_nl_query:main"
|
|
81
81
|
tg-invoke-ontology-subset = "trustgraph.cli.invoke_ontology_subset:main"
|
|
82
|
+
tg-put-ontology = "trustgraph.cli.put_ontology:main"
|
|
83
|
+
tg-delete-ontology = "trustgraph.cli.delete_ontology:main"
|
|
84
|
+
tg-get-ontology = "trustgraph.cli.get_ontology:main"
|
|
82
85
|
tg-list-ontologies = "trustgraph.cli.list_ontologies:main"
|
|
83
86
|
tg-invoke-row-embeddings = "trustgraph.cli.invoke_row_embeddings:main"
|
|
84
87
|
tg-invoke-prompt = "trustgraph.cli.invoke_prompt:main"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Deletes a loaded ontology from the config service.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
from trustgraph.api import Api
|
|
9
|
+
from trustgraph.api.types import ConfigKey
|
|
10
|
+
|
|
11
|
+
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
12
|
+
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
|
13
|
+
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def delete_ontology(url, ontology_id, token=None, workspace="default"):
|
|
17
|
+
api = Api(url, token=token, workspace=workspace).config()
|
|
18
|
+
|
|
19
|
+
config_key = ConfigKey(type="ontology", key=ontology_id)
|
|
20
|
+
api.delete([config_key])
|
|
21
|
+
|
|
22
|
+
print(f"Ontology '{ontology_id}' deleted")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def main():
|
|
26
|
+
|
|
27
|
+
parser = argparse.ArgumentParser(
|
|
28
|
+
prog='tg-delete-ontology',
|
|
29
|
+
description=__doc__,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
parser.add_argument(
|
|
33
|
+
'--ontology-id', '-i',
|
|
34
|
+
required=True,
|
|
35
|
+
help='Ontology identifier',
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
parser.add_argument(
|
|
39
|
+
'-u', '--api-url',
|
|
40
|
+
default=default_url,
|
|
41
|
+
help=f'API URL (default: {default_url})',
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
parser.add_argument(
|
|
45
|
+
'-t', '--token',
|
|
46
|
+
default=default_token,
|
|
47
|
+
help='Authentication token (default: $TRUSTGRAPH_TOKEN)',
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
parser.add_argument(
|
|
51
|
+
'-w', '--workspace',
|
|
52
|
+
default=default_workspace,
|
|
53
|
+
help=f'Workspace (default: {default_workspace})',
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
args = parser.parse_args()
|
|
57
|
+
|
|
58
|
+
try:
|
|
59
|
+
|
|
60
|
+
delete_ontology(
|
|
61
|
+
url=args.api_url,
|
|
62
|
+
ontology_id=args.ontology_id,
|
|
63
|
+
token=args.token,
|
|
64
|
+
workspace=args.workspace,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
except Exception as e:
|
|
68
|
+
|
|
69
|
+
print("Exception:", e, flush=True)
|
|
70
|
+
sys.exit(1)
|
|
71
|
+
|
|
72
|
+
if __name__ == "__main__":
|
|
73
|
+
main()
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Retrieves a loaded ontology from the config service. Can output as
|
|
3
|
+
JSON-LD (default) or convert to Turtle, RDF/XML, or N-Triples via rdflib.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
from rdflib import Graph
|
|
10
|
+
from trustgraph.api import Api
|
|
11
|
+
from trustgraph.api.types import ConfigKey
|
|
12
|
+
|
|
13
|
+
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
14
|
+
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
|
15
|
+
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def from_jsonld(jsonld, fmt):
|
|
19
|
+
if fmt == "json-ld":
|
|
20
|
+
return jsonld
|
|
21
|
+
g = Graph()
|
|
22
|
+
g.parse(data=jsonld, format="json-ld")
|
|
23
|
+
return g.serialize(format=fmt)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_ontology(url, ontology_id, fmt, token=None, workspace="default"):
|
|
27
|
+
api = Api(url, token=token, workspace=workspace).config()
|
|
28
|
+
|
|
29
|
+
config_key = ConfigKey(type="ontology", key=ontology_id)
|
|
30
|
+
values = api.get([config_key])
|
|
31
|
+
|
|
32
|
+
if not values:
|
|
33
|
+
raise Exception(
|
|
34
|
+
f"Ontology not found: {ontology_id}"
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
jsonld = values[0].value
|
|
38
|
+
print(from_jsonld(jsonld, fmt))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def main():
|
|
42
|
+
|
|
43
|
+
parser = argparse.ArgumentParser(
|
|
44
|
+
prog='tg-get-ontology',
|
|
45
|
+
description=__doc__,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
parser.add_argument(
|
|
49
|
+
'--ontology-id', '-i',
|
|
50
|
+
required=True,
|
|
51
|
+
help='Ontology identifier',
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
parser.add_argument(
|
|
55
|
+
'--format', '-f',
|
|
56
|
+
choices=['json-ld', 'turtle', 'xml', 'nt'],
|
|
57
|
+
default='json-ld',
|
|
58
|
+
help='Output format (default: json-ld)',
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
parser.add_argument(
|
|
62
|
+
'-u', '--api-url',
|
|
63
|
+
default=default_url,
|
|
64
|
+
help=f'API URL (default: {default_url})',
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
parser.add_argument(
|
|
68
|
+
'-t', '--token',
|
|
69
|
+
default=default_token,
|
|
70
|
+
help='Authentication token (default: $TRUSTGRAPH_TOKEN)',
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
parser.add_argument(
|
|
74
|
+
'-w', '--workspace',
|
|
75
|
+
default=default_workspace,
|
|
76
|
+
help=f'Workspace (default: {default_workspace})',
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
args = parser.parse_args()
|
|
80
|
+
|
|
81
|
+
try:
|
|
82
|
+
|
|
83
|
+
get_ontology(
|
|
84
|
+
url=args.api_url,
|
|
85
|
+
ontology_id=args.ontology_id,
|
|
86
|
+
fmt=args.format,
|
|
87
|
+
token=args.token,
|
|
88
|
+
workspace=args.workspace,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
except Exception as e:
|
|
92
|
+
|
|
93
|
+
print("Exception:", e, flush=True)
|
|
94
|
+
sys.exit(1)
|
|
95
|
+
|
|
96
|
+
if __name__ == "__main__":
|
|
97
|
+
main()
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Loads an ontology from a file into the ontology config. Supports Turtle,
|
|
3
|
+
RDF/XML, N-Triples, and JSON-LD input formats — non-JSON-LD formats are
|
|
4
|
+
converted automatically via rdflib.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import argparse
|
|
8
|
+
import os
|
|
9
|
+
import sys
|
|
10
|
+
from rdflib import Graph
|
|
11
|
+
from trustgraph.api import Api
|
|
12
|
+
from trustgraph.api.types import ConfigValue
|
|
13
|
+
|
|
14
|
+
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8888/')
|
|
15
|
+
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
|
16
|
+
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
|
|
17
|
+
|
|
18
|
+
FORMAT_MAP = {
|
|
19
|
+
".ttl": "turtle",
|
|
20
|
+
".turtle": "turtle",
|
|
21
|
+
".rdf": "xml",
|
|
22
|
+
".owl": "xml",
|
|
23
|
+
".xml": "xml",
|
|
24
|
+
".nt": "nt",
|
|
25
|
+
".ntriples": "nt",
|
|
26
|
+
".jsonld": "json-ld",
|
|
27
|
+
".json": "json-ld",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def detect_format(filename):
|
|
32
|
+
ext = os.path.splitext(filename)[1].lower()
|
|
33
|
+
fmt = FORMAT_MAP.get(ext)
|
|
34
|
+
if fmt is None:
|
|
35
|
+
raise ValueError(
|
|
36
|
+
f"Cannot detect format from extension '{ext}'. "
|
|
37
|
+
f"Use --format to specify one of: turtle, xml, nt, json-ld"
|
|
38
|
+
)
|
|
39
|
+
return fmt
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_jsonld(data, fmt):
|
|
43
|
+
if fmt == "json-ld":
|
|
44
|
+
return data
|
|
45
|
+
g = Graph()
|
|
46
|
+
g.parse(data=data, format=fmt)
|
|
47
|
+
return g.serialize(format="json-ld")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def put_ontology(url, ontology_id, data, fmt, token=None,
|
|
51
|
+
workspace="default"):
|
|
52
|
+
jsonld = to_jsonld(data, fmt)
|
|
53
|
+
|
|
54
|
+
api = Api(url, token=token, workspace=workspace).config()
|
|
55
|
+
|
|
56
|
+
config_value = ConfigValue(type="ontology", key=ontology_id, value=jsonld)
|
|
57
|
+
api.put([config_value])
|
|
58
|
+
|
|
59
|
+
print(f"Ontology '{ontology_id}' loaded ({fmt} → json-ld)")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def main():
|
|
63
|
+
|
|
64
|
+
parser = argparse.ArgumentParser(
|
|
65
|
+
prog='tg-put-ontology',
|
|
66
|
+
description=__doc__,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
parser.add_argument(
|
|
70
|
+
'file',
|
|
71
|
+
nargs='?',
|
|
72
|
+
help='Ontology file to load (omit to read from stdin)',
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
parser.add_argument(
|
|
76
|
+
'--ontology-id', '-i',
|
|
77
|
+
required=True,
|
|
78
|
+
help='Ontology identifier',
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
parser.add_argument(
|
|
82
|
+
'--format', '-f',
|
|
83
|
+
choices=['turtle', 'xml', 'nt', 'json-ld'],
|
|
84
|
+
default=None,
|
|
85
|
+
help='Input format (default: auto-detect from file extension)',
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
parser.add_argument(
|
|
89
|
+
'-u', '--api-url',
|
|
90
|
+
default=default_url,
|
|
91
|
+
help=f'API URL (default: {default_url})',
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
parser.add_argument(
|
|
95
|
+
'-t', '--token',
|
|
96
|
+
default=default_token,
|
|
97
|
+
help='Authentication token (default: $TRUSTGRAPH_TOKEN)',
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
parser.add_argument(
|
|
101
|
+
'-w', '--workspace',
|
|
102
|
+
default=default_workspace,
|
|
103
|
+
help=f'Workspace (default: {default_workspace})',
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
args = parser.parse_args()
|
|
107
|
+
|
|
108
|
+
try:
|
|
109
|
+
|
|
110
|
+
if args.file:
|
|
111
|
+
with open(args.file, 'r') as f:
|
|
112
|
+
data = f.read()
|
|
113
|
+
fmt = args.format or detect_format(args.file)
|
|
114
|
+
else:
|
|
115
|
+
data = sys.stdin.read()
|
|
116
|
+
if args.format is None:
|
|
117
|
+
parser.error(
|
|
118
|
+
"--format is required when reading from stdin"
|
|
119
|
+
)
|
|
120
|
+
fmt = args.format
|
|
121
|
+
|
|
122
|
+
put_ontology(
|
|
123
|
+
url=args.api_url,
|
|
124
|
+
ontology_id=args.ontology_id,
|
|
125
|
+
data=data,
|
|
126
|
+
fmt=fmt,
|
|
127
|
+
token=args.token,
|
|
128
|
+
workspace=args.workspace,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
except Exception as e:
|
|
132
|
+
|
|
133
|
+
print("Exception:", e, flush=True)
|
|
134
|
+
sys.exit(1)
|
|
135
|
+
|
|
136
|
+
if __name__ == "__main__":
|
|
137
|
+
main()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.11.6"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trustgraph-cli
|
|
3
|
-
Version: 2.11.
|
|
3
|
+
Version: 2.11.6
|
|
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
|
|
@@ -14,6 +14,7 @@ trustgraph/cli/delete_config_item.py
|
|
|
14
14
|
trustgraph/cli/delete_flow_blueprint.py
|
|
15
15
|
trustgraph/cli/delete_kg_core.py
|
|
16
16
|
trustgraph/cli/delete_mcp_tool.py
|
|
17
|
+
trustgraph/cli/delete_ontology.py
|
|
17
18
|
trustgraph/cli/delete_tool.py
|
|
18
19
|
trustgraph/cli/delete_user.py
|
|
19
20
|
trustgraph/cli/describe_image.py
|
|
@@ -28,6 +29,7 @@ trustgraph/cli/get_de_core.py
|
|
|
28
29
|
trustgraph/cli/get_document_content.py
|
|
29
30
|
trustgraph/cli/get_flow_blueprint.py
|
|
30
31
|
trustgraph/cli/get_kg_core.py
|
|
32
|
+
trustgraph/cli/get_ontology.py
|
|
31
33
|
trustgraph/cli/graph_to_turtle.py
|
|
32
34
|
trustgraph/cli/import_workspace.py
|
|
33
35
|
trustgraph/cli/import_workspace_config.py
|
|
@@ -77,6 +79,7 @@ trustgraph/cli/put_config_item.py
|
|
|
77
79
|
trustgraph/cli/put_de_core.py
|
|
78
80
|
trustgraph/cli/put_flow_blueprint.py
|
|
79
81
|
trustgraph/cli/put_kg_core.py
|
|
82
|
+
trustgraph/cli/put_ontology.py
|
|
80
83
|
trustgraph/cli/query_graph.py
|
|
81
84
|
trustgraph/cli/remove_library_document.py
|
|
82
85
|
trustgraph/cli/reset_password.py
|
|
@@ -10,6 +10,7 @@ tg-delete-config-item = trustgraph.cli.delete_config_item:main
|
|
|
10
10
|
tg-delete-flow-blueprint = trustgraph.cli.delete_flow_blueprint:main
|
|
11
11
|
tg-delete-kg-core = trustgraph.cli.delete_kg_core:main
|
|
12
12
|
tg-delete-mcp-tool = trustgraph.cli.delete_mcp_tool:main
|
|
13
|
+
tg-delete-ontology = trustgraph.cli.delete_ontology:main
|
|
13
14
|
tg-delete-tool = trustgraph.cli.delete_tool:main
|
|
14
15
|
tg-delete-user = trustgraph.cli.delete_user:main
|
|
15
16
|
tg-describe-image = trustgraph.cli.describe_image:main
|
|
@@ -24,6 +25,7 @@ tg-get-de-core = trustgraph.cli.get_de_core:main
|
|
|
24
25
|
tg-get-document-content = trustgraph.cli.get_document_content:main
|
|
25
26
|
tg-get-flow-blueprint = trustgraph.cli.get_flow_blueprint:main
|
|
26
27
|
tg-get-kg-core = trustgraph.cli.get_kg_core:main
|
|
28
|
+
tg-get-ontology = trustgraph.cli.get_ontology:main
|
|
27
29
|
tg-graph-to-turtle = trustgraph.cli.graph_to_turtle:main
|
|
28
30
|
tg-import-workspace = trustgraph.cli.import_workspace:main
|
|
29
31
|
tg-import-workspace-config = trustgraph.cli.import_workspace_config:main
|
|
@@ -71,6 +73,7 @@ tg-put-config-item = trustgraph.cli.put_config_item:main
|
|
|
71
73
|
tg-put-de-core = trustgraph.cli.put_de_core:main
|
|
72
74
|
tg-put-flow-blueprint = trustgraph.cli.put_flow_blueprint:main
|
|
73
75
|
tg-put-kg-core = trustgraph.cli.put_kg_core:main
|
|
76
|
+
tg-put-ontology = trustgraph.cli.put_ontology:main
|
|
74
77
|
tg-query-graph = trustgraph.cli.query_graph:main
|
|
75
78
|
tg-remove-library-document = trustgraph.cli.remove_library_document:main
|
|
76
79
|
tg-reset-password = trustgraph.cli.reset_password:main
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.11.5"
|
|
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.11.5 → trustgraph_cli-2.11.6}/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
|
{trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/belgian-beer.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph/cli/sample_documents/history-of-pets.md
RENAMED
|
File without changes
|
{trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/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.11.5 → trustgraph_cli-2.11.6}/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
|
{trustgraph_cli-2.11.5 → trustgraph_cli-2.11.6}/trustgraph_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|