pyegeria 5.3.9.9.3__py3-none-any.whl → 5.5.3.3__py3-none-any.whl
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.
Potentially problematic release.
This version of pyegeria might be problematic. Click here for more details.
- commands/__init__.py +24 -0
- commands/cat/Dr-Egeria_md-orig.py +2 -2
- commands/cat/__init__.py +1 -17
- commands/cat/collection_actions.py +197 -0
- commands/cat/dr_egeria_command_help.py +372 -0
- commands/cat/dr_egeria_jupyter.py +7 -7
- commands/cat/dr_egeria_md.py +27 -182
- commands/cat/exp_list_glossaries.py +11 -14
- commands/cat/get_asset_graph.py +37 -267
- commands/cat/{get_collection.py → get_collection_tree.py} +10 -18
- commands/cat/get_project_dependencies.py +14 -14
- commands/cat/get_project_structure.py +15 -14
- commands/cat/get_tech_type_elements.py +16 -116
- commands/cat/glossary_actions.py +145 -298
- commands/cat/list_assets.py +3 -11
- commands/cat/list_cert_types.py +17 -63
- commands/cat/list_collections.py +46 -138
- commands/cat/list_deployed_catalogs.py +15 -27
- commands/cat/list_deployed_database_schemas.py +27 -43
- commands/cat/list_deployed_databases.py +16 -31
- commands/cat/list_deployed_servers.py +35 -54
- commands/cat/list_glossaries.py +18 -17
- commands/cat/list_projects.py +10 -12
- commands/cat/list_tech_type_elements.py +21 -37
- commands/cat/list_tech_types.py +13 -25
- commands/cat/list_terms.py +38 -79
- commands/cat/list_todos.py +4 -11
- commands/cat/list_user_ids.py +3 -10
- commands/cat/my_reports.py +559 -0
- commands/cat/run_report.py +394 -0
- commands/cat/run_report_orig.py +528 -0
- commands/cli/egeria.py +222 -247
- commands/cli/egeria_cat.py +68 -81
- commands/cli/egeria_my.py +13 -0
- commands/cli/egeria_ops.py +69 -74
- commands/cli/egeria_tech.py +17 -93
- commands/cli/ops_config.py +3 -6
- commands/{cat/list_categories.py → deprecated/list_data_designer.py} +53 -64
- commands/{cat/list_data_structures.py → deprecated/list_data_structures_full.py} +3 -6
- commands/deprecated/old_get_asset_graph.py +315 -0
- commands/my/__init__.py +0 -2
- commands/my/list_my_profile.py +27 -34
- commands/my/list_my_roles.py +1 -7
- commands/my/monitor_my_todos.py +1 -7
- commands/my/monitor_open_todos.py +6 -7
- commands/my/todo_actions.py +4 -5
- commands/ops/__init__.py +0 -2
- commands/ops/gov_server_actions.py +17 -21
- commands/ops/list_archives.py +17 -38
- commands/ops/list_catalog_targets.py +33 -40
- commands/ops/load_archive.py +35 -26
- commands/ops/{monitor_engine_activity_c.py → monitor_active_engine_activity.py} +51 -82
- commands/ops/{monitor_integ_daemon_status.py → monitor_daemon_status.py} +35 -55
- commands/ops/monitor_engine_activity.py +79 -77
- commands/ops/{monitor_gov_eng_status.py → monitor_engine_status.py} +10 -7
- commands/ops/monitor_platform_status.py +38 -50
- commands/ops/monitor_server_startup.py +6 -11
- commands/ops/monitor_server_status.py +7 -11
- commands/ops/orig_monitor_server_list.py +8 -8
- commands/ops/orig_monitor_server_status.py +1 -5
- commands/ops/refresh_integration_daemon.py +5 -5
- commands/ops/restart_integration_daemon.py +5 -5
- commands/ops/table_integ_daemon_status.py +6 -6
- commands/ops/x_engine_actions.py +7 -7
- commands/tech/__init__.py +0 -2
- commands/tech/{generic_actions.py → element_actions.py} +6 -11
- commands/tech/get_element_info.py +20 -29
- commands/tech/get_guid_info.py +23 -42
- commands/tech/get_tech_details.py +20 -35
- commands/tech/get_tech_type_template.py +28 -39
- commands/tech/list_all_om_type_elements.py +24 -30
- commands/tech/list_all_om_type_elements_x.py +22 -28
- commands/tech/list_all_related_elements.py +19 -28
- commands/tech/list_anchored_elements.py +22 -30
- commands/tech/list_asset_types.py +19 -24
- commands/tech/list_elements_by_classification_by_property_value.py +26 -32
- commands/tech/list_elements_by_property_value.py +19 -25
- commands/tech/list_elements_by_property_value_x.py +20 -28
- commands/tech/list_elements_for_classification.py +28 -41
- commands/tech/list_gov_action_processes.py +16 -27
- commands/tech/list_information_supply_chains.py +22 -30
- commands/tech/list_registered_services.py +14 -26
- commands/tech/list_related_elements_with_prop_value.py +15 -25
- commands/tech/list_related_specification.py +1 -4
- commands/tech/list_relationship_types.py +15 -25
- commands/tech/list_relationships.py +20 -36
- commands/tech/list_solution_blueprints.py +28 -33
- commands/tech/list_solution_components.py +23 -29
- commands/tech/list_solution_roles.py +21 -32
- commands/tech/list_tech_templates.py +51 -54
- commands/tech/list_valid_metadata_values.py +5 -9
- commands/tech/table_tech_templates.py +2 -6
- commands/tech/x_list_related_elements.py +1 -4
- examples/GeoSpatial Products Example.py +524 -0
- examples/Jupyter Notebooks/P-egeria-server-config.ipynb +2137 -0
- examples/Jupyter Notebooks/README.md +2 -0
- examples/Jupyter Notebooks/common/P-environment-check.ipynb +115 -0
- examples/Jupyter Notebooks/common/__init__.py +14 -0
- examples/Jupyter Notebooks/common/common-functions.ipynb +4694 -0
- examples/Jupyter Notebooks/common/environment-check.ipynb +52 -0
- examples/Jupyter Notebooks/common/globals.ipynb +184 -0
- examples/Jupyter Notebooks/common/globals.py +154 -0
- examples/Jupyter Notebooks/common/orig_globals.py +152 -0
- examples/format_sets/all_format_sets.json +910 -0
- examples/format_sets/custom_format_sets.json +268 -0
- examples/format_sets/subset_format_sets.json +187 -0
- examples/format_sets_save_load_example.py +291 -0
- examples/jacquard_data_sets.py +129 -0
- examples/output_formats_example.py +193 -0
- examples/test_jacquard_data_sets.py +54 -0
- examples/test_jacquard_data_sets_scenarios.py +94 -0
- md_processing/__init__.py +90 -0
- md_processing/command_dispatcher.py +33 -0
- md_processing/command_mapping.py +221 -0
- md_processing/data/commands/commands_data_designer.json +537 -0
- md_processing/data/commands/commands_external_reference.json +733 -0
- md_processing/data/commands/commands_feedback.json +155 -0
- md_processing/data/commands/commands_general.json +204 -0
- md_processing/data/commands/commands_glossary.json +218 -0
- md_processing/data/commands/commands_governance.json +3678 -0
- md_processing/data/commands/commands_product_manager.json +865 -0
- md_processing/data/commands/commands_project.json +642 -0
- md_processing/data/commands/commands_solution_architect.json +366 -0
- md_processing/data/commands.json +17568 -0
- md_processing/data/commands_working.json +30641 -0
- md_processing/data/gened_report_specs.py +6584 -0
- md_processing/data/generated_format_sets.json +6533 -0
- md_processing/data/generated_format_sets_old.json +4137 -0
- md_processing/data/generated_format_sets_old.py +45 -0
- md_processing/dr_egeria.py +182 -0
- md_processing/md_commands/__init__.py +3 -0
- md_processing/md_commands/data_designer_commands.py +1276 -0
- md_processing/md_commands/ext_ref_commands.py +530 -0
- md_processing/md_commands/feedback_commands.py +726 -0
- md_processing/md_commands/glossary_commands.py +684 -0
- md_processing/md_commands/governance_officer_commands.py +600 -0
- md_processing/md_commands/product_manager_commands.py +1266 -0
- md_processing/md_commands/project_commands.py +383 -0
- md_processing/md_commands/solution_architect_commands.py +1184 -0
- md_processing/md_commands/view_commands.py +295 -0
- md_processing/md_processing_utils/__init__.py +4 -0
- md_processing/md_processing_utils/common_md_proc_utils.py +1249 -0
- md_processing/md_processing_utils/common_md_utils.py +578 -0
- md_processing/md_processing_utils/determine_width.py +103 -0
- md_processing/md_processing_utils/extraction_utils.py +547 -0
- md_processing/md_processing_utils/gen_report_specs.py +643 -0
- md_processing/md_processing_utils/generate_dr_help.py +193 -0
- md_processing/md_processing_utils/generate_md_cmd_templates.py +144 -0
- md_processing/md_processing_utils/generate_md_templates.py +83 -0
- md_processing/md_processing_utils/md_processing_constants.py +1228 -0
- md_processing/md_processing_utils/message_constants.py +19 -0
- pyegeria/__init__.py +201 -443
- pyegeria/core/__init__.py +40 -0
- pyegeria/core/_base_platform_client.py +574 -0
- pyegeria/core/_base_server_client.py +573 -0
- pyegeria/core/_exceptions.py +457 -0
- pyegeria/core/_globals.py +60 -0
- pyegeria/core/_server_client.py +6073 -0
- pyegeria/core/_validators.py +257 -0
- pyegeria/core/config.py +654 -0
- pyegeria/{create_tech_guid_lists.py → core/create_tech_guid_lists.py} +0 -1
- pyegeria/core/load_config.py +37 -0
- pyegeria/core/logging_configuration.py +207 -0
- pyegeria/core/mcp_adapter.py +144 -0
- pyegeria/core/mcp_server.py +212 -0
- pyegeria/core/utils.py +405 -0
- pyegeria/deprecated/__init__.py +0 -0
- pyegeria/{_client.py → deprecated/_client.py} +62 -24
- pyegeria/{_deprecated_gov_engine.py → deprecated/_deprecated_gov_engine.py} +16 -16
- pyegeria/{classification_manager_omvs.py → deprecated/classification_manager_omvs.py} +1988 -1878
- pyegeria/deprecated/output_formatter_with_machine_keys.py +1127 -0
- pyegeria/{runtime_manager_omvs.py → deprecated/runtime_manager_omvs.py} +216 -229
- pyegeria/{valid_metadata_omvs.py → deprecated/valid_metadata_omvs.py} +93 -93
- pyegeria/{x_action_author_omvs.py → deprecated/x_action_author_omvs.py} +2 -3
- pyegeria/egeria_cat_client.py +25 -51
- pyegeria/egeria_client.py +140 -98
- pyegeria/egeria_config_client.py +48 -24
- pyegeria/egeria_tech_client.py +170 -83
- pyegeria/models/__init__.py +150 -0
- pyegeria/models/collection_models.py +168 -0
- pyegeria/models/models.py +654 -0
- pyegeria/omvs/__init__.py +84 -0
- pyegeria/omvs/action_author.py +342 -0
- pyegeria/omvs/actor_manager.py +5980 -0
- pyegeria/omvs/asset_catalog.py +842 -0
- pyegeria/omvs/asset_maker.py +2736 -0
- pyegeria/omvs/automated_curation.py +4403 -0
- pyegeria/omvs/classification_manager.py +11213 -0
- pyegeria/omvs/collection_manager.py +5780 -0
- pyegeria/omvs/community_matters_omvs.py +468 -0
- pyegeria/{core_omag_server_config.py → omvs/core_omag_server_config.py} +157 -157
- pyegeria/{data_designer_omvs.py → omvs/data_designer.py} +1991 -1691
- pyegeria/omvs/data_discovery.py +869 -0
- pyegeria/omvs/data_engineer.py +372 -0
- pyegeria/omvs/digital_business.py +1133 -0
- pyegeria/omvs/external_links.py +1752 -0
- pyegeria/omvs/feedback_manager.py +834 -0
- pyegeria/{full_omag_server_config.py → omvs/full_omag_server_config.py} +73 -69
- pyegeria/omvs/glossary_manager.py +3231 -0
- pyegeria/omvs/governance_officer.py +3009 -0
- pyegeria/omvs/lineage_linker.py +314 -0
- pyegeria/omvs/location_arena.py +1525 -0
- pyegeria/omvs/metadata_expert.py +668 -0
- pyegeria/omvs/metadata_explorer_omvs.py +2943 -0
- pyegeria/omvs/my_profile.py +1042 -0
- pyegeria/omvs/notification_manager.py +358 -0
- pyegeria/omvs/people_organizer.py +394 -0
- pyegeria/{platform_services.py → omvs/platform_services.py} +113 -193
- pyegeria/omvs/product_manager.py +1825 -0
- pyegeria/omvs/project_manager.py +1907 -0
- pyegeria/omvs/reference_data.py +1140 -0
- pyegeria/omvs/registered_info.py +334 -0
- pyegeria/omvs/runtime_manager.py +2817 -0
- pyegeria/omvs/schema_maker.py +446 -0
- pyegeria/{server_operations.py → omvs/server_operations.py} +27 -26
- pyegeria/omvs/solution_architect.py +6490 -0
- pyegeria/omvs/specification_properties.py +37 -0
- pyegeria/omvs/subject_area.py +1042 -0
- pyegeria/omvs/template_manager_omvs.py +236 -0
- pyegeria/omvs/time_keeper.py +1761 -0
- pyegeria/omvs/valid_metadata.py +3221 -0
- pyegeria/omvs/valid_metadata_lists.py +37 -0
- pyegeria/omvs/valid_type_lists.py +37 -0
- pyegeria/view/__init__.py +28 -0
- pyegeria/view/_output_format_models.py +514 -0
- pyegeria/view/_output_formats.py +14 -0
- pyegeria/view/base_report_formats.py +2719 -0
- pyegeria/view/dr_egeria_reports.py +56 -0
- pyegeria/view/format_set_executor.py +397 -0
- pyegeria/{md_processing_utils.py → view/md_processing_utils.py} +5 -5
- pyegeria/{mermaid_utilities.py → view/mermaid_utilities.py} +2 -154
- pyegeria/view/output_formatter.py +1297 -0
- pyegeria-5.5.3.3.dist-info/METADATA +218 -0
- pyegeria-5.5.3.3.dist-info/RECORD +241 -0
- {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.5.3.3.dist-info}/WHEEL +2 -1
- pyegeria-5.5.3.3.dist-info/entry_points.txt +103 -0
- pyegeria-5.5.3.3.dist-info/top_level.txt +4 -0
- commands/cat/.DS_Store +0 -0
- commands/cat/README.md +0 -16
- commands/cli/txt_custom_v2.tcss +0 -19
- commands/my/README.md +0 -17
- commands/ops/README.md +0 -24
- commands/ops/monitor_asset_events.py +0 -108
- commands/tech/README.md +0 -24
- pyegeria/.DS_Store +0 -0
- pyegeria/README.md +0 -35
- pyegeria/_globals.py +0 -47
- pyegeria/_validators.py +0 -385
- pyegeria/asset_catalog_omvs.py +0 -864
- pyegeria/automated_curation_omvs.py +0 -3765
- pyegeria/collection_manager_omvs.py +0 -2744
- pyegeria/dr.egeria spec.md +0 -9
- pyegeria/egeria_my_client.py +0 -56
- pyegeria/feedback_manager_omvs.py +0 -4573
- pyegeria/glossary_browser_omvs.py +0 -3728
- pyegeria/glossary_manager_omvs.py +0 -2440
- pyegeria/m_test.py +0 -118
- pyegeria/md_processing_helpers.py +0 -58
- pyegeria/md_processing_utils_orig.py +0 -1103
- pyegeria/metadata_explorer_omvs.py +0 -2326
- pyegeria/my_profile_omvs.py +0 -1022
- pyegeria/output_formatter.py +0 -389
- pyegeria/project_manager_omvs.py +0 -1933
- pyegeria/registered_info.py +0 -167
- pyegeria/solution_architect_omvs.py +0 -2156
- pyegeria/template_manager_omvs.py +0 -1414
- pyegeria/utils.py +0 -197
- pyegeria-5.3.9.9.3.dist-info/METADATA +0 -72
- pyegeria-5.3.9.9.3.dist-info/RECORD +0 -143
- pyegeria-5.3.9.9.3.dist-info/entry_points.txt +0 -99
- /pyegeria/{_exceptions.py → deprecated/_exceptions.py} +0 -0
- {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.5.3.3.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,2440 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
PDX-License-Identifier: Apache-2.0
|
|
3
|
-
Copyright Contributors to the ODPi Egeria project.
|
|
4
|
-
|
|
5
|
-
This module contains an initial version of the glossary_manager omvs module. There are additional methods that will be
|
|
6
|
-
added in subsequent versions of the glossary_omvs module.
|
|
7
|
-
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
import asyncio
|
|
11
|
-
import csv
|
|
12
|
-
import os
|
|
13
|
-
import time
|
|
14
|
-
from datetime import datetime
|
|
15
|
-
from typing import List
|
|
16
|
-
|
|
17
|
-
from pyegeria._client import Client
|
|
18
|
-
from pyegeria._exceptions import InvalidParameterException
|
|
19
|
-
from pyegeria._globals import NO_TERMS_FOUND
|
|
20
|
-
from pyegeria._validators import validate_guid, validate_name
|
|
21
|
-
from pyegeria.glossary_browser_omvs import GlossaryBrowser
|
|
22
|
-
from pyegeria.utils import body_slimmer
|
|
23
|
-
|
|
24
|
-
def query_seperator(current_string):
|
|
25
|
-
if current_string == "":
|
|
26
|
-
return "?"
|
|
27
|
-
else:
|
|
28
|
-
return "&"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"params are in the form of [(paramName, value), (param2Name, value)] if the value is not None, it will be added to the query string"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def query_string(params):
|
|
35
|
-
result = ""
|
|
36
|
-
for i in range(len(params)):
|
|
37
|
-
if params[i][1] is not None:
|
|
38
|
-
result = f"{result}{query_seperator(result)}{params[i][0]}={params[i][1]}"
|
|
39
|
-
return result
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def base_path(client, view_server: str):
|
|
43
|
-
return f"{client.platform_url}/servers/{view_server}/api/open-metadata/classification-manager"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
class GlossaryManager(GlossaryBrowser):
|
|
47
|
-
"""
|
|
48
|
-
GlossaryManager is a class that extends the Client class. It provides methods to create and manage glossaries,
|
|
49
|
-
terms and categories.
|
|
50
|
-
|
|
51
|
-
Attributes:
|
|
52
|
-
|
|
53
|
-
view_server: str
|
|
54
|
-
The name of the View Server to connect to.
|
|
55
|
-
platform_url : str
|
|
56
|
-
URL of the server platform to connect to
|
|
57
|
-
user_id : str
|
|
58
|
-
The identity of the user calling the method - this sets a default optionally used by the methods
|
|
59
|
-
when the user doesn't pass the user_id on a method call.
|
|
60
|
-
user_pwd: str
|
|
61
|
-
The password associated with the user_id. Defaults to None
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
def __init__(
|
|
67
|
-
self,
|
|
68
|
-
view_server: str,
|
|
69
|
-
platform_url: str,
|
|
70
|
-
user_id: str,
|
|
71
|
-
user_pwd: str = None,
|
|
72
|
-
token: str = None,
|
|
73
|
-
):
|
|
74
|
-
self.gl_mgr_command_root: str
|
|
75
|
-
self.view_server = view_server
|
|
76
|
-
self.platform_url = platform_url
|
|
77
|
-
self.user_id = user_id
|
|
78
|
-
self.user_pwd = user_pwd
|
|
79
|
-
|
|
80
|
-
Client.__init__(self, view_server, platform_url, user_id, user_pwd, token)
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
# Get Valid Values for Enumerations
|
|
84
|
-
#
|
|
85
|
-
|
|
86
|
-
def __validate_term_status__(self, status: str) -> bool:
|
|
87
|
-
"""Return True if the status is a legal glossary term status"""
|
|
88
|
-
recognized_term_status = self.get_glossary_term_statuses()
|
|
89
|
-
return status in recognized_term_status
|
|
90
|
-
|
|
91
|
-
async def _async_create_glossary(
|
|
92
|
-
self,
|
|
93
|
-
display_name: str,
|
|
94
|
-
description: str,
|
|
95
|
-
language: str = "English",
|
|
96
|
-
usage: str = None,
|
|
97
|
-
) -> str:
|
|
98
|
-
"""Create a new glossary. Async version.
|
|
99
|
-
|
|
100
|
-
Parameters
|
|
101
|
-
----------
|
|
102
|
-
display_name: str
|
|
103
|
-
The name of the new glossary. This will be used to produce a unique qualified name for the glossary.
|
|
104
|
-
description: str
|
|
105
|
-
A description of the glossary.
|
|
106
|
-
language: str, optional, default = "English"
|
|
107
|
-
The language the used for the glossary
|
|
108
|
-
usage: str, optional, default = None
|
|
109
|
-
How the glossary is intended to be used
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
Returns
|
|
113
|
-
-------
|
|
114
|
-
str
|
|
115
|
-
The GUID of the created glossary.
|
|
116
|
-
|
|
117
|
-
"""
|
|
118
|
-
|
|
119
|
-
url = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries"
|
|
120
|
-
body = {
|
|
121
|
-
"class": "ReferenceableRequestBody",
|
|
122
|
-
"elementProperties": {
|
|
123
|
-
"class": "GlossaryProperties",
|
|
124
|
-
"qualifiedName": self.__create_qualified_name__("Glossary", display_name),
|
|
125
|
-
"displayName": display_name,
|
|
126
|
-
"description": description,
|
|
127
|
-
"language": language,
|
|
128
|
-
"usage": usage,
|
|
129
|
-
},
|
|
130
|
-
}
|
|
131
|
-
response = await self._async_make_request("POST", url, body_slimmer(body))
|
|
132
|
-
return response.json().get("guid", None)
|
|
133
|
-
|
|
134
|
-
def create_glossary(
|
|
135
|
-
self,
|
|
136
|
-
display_name: str,
|
|
137
|
-
description: str,
|
|
138
|
-
language: str = "English",
|
|
139
|
-
usage: str = None,
|
|
140
|
-
) -> str:
|
|
141
|
-
"""Create a new glossary.
|
|
142
|
-
|
|
143
|
-
Parameters
|
|
144
|
-
----------
|
|
145
|
-
display_name: str
|
|
146
|
-
The name of the new glossary. This will be used to produce a unique qualified name for the glossary.
|
|
147
|
-
description: str
|
|
148
|
-
A description of the glossary.
|
|
149
|
-
language: str, optional, default = "English"
|
|
150
|
-
The language the used for the glossary
|
|
151
|
-
usage: str, optional, default = None
|
|
152
|
-
How the glossary is intended to be used
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
Returns
|
|
156
|
-
-------
|
|
157
|
-
str
|
|
158
|
-
The GUID of the created glossary.
|
|
159
|
-
|
|
160
|
-
"""
|
|
161
|
-
loop = asyncio.get_event_loop()
|
|
162
|
-
response = loop.run_until_complete(
|
|
163
|
-
self._async_create_glossary(display_name, description, language, usage)
|
|
164
|
-
)
|
|
165
|
-
return response
|
|
166
|
-
|
|
167
|
-
async def _async_delete_glossary(self, glossary_guid: str, cascade:bool = False) -> None:
|
|
168
|
-
"""Delete glossary. Async version.
|
|
169
|
-
|
|
170
|
-
Parameters
|
|
171
|
-
----------
|
|
172
|
-
glossary_guid: str
|
|
173
|
-
The ID of the glossary to delete.
|
|
174
|
-
cascade: bool, optional, default = False
|
|
175
|
-
If true, then delete all terms and categories in the glossary as well.
|
|
176
|
-
|
|
177
|
-
Returns
|
|
178
|
-
-------
|
|
179
|
-
None
|
|
180
|
-
|
|
181
|
-
"""
|
|
182
|
-
cascade_str = str(cascade).lower()
|
|
183
|
-
url = (
|
|
184
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
185
|
-
f"{glossary_guid}/remove?cascadedDelete={cascade_str}"
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
await self._async_make_request("POST", url)
|
|
189
|
-
|
|
190
|
-
def delete_glossary(self, glossary_guid: str, cascade: bool = False) -> None:
|
|
191
|
-
"""Delete a new glossary.
|
|
192
|
-
|
|
193
|
-
Parameters
|
|
194
|
-
----------
|
|
195
|
-
glossary_guid: str
|
|
196
|
-
The ID of the glossary to delete.
|
|
197
|
-
cascade: bool, optional, default = False
|
|
198
|
-
If true, then delete all terms and categories in the glossary as well.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
Returns
|
|
202
|
-
-------
|
|
203
|
-
None
|
|
204
|
-
|
|
205
|
-
"""
|
|
206
|
-
loop = asyncio.get_event_loop()
|
|
207
|
-
loop.run_until_complete(self._async_delete_glossary(glossary_guid, cascade))
|
|
208
|
-
|
|
209
|
-
async def _async_update_glossary(
|
|
210
|
-
self,
|
|
211
|
-
glossary_guid: str,
|
|
212
|
-
body: dict,
|
|
213
|
-
is_merge_update: bool = True,
|
|
214
|
-
for_lineage: bool = False,
|
|
215
|
-
for_duplicate_processing: bool = False,
|
|
216
|
-
) -> None:
|
|
217
|
-
"""Update Glossary.
|
|
218
|
-
|
|
219
|
-
Async version.
|
|
220
|
-
|
|
221
|
-
Parameters
|
|
222
|
-
----------
|
|
223
|
-
glossary_guid: str
|
|
224
|
-
The ID of the glossary to update.
|
|
225
|
-
body: dict
|
|
226
|
-
A dict containing the properties to update.
|
|
227
|
-
is_merge_update: bool, optional, default = True
|
|
228
|
-
If true, then only those properties specified in the body will be updated. If false, then all the
|
|
229
|
-
properties of the glossary will be replaced with those of the body.
|
|
230
|
-
for_lineage: bool, optional, default = False
|
|
231
|
-
Normally false. Used when we want to retrieve elements that have been delete but have a Memento entry.
|
|
232
|
-
for_duplicate_processing: bool, optional, default = False
|
|
233
|
-
Normally false. Set true when Egeria is told to skip deduplication because another system will do it.
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
Returns
|
|
237
|
-
-------
|
|
238
|
-
None
|
|
239
|
-
|
|
240
|
-
Notes
|
|
241
|
-
-----
|
|
242
|
-
|
|
243
|
-
Sample body:
|
|
244
|
-
|
|
245
|
-
{
|
|
246
|
-
"class" : "ReferenceableRequestBody",
|
|
247
|
-
"elementProperties" :
|
|
248
|
-
{
|
|
249
|
-
"class" : "GlossaryProperties",
|
|
250
|
-
"qualifiedName" : "MyGlossary",
|
|
251
|
-
"displayName" : "My Glossary",
|
|
252
|
-
"description" : "This is an example glossary"
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
"""
|
|
256
|
-
|
|
257
|
-
url = (
|
|
258
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
259
|
-
f"{glossary_guid}/update?isMergeUpdate={is_merge_update}&forLineage={for_lineage}&"
|
|
260
|
-
f"forDuplicateProcessing={for_duplicate_processing}"
|
|
261
|
-
)
|
|
262
|
-
|
|
263
|
-
await self._async_make_request("POST", url, body_slimmer(body))
|
|
264
|
-
|
|
265
|
-
def update_glossary(
|
|
266
|
-
self,
|
|
267
|
-
glossary_guid: str,
|
|
268
|
-
body: dict,
|
|
269
|
-
is_merge_update: bool = True,
|
|
270
|
-
for_lineage: bool = False,
|
|
271
|
-
for_duplicate_processing: bool = False,
|
|
272
|
-
) -> None:
|
|
273
|
-
"""Update Glossary.
|
|
274
|
-
|
|
275
|
-
Parameters
|
|
276
|
-
----------
|
|
277
|
-
glossary_guid: str
|
|
278
|
-
The ID of the glossary to update.
|
|
279
|
-
body: dict
|
|
280
|
-
A dict containing the properties to update.
|
|
281
|
-
is_merge_update: bool, optional, default = True
|
|
282
|
-
If true, then only those properties specified in the body will be updated. If false, then all the
|
|
283
|
-
properties of the glossary will be replaced with those of the body.
|
|
284
|
-
for_lineage: bool, optional, default = False
|
|
285
|
-
Normally false. Used when we want to retrieve elements that have been delete but have a Memento entry.
|
|
286
|
-
for_duplicate_processing: bool, optional, default = False
|
|
287
|
-
Normally false. Set true when Egeria is told to skip deduplication because another system will do it.
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
Returns
|
|
291
|
-
-------
|
|
292
|
-
None
|
|
293
|
-
|
|
294
|
-
Notes
|
|
295
|
-
-----
|
|
296
|
-
|
|
297
|
-
Sample body:
|
|
298
|
-
|
|
299
|
-
{
|
|
300
|
-
"class" : "ReferenceableRequestBody",
|
|
301
|
-
"elementProperties" :
|
|
302
|
-
{
|
|
303
|
-
"class" : "GlossaryProperties",
|
|
304
|
-
"qualifiedName" : "MyGlossary",
|
|
305
|
-
"displayName" : "My Glossary",
|
|
306
|
-
"description" : "This is an example glossary"
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
"""
|
|
310
|
-
loop = asyncio.get_event_loop()
|
|
311
|
-
loop.run_until_complete(
|
|
312
|
-
self._async_update_glossary(
|
|
313
|
-
glossary_guid,
|
|
314
|
-
body,
|
|
315
|
-
is_merge_update,
|
|
316
|
-
for_lineage,
|
|
317
|
-
for_duplicate_processing,
|
|
318
|
-
)
|
|
319
|
-
)
|
|
320
|
-
|
|
321
|
-
#
|
|
322
|
-
# Glossaries
|
|
323
|
-
#
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
#
|
|
329
|
-
# Glossary Categories
|
|
330
|
-
#
|
|
331
|
-
async def _async_create_category(
|
|
332
|
-
self,
|
|
333
|
-
glossary_guid: str,
|
|
334
|
-
display_name: str,
|
|
335
|
-
description: str,
|
|
336
|
-
is_root_category: bool = False,
|
|
337
|
-
) -> str:
|
|
338
|
-
"""Create a new category within the specified glossary. Async Version.
|
|
339
|
-
|
|
340
|
-
Parameters
|
|
341
|
-
----------
|
|
342
|
-
glossary_guid: str,
|
|
343
|
-
Unique identifier for the glossary.
|
|
344
|
-
display_name: str,
|
|
345
|
-
Display name for the glossary category. Will be used as the base for a constructed unique qualified name.
|
|
346
|
-
description: str,
|
|
347
|
-
Description for the category.
|
|
348
|
-
is_root_category: bool, [default=False], optional
|
|
349
|
-
Is this category a root category?
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
Returns
|
|
353
|
-
-------
|
|
354
|
-
A string with the GUID of the new category..
|
|
355
|
-
|
|
356
|
-
Raises
|
|
357
|
-
------
|
|
358
|
-
|
|
359
|
-
InvalidParameterException
|
|
360
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
361
|
-
PropertyServerException
|
|
362
|
-
Raised by the server when an issue arises in processing a valid request
|
|
363
|
-
NotAuthorizedException
|
|
364
|
-
The principle specified by the user_id does not have authorization for the requested action
|
|
365
|
-
ConfigurationErrorException
|
|
366
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
|
367
|
-
invalid or make the new call invalid.
|
|
368
|
-
"""
|
|
369
|
-
|
|
370
|
-
url = (
|
|
371
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
372
|
-
f"{glossary_guid}/categories?isRootCategory={is_root_category}"
|
|
373
|
-
)
|
|
374
|
-
body = {
|
|
375
|
-
"class": "ReferenceableRequestBody",
|
|
376
|
-
"elementProperties": {
|
|
377
|
-
"class": "GlossaryCategoryProperties",
|
|
378
|
-
"qualifiedName": self.__create_qualified_name__("Category", display_name),
|
|
379
|
-
"displayName": display_name,
|
|
380
|
-
"description": description,
|
|
381
|
-
},
|
|
382
|
-
}
|
|
383
|
-
response = await self._async_make_request("POST", url, body)
|
|
384
|
-
return response.json().get("guid", None)
|
|
385
|
-
|
|
386
|
-
def create_category(
|
|
387
|
-
self,
|
|
388
|
-
glossary_guid: str,
|
|
389
|
-
display_name: str,
|
|
390
|
-
description: str,
|
|
391
|
-
is_root_category: bool = False,
|
|
392
|
-
) -> str:
|
|
393
|
-
"""Create a new category within the specified glossary.
|
|
394
|
-
|
|
395
|
-
Parameters
|
|
396
|
-
----------
|
|
397
|
-
glossary_guid: str,
|
|
398
|
-
Unique identifier for the glossary.
|
|
399
|
-
display_name: str,
|
|
400
|
-
Display name for the glossary category. Will be used as the base for a constructed unique qualified name.
|
|
401
|
-
description: str,
|
|
402
|
-
Description for the category.
|
|
403
|
-
is_root_category: bool, [default=False], optional
|
|
404
|
-
Is this category a root category?
|
|
405
|
-
|
|
406
|
-
Returns
|
|
407
|
-
-------
|
|
408
|
-
A string with the GUID of the new category..
|
|
409
|
-
|
|
410
|
-
Raises
|
|
411
|
-
------
|
|
412
|
-
|
|
413
|
-
InvalidParameterException
|
|
414
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
415
|
-
PropertyServerException
|
|
416
|
-
Raised by the server when an issue arises in processing a valid request
|
|
417
|
-
NotAuthorizedException
|
|
418
|
-
The principle specified by the user_id does not have authorization for the requested action
|
|
419
|
-
ConfigurationErrorException
|
|
420
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
|
421
|
-
invalid or make the new call invalid.
|
|
422
|
-
"""
|
|
423
|
-
loop = asyncio.get_event_loop()
|
|
424
|
-
response = loop.run_until_complete(
|
|
425
|
-
self._async_create_category(glossary_guid, display_name, description, is_root_category)
|
|
426
|
-
)
|
|
427
|
-
return response
|
|
428
|
-
|
|
429
|
-
async def _async_update_category(
|
|
430
|
-
self,
|
|
431
|
-
category_guid: str,
|
|
432
|
-
display_name: str,
|
|
433
|
-
description: str,
|
|
434
|
-
qualified_name: str = None,
|
|
435
|
-
effective_time: str = None,
|
|
436
|
-
update_description: str = None,
|
|
437
|
-
is_merge_update: bool = True,
|
|
438
|
-
) :
|
|
439
|
-
"""Create a new category within the specified glossary. Async Version.
|
|
440
|
-
|
|
441
|
-
Parameters
|
|
442
|
-
----------
|
|
443
|
-
category_guid: str,
|
|
444
|
-
Unique identifier for the glossary.
|
|
445
|
-
display_name: str,
|
|
446
|
-
Display name for the glossary category. Will be used as the base for a constructed unique qualified name.
|
|
447
|
-
description: str,
|
|
448
|
-
Description for the category.
|
|
449
|
-
qualified_name: str, [default=None], optional
|
|
450
|
-
Unique identifier for the glossary category. Must be specified if not a merge update.
|
|
451
|
-
effective_time: datetime, [default=None], optional
|
|
452
|
-
Time when the category becomes effective.
|
|
453
|
-
update_description: str, [default=None], optional
|
|
454
|
-
Description of the update to the category.
|
|
455
|
-
is_merge_update: bool, [default=True], optional
|
|
456
|
-
Should this be a merge or a replace?
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
Returns
|
|
460
|
-
-------
|
|
461
|
-
None
|
|
462
|
-
|
|
463
|
-
Raises
|
|
464
|
-
------
|
|
465
|
-
|
|
466
|
-
InvalidParameterException
|
|
467
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
468
|
-
PropertyServerException
|
|
469
|
-
Raised by the server when an issue arises in processing a valid request
|
|
470
|
-
NotAuthorizedException
|
|
471
|
-
The principle specified by the user_id does not have authorization for the requested action
|
|
472
|
-
ConfigurationErrorException
|
|
473
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
|
474
|
-
invalid or make the new call invalid.
|
|
475
|
-
"""
|
|
476
|
-
if (not is_merge_update and qualified_name is None):
|
|
477
|
-
raise ValueError('qualified_name must be specified for a replace update')
|
|
478
|
-
url = (
|
|
479
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
480
|
-
f"categories/{category_guid}/update?isMergeUpdate={is_merge_update}"
|
|
481
|
-
)
|
|
482
|
-
body = {
|
|
483
|
-
"class": "ReferenceableUpdateRequestBody",
|
|
484
|
-
"effectiveTime": effective_time,
|
|
485
|
-
"updateDescription": update_description,
|
|
486
|
-
"elementProperties": {
|
|
487
|
-
"class": "GlossaryCategoryProperties",
|
|
488
|
-
"qualifiedName": qualified_name ,
|
|
489
|
-
"displayName": display_name,
|
|
490
|
-
"description": description
|
|
491
|
-
},
|
|
492
|
-
}
|
|
493
|
-
response = await self._async_make_request("POST", url, body_slimmer(body))
|
|
494
|
-
return response.json().get("guid", None)
|
|
495
|
-
|
|
496
|
-
def update_category(
|
|
497
|
-
self,
|
|
498
|
-
glossary_guid: str,
|
|
499
|
-
display_name: str,
|
|
500
|
-
description: str,
|
|
501
|
-
qualified_name: str = None,
|
|
502
|
-
effective_time: str = None,
|
|
503
|
-
update_description: str = None,
|
|
504
|
-
is_merge_update: bool = True,
|
|
505
|
-
) -> str:
|
|
506
|
-
"""Create a new category within the specified glossary.
|
|
507
|
-
|
|
508
|
-
Parameters
|
|
509
|
-
----------
|
|
510
|
-
glossary_guid: str,
|
|
511
|
-
Unique identifier for the glossary.
|
|
512
|
-
display_name: str,
|
|
513
|
-
Display name for the glossary category. Will be used as the base for a constructed unique qualified name.
|
|
514
|
-
description: str,
|
|
515
|
-
Description for the category.
|
|
516
|
-
qualified_name: str, [default=None], optional
|
|
517
|
-
Unique identifier for the glossary category. Must be specified if not a merge update.
|
|
518
|
-
effective_time: datetime, [default=None], optional
|
|
519
|
-
Time when the category becomes effective.
|
|
520
|
-
update_description: str, [default=None], optional
|
|
521
|
-
Description of the update to the category.
|
|
522
|
-
is_merge_update: bool, [default=True], optional
|
|
523
|
-
Should this be a merge or a replace?
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
Returns
|
|
527
|
-
-------
|
|
528
|
-
None
|
|
529
|
-
|
|
530
|
-
Raises
|
|
531
|
-
------
|
|
532
|
-
|
|
533
|
-
InvalidParameterException
|
|
534
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
535
|
-
PropertyServerException
|
|
536
|
-
Raised by the server when an issue arises in processing a valid request
|
|
537
|
-
NotAuthorizedException
|
|
538
|
-
The principle specified by the user_id does not have authorization for the requested action
|
|
539
|
-
ConfigurationErrorException
|
|
540
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
|
541
|
-
invalid or make the new call invalid.
|
|
542
|
-
"""
|
|
543
|
-
loop = asyncio.get_event_loop()
|
|
544
|
-
response = loop.run_until_complete(
|
|
545
|
-
self._async_update_category(glossary_guid, display_name, description,
|
|
546
|
-
qualified_name, effective_time, update_description, is_merge_update)
|
|
547
|
-
)
|
|
548
|
-
return response
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
async def _async_delete_category(
|
|
552
|
-
self,
|
|
553
|
-
category_guid: str,
|
|
554
|
-
) -> None:
|
|
555
|
-
"""Delete a category. Async Version.
|
|
556
|
-
|
|
557
|
-
Parameters
|
|
558
|
-
----------
|
|
559
|
-
category_guid: str,
|
|
560
|
-
Unique identifier for the category.
|
|
561
|
-
|
|
562
|
-
Returns
|
|
563
|
-
-------
|
|
564
|
-
None
|
|
565
|
-
|
|
566
|
-
Raises
|
|
567
|
-
------
|
|
568
|
-
|
|
569
|
-
InvalidParameterException
|
|
570
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
571
|
-
PropertyServerException
|
|
572
|
-
Raised by the server when an issue arises in processing a valid request
|
|
573
|
-
NotAuthorizedException
|
|
574
|
-
The principle specified by the user_id does not have authorization for the requested action
|
|
575
|
-
ConfigurationErrorException
|
|
576
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
|
577
|
-
invalid or make the new call invalid.
|
|
578
|
-
"""
|
|
579
|
-
|
|
580
|
-
url = (
|
|
581
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
582
|
-
f"categories/{category_guid}/remove"
|
|
583
|
-
)
|
|
584
|
-
|
|
585
|
-
await self._async_make_request("POST", url)
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
def delete_category(
|
|
589
|
-
self,
|
|
590
|
-
category_guid: str,
|
|
591
|
-
) -> None:
|
|
592
|
-
"""Delete a category.
|
|
593
|
-
|
|
594
|
-
Parameters
|
|
595
|
-
----------
|
|
596
|
-
category_guid: str,
|
|
597
|
-
Unique identifier for the category.
|
|
598
|
-
|
|
599
|
-
Returns
|
|
600
|
-
-------
|
|
601
|
-
None
|
|
602
|
-
|
|
603
|
-
Raises
|
|
604
|
-
------
|
|
605
|
-
|
|
606
|
-
InvalidParameterException
|
|
607
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
608
|
-
PropertyServerException
|
|
609
|
-
Raised by the server when an issue arises in processing a valid request
|
|
610
|
-
NotAuthorizedException
|
|
611
|
-
The principle specified by the user_id does not have authorization for the requested action
|
|
612
|
-
ConfigurationErrorException
|
|
613
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
|
614
|
-
invalid or make the new call invalid.
|
|
615
|
-
"""
|
|
616
|
-
loop = asyncio.get_event_loop()
|
|
617
|
-
loop.run_until_complete(
|
|
618
|
-
self._async_delete_category(category_guid)
|
|
619
|
-
)
|
|
620
|
-
|
|
621
|
-
async def _async_set_parent_category(
|
|
622
|
-
self,
|
|
623
|
-
parent_category_guid: str, child_category_guid: str) -> None:
|
|
624
|
-
"""Set parent category Async Version.
|
|
625
|
-
|
|
626
|
-
Parameters
|
|
627
|
-
----------
|
|
628
|
-
parent_category_guid: str,
|
|
629
|
-
Unique identifier for the parent category.
|
|
630
|
-
child_category_guid: str,
|
|
631
|
-
Unique identifier for the child category.
|
|
632
|
-
|
|
633
|
-
Returns
|
|
634
|
-
-------
|
|
635
|
-
None
|
|
636
|
-
|
|
637
|
-
Raises
|
|
638
|
-
------
|
|
639
|
-
|
|
640
|
-
InvalidParameterException
|
|
641
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
642
|
-
PropertyServerException
|
|
643
|
-
Raised by the server when an issue arises in processing a valid request
|
|
644
|
-
NotAuthorizedException
|
|
645
|
-
The principle specified by the user_id does not have authorization for the requested action
|
|
646
|
-
ConfigurationErrorException
|
|
647
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
|
648
|
-
invalid or make the new call invalid.
|
|
649
|
-
"""
|
|
650
|
-
|
|
651
|
-
url = (
|
|
652
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
653
|
-
f"categories/{parent_category_guid}/subcategories/{child_category_guid}"
|
|
654
|
-
)
|
|
655
|
-
|
|
656
|
-
await self._async_make_request("POST", url)
|
|
657
|
-
|
|
658
|
-
def set_parent_category(self, parent_category_guid: str, child_category_guid: str) -> None:
|
|
659
|
-
"""Set parent category
|
|
660
|
-
|
|
661
|
-
Parameters
|
|
662
|
-
----------
|
|
663
|
-
parent_category_guid: str,
|
|
664
|
-
Unique identifier for the parent category.
|
|
665
|
-
child_category_guid: str,
|
|
666
|
-
Unique identifier for the child category.
|
|
667
|
-
|
|
668
|
-
Returns
|
|
669
|
-
-------
|
|
670
|
-
None
|
|
671
|
-
|
|
672
|
-
Raises
|
|
673
|
-
------
|
|
674
|
-
|
|
675
|
-
InvalidParameterException
|
|
676
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
677
|
-
PropertyServerException
|
|
678
|
-
Raised by the server when an issue arises in processing a valid request
|
|
679
|
-
NotAuthorizedException
|
|
680
|
-
The principle specified by the user_id does not have authorization for the requested action
|
|
681
|
-
ConfigurationErrorException
|
|
682
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
|
683
|
-
invalid or make the new call invalid.
|
|
684
|
-
"""
|
|
685
|
-
|
|
686
|
-
loop = asyncio.get_event_loop()
|
|
687
|
-
loop.run_until_complete(
|
|
688
|
-
self._async_set_parent_category(parent_category_guid,child_category_guid)
|
|
689
|
-
)
|
|
690
|
-
|
|
691
|
-
async def _async_remove_parent_category(
|
|
692
|
-
self,
|
|
693
|
-
parent_category_guid: str, child_category_guid: str) -> None:
|
|
694
|
-
"""Remove parent category relationship. Async Version.
|
|
695
|
-
|
|
696
|
-
Parameters
|
|
697
|
-
----------
|
|
698
|
-
parent_category_guid: str,
|
|
699
|
-
Unique identifier for the parent category.
|
|
700
|
-
child_category_guid: str,
|
|
701
|
-
Unique identifier for the child category.
|
|
702
|
-
|
|
703
|
-
Returns
|
|
704
|
-
-------
|
|
705
|
-
None
|
|
706
|
-
|
|
707
|
-
Raises
|
|
708
|
-
------
|
|
709
|
-
|
|
710
|
-
InvalidParameterException
|
|
711
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
712
|
-
PropertyServerException
|
|
713
|
-
Raised by the server when an issue arises in processing a valid request
|
|
714
|
-
NotAuthorizedException
|
|
715
|
-
The principle specified by the user_id does not have authorization for the requested action
|
|
716
|
-
ConfigurationErrorException
|
|
717
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
|
718
|
-
invalid or make the new call invalid.
|
|
719
|
-
"""
|
|
720
|
-
|
|
721
|
-
url = (
|
|
722
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
723
|
-
f"categories/{parent_category_guid}/subcategories/{child_category_guid}/remove"
|
|
724
|
-
)
|
|
725
|
-
|
|
726
|
-
await self._async_make_request("POST", url)
|
|
727
|
-
|
|
728
|
-
def remove_parent_category(self, parent_category_guid: str, child_category_guid: str) -> None:
|
|
729
|
-
"""Remove parent category relationship.
|
|
730
|
-
|
|
731
|
-
Parameters
|
|
732
|
-
----------
|
|
733
|
-
parent_category_guid: str,
|
|
734
|
-
Unique identifier for the parent category.
|
|
735
|
-
child_category_guid: str,
|
|
736
|
-
Unique identifier for the child category.
|
|
737
|
-
|
|
738
|
-
Returns
|
|
739
|
-
-------
|
|
740
|
-
None
|
|
741
|
-
|
|
742
|
-
Raises
|
|
743
|
-
------
|
|
744
|
-
|
|
745
|
-
InvalidParameterException
|
|
746
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
747
|
-
PropertyServerException
|
|
748
|
-
Raised by the server when an issue arises in processing a valid request
|
|
749
|
-
NotAuthorizedException
|
|
750
|
-
The principle specified by the user_id does not have authorization for the requested action
|
|
751
|
-
ConfigurationErrorException
|
|
752
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
|
753
|
-
invalid or make the new call invalid.
|
|
754
|
-
"""
|
|
755
|
-
|
|
756
|
-
loop = asyncio.get_event_loop()
|
|
757
|
-
loop.run_until_complete(
|
|
758
|
-
self._async_remove_parent_category(parent_category_guid, child_category_guid)
|
|
759
|
-
)
|
|
760
|
-
|
|
761
|
-
#
|
|
762
|
-
# Terms
|
|
763
|
-
#
|
|
764
|
-
async def _async_create_controlled_glossary_term(
|
|
765
|
-
self, glossary_guid: str, body: dict
|
|
766
|
-
) -> str:
|
|
767
|
-
"""Create a term for a controlled glossary.
|
|
768
|
-
See also: https://egeria-project.org/types/3/0385-Controlled-Glossary-Development/?h=controlled
|
|
769
|
-
The request body also supports the specification of an effective time for the query.
|
|
770
|
-
|
|
771
|
-
Async Version.
|
|
772
|
-
|
|
773
|
-
Parameters
|
|
774
|
-
----------
|
|
775
|
-
glossary_guid : str
|
|
776
|
-
Unique identifier for the glossary category to retrieve terms from.
|
|
777
|
-
body: dict
|
|
778
|
-
The dictionary to create te controlled glossary term for. Example below.
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
Returns
|
|
782
|
-
-------
|
|
783
|
-
str:
|
|
784
|
-
The unique guid for the created term.
|
|
785
|
-
|
|
786
|
-
Raises
|
|
787
|
-
------
|
|
788
|
-
InvalidParameterException
|
|
789
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
790
|
-
PropertyServerException
|
|
791
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
792
|
-
NotAuthorizedException
|
|
793
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
794
|
-
Notes
|
|
795
|
-
-----
|
|
796
|
-
|
|
797
|
-
Sample body like:
|
|
798
|
-
{
|
|
799
|
-
"class" : "ReferenceableRequestBody",
|
|
800
|
-
"elementProperties" :
|
|
801
|
-
{
|
|
802
|
-
"class" : "GlossaryTermProperties",
|
|
803
|
-
"qualifiedName" : "GlossaryTerm: term name : {$isoTimestamp}",
|
|
804
|
-
"displayName" : "term name",
|
|
805
|
-
"aliases": []
|
|
806
|
-
"summary" : "This is the short description.",
|
|
807
|
-
"description" : "This is the long description of the term.",
|
|
808
|
-
"abbreviation" : "GT",
|
|
809
|
-
"examples" : "Add examples and descriptions here.",
|
|
810
|
-
"usage" : "This is how the concept described by the glossary term is used.",
|
|
811
|
-
"publishVersionIdentifier" : "V1.0",
|
|
812
|
-
"additionalProperties" :
|
|
813
|
-
{
|
|
814
|
-
"propertyName1" : "xxxx",
|
|
815
|
-
"propertyName2" : "xxxx"
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
|
-
"initialStatus" : "DRAFT"
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
"""
|
|
822
|
-
|
|
823
|
-
validate_guid(glossary_guid)
|
|
824
|
-
if self.__validate_term_status__(body["initialStatus"]) is False:
|
|
825
|
-
raise InvalidParameterException("Bad status value")
|
|
826
|
-
|
|
827
|
-
url = (
|
|
828
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
829
|
-
f"{glossary_guid}/terms/new-controlled"
|
|
830
|
-
)
|
|
831
|
-
|
|
832
|
-
response = await self._async_make_request("POST", url, body)
|
|
833
|
-
|
|
834
|
-
return response.json().get("guid", "Term not created")
|
|
835
|
-
|
|
836
|
-
def create_controlled_glossary_term(self, glossary_guid: str, body: dict) -> str:
|
|
837
|
-
"""Create a term for a controlled glossary.
|
|
838
|
-
See also: https://egeria-project.org/types/3/0385-Controlled-Glossary-Development/?h=controlled
|
|
839
|
-
The request body also supports the specification of an effective time for the query.
|
|
840
|
-
|
|
841
|
-
Parameters
|
|
842
|
-
----------
|
|
843
|
-
glossary_guid : str
|
|
844
|
-
Unique identifier for the glossary category to retrieve terms from.
|
|
845
|
-
body: dict
|
|
846
|
-
The dictionary to create te controlled glossary term for. Example below.
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
Returns
|
|
850
|
-
-------
|
|
851
|
-
str:
|
|
852
|
-
The unique guid for the created term.
|
|
853
|
-
|
|
854
|
-
Raises
|
|
855
|
-
------
|
|
856
|
-
InvalidParameterException
|
|
857
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
858
|
-
PropertyServerException
|
|
859
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
860
|
-
NotAuthorizedException
|
|
861
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
862
|
-
Notes
|
|
863
|
-
-----
|
|
864
|
-
|
|
865
|
-
Sample body like:
|
|
866
|
-
{
|
|
867
|
-
"class" : "ReferenceableRequestBody",
|
|
868
|
-
"elementProperties" :
|
|
869
|
-
{
|
|
870
|
-
"class" : "GlossaryTermProperties",
|
|
871
|
-
"qualifiedName" : "GlossaryTerm: term name : {$isoTimestamp}",
|
|
872
|
-
"displayName" : "term name",
|
|
873
|
-
"aliases": []
|
|
874
|
-
"summary" : "This is the short description.",
|
|
875
|
-
"description" : "This is the long description of the term.",
|
|
876
|
-
"abbreviation" : "GT",
|
|
877
|
-
"examples" : "Add examples and descriptions here.",
|
|
878
|
-
"usage" : "This is how the concept described by the glossary term is used.",
|
|
879
|
-
"publishVersionIdentifier" : "V1.0",
|
|
880
|
-
"additionalProperties" :
|
|
881
|
-
{
|
|
882
|
-
"propertyName1" : "xxxx",
|
|
883
|
-
"propertyName2" : "xxxx"
|
|
884
|
-
}
|
|
885
|
-
},
|
|
886
|
-
"initialStatus" : "DRAFT"
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
"""
|
|
890
|
-
loop = asyncio.get_event_loop()
|
|
891
|
-
response = loop.run_until_complete(
|
|
892
|
-
self._async_create_controlled_glossary_term(glossary_guid, body)
|
|
893
|
-
)
|
|
894
|
-
|
|
895
|
-
return response
|
|
896
|
-
|
|
897
|
-
def load_terms_from_csv_file(
|
|
898
|
-
self,
|
|
899
|
-
glossary_name: str,
|
|
900
|
-
filename: str,
|
|
901
|
-
file_path: str = os.environ.get("EGERIA_GLOSSARY_PATH", None),
|
|
902
|
-
upsert: bool = True,
|
|
903
|
-
verbose: bool = True,
|
|
904
|
-
) -> List[dict] | None:
|
|
905
|
-
"""This method loads glossary terms into the specified glossary from the indicated file.
|
|
906
|
-
|
|
907
|
-
Parameters
|
|
908
|
-
----------
|
|
909
|
-
glossary_name : str
|
|
910
|
-
Name of the glossary to import terms into.
|
|
911
|
-
file_path: str, default is EGERIA_GLOSSARY_PATH if specified or None
|
|
912
|
-
If EGERIA_GLOSSARY_PATH environment variable is set, then it will be used in forming the
|
|
913
|
-
prepended to the filename parameter to form the full path to the file.
|
|
914
|
-
filename: str
|
|
915
|
-
Path to the file to import terms from. File is assumed to be in CSV format. The path
|
|
916
|
-
is relative to where the python method is being called from.
|
|
917
|
-
upsert: bool, default = True
|
|
918
|
-
If true, terms from the file are inserted into the glossary if no qualified name is specified;
|
|
919
|
-
if a qualified name is specified in the file, then the file values for this term will over-ride the
|
|
920
|
-
values in the glossary. If false, the row in the file will be appended to the glossary, possibly
|
|
921
|
-
resulting in duplicate term names - which is legal (since the qualified names will be unique).
|
|
922
|
-
|
|
923
|
-
verbose: bool, default = True
|
|
924
|
-
If true, a JSON structure will be returned indicating the import status of each row.
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
Returns
|
|
928
|
-
-------
|
|
929
|
-
[dict]:
|
|
930
|
-
If verbose is True, import status for each row
|
|
931
|
-
None:
|
|
932
|
-
If verbose is False
|
|
933
|
-
|
|
934
|
-
Raises
|
|
935
|
-
------
|
|
936
|
-
InvalidParameterException
|
|
937
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
938
|
-
PropertyServerException
|
|
939
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
940
|
-
NotAuthorizedException
|
|
941
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
942
|
-
Notes
|
|
943
|
-
-----
|
|
944
|
-
Keep in mind that the file path is relative to where the python method is being called from -
|
|
945
|
-
not relative to the Egeria platform.
|
|
946
|
-
|
|
947
|
-
"""
|
|
948
|
-
|
|
949
|
-
# Check that glossary exists and get guid
|
|
950
|
-
glossaries = self.get_glossaries_by_name(glossary_name)
|
|
951
|
-
if type(glossaries) is not list:
|
|
952
|
-
return "Unknown glossary"
|
|
953
|
-
if len(glossaries) > 1:
|
|
954
|
-
glossary_error = (
|
|
955
|
-
"Multiple glossaries found - please use a qualified name from below\n"
|
|
956
|
-
)
|
|
957
|
-
for g in glossaries:
|
|
958
|
-
glossary_error += (
|
|
959
|
-
f"Display Name: {g['glossaryProperties']['displayName']}\tQualified Name:"
|
|
960
|
-
f" {g['glossaryProperties']['qualifiedName']}\n"
|
|
961
|
-
)
|
|
962
|
-
raise Exception(glossary_error)
|
|
963
|
-
sys.exit(1)
|
|
964
|
-
|
|
965
|
-
# Now we know we have a single glossary so we can get the guid
|
|
966
|
-
glossary_guid = glossaries[0]["elementHeader"]["guid"]
|
|
967
|
-
|
|
968
|
-
term_properties = {
|
|
969
|
-
"Term Name",
|
|
970
|
-
"Qualified Name",
|
|
971
|
-
"Abbreviation",
|
|
972
|
-
"Summary",
|
|
973
|
-
"Description",
|
|
974
|
-
"Examples",
|
|
975
|
-
"Usage",
|
|
976
|
-
"Version Identifier",
|
|
977
|
-
"Status",
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
if file_path:
|
|
981
|
-
full_file_path = os.path.join(file_path, filename)
|
|
982
|
-
else:
|
|
983
|
-
full_file_path = filename
|
|
984
|
-
|
|
985
|
-
if not os.path.isfile(full_file_path):
|
|
986
|
-
raise FileNotFoundError(
|
|
987
|
-
f"Did not find file with path {file_path} and name {filename}"
|
|
988
|
-
)
|
|
989
|
-
# process file
|
|
990
|
-
with open(full_file_path, mode="r") as file:
|
|
991
|
-
# Create a CSV reader object
|
|
992
|
-
csv_reader = csv.DictReader(file)
|
|
993
|
-
headers = csv_reader.fieldnames
|
|
994
|
-
term_info = []
|
|
995
|
-
# check that the column headers are known
|
|
996
|
-
if all(header in term_properties for header in headers) is False:
|
|
997
|
-
raise InvalidParameterException("Invalid headers in CSV File")
|
|
998
|
-
|
|
999
|
-
# process each row and validate values
|
|
1000
|
-
for row in csv_reader:
|
|
1001
|
-
# Parse the file. When the value '---' is encountered, make the value None.git+https:
|
|
1002
|
-
term_name = row.get("Term Name", " ")
|
|
1003
|
-
if len(term_name) < 2:
|
|
1004
|
-
term_info.append(
|
|
1005
|
-
{
|
|
1006
|
-
"term_name": "---",
|
|
1007
|
-
"qualified_name": "---",
|
|
1008
|
-
"term_guid": "---",
|
|
1009
|
-
"error": "missing or invalid term names - skipping",
|
|
1010
|
-
}
|
|
1011
|
-
)
|
|
1012
|
-
continue
|
|
1013
|
-
qualified_name = row.get("Qualified Name", None)
|
|
1014
|
-
abbrev_in = row.get("Abbreviation", None)
|
|
1015
|
-
abbrev = None if abbrev_in == "---" else abbrev_in
|
|
1016
|
-
|
|
1017
|
-
summary_in = row.get("Summary", None)
|
|
1018
|
-
summary = None if summary_in == "---" else summary_in
|
|
1019
|
-
|
|
1020
|
-
description_in = row.get("Description", None)
|
|
1021
|
-
description = None if description_in == "---" else description_in
|
|
1022
|
-
|
|
1023
|
-
examples_in = row.get("Examples", None)
|
|
1024
|
-
examples = None if examples_in == "---" else examples_in
|
|
1025
|
-
|
|
1026
|
-
usage_in = row.get("Usage", None)
|
|
1027
|
-
usage = None if usage_in == "---" else usage_in
|
|
1028
|
-
|
|
1029
|
-
version = row.get("Version Identifier", "1.0")
|
|
1030
|
-
status = row.get("Status", "DRAFT").upper()
|
|
1031
|
-
if self.__validate_term_status__(status) is False:
|
|
1032
|
-
term_info.append(
|
|
1033
|
-
{
|
|
1034
|
-
"term_name": "---",
|
|
1035
|
-
"qualified_name": "---",
|
|
1036
|
-
"term_guid": "---",
|
|
1037
|
-
"error": "invalid term status",
|
|
1038
|
-
}
|
|
1039
|
-
)
|
|
1040
|
-
continue
|
|
1041
|
-
|
|
1042
|
-
if upsert:
|
|
1043
|
-
# If upsert is set we need to see if it can be done (there must be a valid qualified name) and then
|
|
1044
|
-
# do the update for the row - if there is no qualified name we will treat the row as an insert.
|
|
1045
|
-
if qualified_name:
|
|
1046
|
-
term_stuff = self.get_terms_by_name(
|
|
1047
|
-
qualified_name, glossary_guid
|
|
1048
|
-
)
|
|
1049
|
-
if type(term_stuff) is str:
|
|
1050
|
-
# An existing term was not found with that qualified name
|
|
1051
|
-
term_info.append(
|
|
1052
|
-
{
|
|
1053
|
-
"term_name": term_name,
|
|
1054
|
-
"qualified_name": qualified_name,
|
|
1055
|
-
"error": "Matching term not found - skipping",
|
|
1056
|
-
}
|
|
1057
|
-
)
|
|
1058
|
-
continue
|
|
1059
|
-
elif len(term_stuff) > 1:
|
|
1060
|
-
term_info.append(
|
|
1061
|
-
{
|
|
1062
|
-
"term_name": term_name,
|
|
1063
|
-
"qualified_name": qualified_name,
|
|
1064
|
-
"error": "Multiple matching terms - skipping",
|
|
1065
|
-
}
|
|
1066
|
-
)
|
|
1067
|
-
continue
|
|
1068
|
-
else:
|
|
1069
|
-
# An existing term was found - so update it! Get the existing values and overlay
|
|
1070
|
-
# values from file when present
|
|
1071
|
-
|
|
1072
|
-
body = {
|
|
1073
|
-
"class": "ReferenceableRequestBody",
|
|
1074
|
-
"elementProperties": {
|
|
1075
|
-
"class": "GlossaryTermProperties",
|
|
1076
|
-
"qualifiedName": qualified_name,
|
|
1077
|
-
"displayName": term_name,
|
|
1078
|
-
"summary": summary,
|
|
1079
|
-
"description": description,
|
|
1080
|
-
"abbreviation": abbrev,
|
|
1081
|
-
"examples": examples,
|
|
1082
|
-
"usage": usage,
|
|
1083
|
-
"publishVersionIdentifier": version,
|
|
1084
|
-
},
|
|
1085
|
-
"updateDescription": "Update from file import via upsert",
|
|
1086
|
-
}
|
|
1087
|
-
term_guid = term_stuff[0]["elementHeader"]["guid"]
|
|
1088
|
-
self.update_term(
|
|
1089
|
-
term_guid, body_slimmer(body), is_merge_update=True
|
|
1090
|
-
)
|
|
1091
|
-
term_info.append(
|
|
1092
|
-
{
|
|
1093
|
-
"term_name": term_name,
|
|
1094
|
-
"qualified_name": qualified_name,
|
|
1095
|
-
"term_guid": term_guid,
|
|
1096
|
-
"updated": "the term was updated",
|
|
1097
|
-
}
|
|
1098
|
-
)
|
|
1099
|
-
continue
|
|
1100
|
-
|
|
1101
|
-
# Add the term
|
|
1102
|
-
term_qualified_name = self.__create_qualified_name__("Term", term_name)
|
|
1103
|
-
|
|
1104
|
-
body = {
|
|
1105
|
-
"class": "ReferenceableRequestBody",
|
|
1106
|
-
"elementProperties": {
|
|
1107
|
-
"class": "GlossaryTermProperties",
|
|
1108
|
-
"qualifiedName": term_qualified_name,
|
|
1109
|
-
"displayName": term_name,
|
|
1110
|
-
"summary": summary,
|
|
1111
|
-
"description": description,
|
|
1112
|
-
"abbreviation": abbrev,
|
|
1113
|
-
"examples": examples,
|
|
1114
|
-
"usage": usage,
|
|
1115
|
-
"publishVersionIdentifier": version,
|
|
1116
|
-
},
|
|
1117
|
-
"initialStatus": status,
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
# Add the term
|
|
1121
|
-
term_guid = self.create_controlled_glossary_term(
|
|
1122
|
-
glossary_guid, body_slimmer(body)
|
|
1123
|
-
)
|
|
1124
|
-
term_info.append(
|
|
1125
|
-
{
|
|
1126
|
-
"term_name": term_name,
|
|
1127
|
-
"qualified_name": term_qualified_name,
|
|
1128
|
-
"term_guid": term_guid,
|
|
1129
|
-
}
|
|
1130
|
-
)
|
|
1131
|
-
if verbose:
|
|
1132
|
-
return term_info
|
|
1133
|
-
else:
|
|
1134
|
-
return
|
|
1135
|
-
|
|
1136
|
-
async def _async_export_glossary_to_csv(
|
|
1137
|
-
self,
|
|
1138
|
-
glossary_guid: str,
|
|
1139
|
-
target_file: str,
|
|
1140
|
-
file_path: str = os.environ.get("EGERIA_GLOSSARY_PATH", None),
|
|
1141
|
-
) -> int:
|
|
1142
|
-
"""Export all the terms in a glossary to a CSV file. Async version
|
|
1143
|
-
|
|
1144
|
-
Parameters:
|
|
1145
|
-
-----------
|
|
1146
|
-
glossary_guid: str
|
|
1147
|
-
Identity of the glossary to export.
|
|
1148
|
-
target_file: str
|
|
1149
|
-
Complete file name with path and extension to export to.
|
|
1150
|
-
file_path: str, default is EGERIA_GLOSSARY_PATH if specified or None
|
|
1151
|
-
If EGERIA_GLOSSARY_PATH environment variable is set, then it will be used in forming the
|
|
1152
|
-
prepended to the filename parameter to form the full path to the file.
|
|
1153
|
-
|
|
1154
|
-
Returns:
|
|
1155
|
-
int: Number of rows exported.
|
|
1156
|
-
"""
|
|
1157
|
-
|
|
1158
|
-
term_list = await self._async_get_terms_for_glossary(glossary_guid)
|
|
1159
|
-
|
|
1160
|
-
header = [
|
|
1161
|
-
"Term Name",
|
|
1162
|
-
"Qualified Name",
|
|
1163
|
-
"Abbreviation",
|
|
1164
|
-
"Summary",
|
|
1165
|
-
"Description",
|
|
1166
|
-
"Examples",
|
|
1167
|
-
"Usage",
|
|
1168
|
-
"Version Identifier",
|
|
1169
|
-
"Status",
|
|
1170
|
-
]
|
|
1171
|
-
if file_path:
|
|
1172
|
-
full_file_path = os.path.join(file_path, target_file)
|
|
1173
|
-
else:
|
|
1174
|
-
full_file_path = target_file
|
|
1175
|
-
|
|
1176
|
-
with open(full_file_path, mode="w") as file:
|
|
1177
|
-
csv_writer = csv.DictWriter(file, fieldnames=header)
|
|
1178
|
-
csv_writer.writeheader()
|
|
1179
|
-
count = 0
|
|
1180
|
-
for term in term_list:
|
|
1181
|
-
term_name = term["glossaryTermProperties"]["displayName"]
|
|
1182
|
-
qualified_name = term["glossaryTermProperties"]["qualifiedName"]
|
|
1183
|
-
abbrev = term["glossaryTermProperties"].get("abbreviation", "---")
|
|
1184
|
-
summary = term["glossaryTermProperties"].get("summary", "---")
|
|
1185
|
-
description = term["glossaryTermProperties"].get("description", "---")
|
|
1186
|
-
examples = term["glossaryTermProperties"].get("examples", "---")
|
|
1187
|
-
usage = term["glossaryTermProperties"].get("usage", "---")
|
|
1188
|
-
version = term["glossaryTermProperties"].get(
|
|
1189
|
-
"publishVersionIdentifier", "---"
|
|
1190
|
-
)
|
|
1191
|
-
status = term["elementHeader"]["status"]
|
|
1192
|
-
|
|
1193
|
-
csv_writer.writerow(
|
|
1194
|
-
{
|
|
1195
|
-
"Term Name": term_name,
|
|
1196
|
-
"Qualified Name": qualified_name,
|
|
1197
|
-
"Abbreviation": abbrev,
|
|
1198
|
-
"Summary": summary,
|
|
1199
|
-
"Description": description,
|
|
1200
|
-
"Examples": examples,
|
|
1201
|
-
"Usage": usage,
|
|
1202
|
-
"Version Identifier": version,
|
|
1203
|
-
"Status": status,
|
|
1204
|
-
}
|
|
1205
|
-
)
|
|
1206
|
-
|
|
1207
|
-
count += 1
|
|
1208
|
-
return count
|
|
1209
|
-
|
|
1210
|
-
def export_glossary_to_csv(
|
|
1211
|
-
self,
|
|
1212
|
-
glossary_guid: str,
|
|
1213
|
-
target_file: str,
|
|
1214
|
-
file_path: str = os.environ.get("EGERIA_GLOSSARY_PATH", None),
|
|
1215
|
-
) -> int:
|
|
1216
|
-
"""Export all the terms in a glossary to a CSV file.
|
|
1217
|
-
|
|
1218
|
-
Parameters:
|
|
1219
|
-
-----------
|
|
1220
|
-
glossary_guid: str
|
|
1221
|
-
Identity of the glossary to export.
|
|
1222
|
-
target_file: str
|
|
1223
|
-
Complete file name with path and extension to export to.
|
|
1224
|
-
file_path: str, default is EGERIA_GLOSSARY_PATH if specified or None
|
|
1225
|
-
If EGERIA_GLOSSARY_PATH environment variable is set, then it will be used in forming the
|
|
1226
|
-
prepended to the filename parameter to form the full path to the file.
|
|
1227
|
-
|
|
1228
|
-
Returns:
|
|
1229
|
-
int: Number of rows exported.
|
|
1230
|
-
"""
|
|
1231
|
-
|
|
1232
|
-
loop = asyncio.get_event_loop()
|
|
1233
|
-
response = loop.run_until_complete(
|
|
1234
|
-
self._async_export_glossary_to_csv(glossary_guid, target_file, file_path)
|
|
1235
|
-
)
|
|
1236
|
-
|
|
1237
|
-
return response
|
|
1238
|
-
|
|
1239
|
-
async def _async_create_term_copy(
|
|
1240
|
-
self,
|
|
1241
|
-
glossary_guid: str,
|
|
1242
|
-
glossary_term_guid: str,
|
|
1243
|
-
new_display_name: str,
|
|
1244
|
-
version_id: str,
|
|
1245
|
-
term_status: str = "PROPOSED",
|
|
1246
|
-
) -> str:
|
|
1247
|
-
"""Create a new term from an existing term.
|
|
1248
|
-
|
|
1249
|
-
Async Version.
|
|
1250
|
-
|
|
1251
|
-
Parameters
|
|
1252
|
-
----------
|
|
1253
|
-
glossary_guid : str
|
|
1254
|
-
Unique identifier for the glossary category to retrieve terms from.
|
|
1255
|
-
glossary_term_guid: str
|
|
1256
|
-
Unique identifier for the source glossary term.
|
|
1257
|
-
new_display_named: str
|
|
1258
|
-
The display name of the new term.
|
|
1259
|
-
version_id: str
|
|
1260
|
-
The version identifier of the new term.
|
|
1261
|
-
term_status: str, optional, default = "PROPOSED"
|
|
1262
|
-
The status of the term
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
Returns
|
|
1266
|
-
-------
|
|
1267
|
-
str:
|
|
1268
|
-
The unique guid for the created term.
|
|
1269
|
-
|
|
1270
|
-
Raises
|
|
1271
|
-
------
|
|
1272
|
-
InvalidParameterException
|
|
1273
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1274
|
-
PropertyServerException
|
|
1275
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1276
|
-
NotAuthorizedException
|
|
1277
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1278
|
-
Notes
|
|
1279
|
-
-----
|
|
1280
|
-
|
|
1281
|
-
"""
|
|
1282
|
-
|
|
1283
|
-
validate_guid(glossary_guid)
|
|
1284
|
-
validate_guid(glossary_term_guid)
|
|
1285
|
-
|
|
1286
|
-
url = (
|
|
1287
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
1288
|
-
f"{glossary_guid}/terms/from-template/{glossary_term_guid}"
|
|
1289
|
-
)
|
|
1290
|
-
|
|
1291
|
-
body = {
|
|
1292
|
-
"class": "GlossaryTemplateRequestBody",
|
|
1293
|
-
"elementProperties": {
|
|
1294
|
-
"class": "TemplateProperties",
|
|
1295
|
-
"qualifiedName": f"Term-{new_display_name}-{time.asctime()}",
|
|
1296
|
-
"displayName": new_display_name,
|
|
1297
|
-
"versionIdentifier": version_id,
|
|
1298
|
-
},
|
|
1299
|
-
"glossaryTermStatus": term_status,
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
response = await self._async_make_request("POST", url, body)
|
|
1303
|
-
|
|
1304
|
-
return response.json().get("guid", "Term not created")
|
|
1305
|
-
|
|
1306
|
-
def create_term_copy(
|
|
1307
|
-
self,
|
|
1308
|
-
glossary_guid: str,
|
|
1309
|
-
glossary_term_guid: str,
|
|
1310
|
-
new_display_name: str,
|
|
1311
|
-
version_id: str,
|
|
1312
|
-
term_status: str = "PROPOSED",
|
|
1313
|
-
) -> str:
|
|
1314
|
-
"""Create a new term from an existing term.
|
|
1315
|
-
|
|
1316
|
-
Parameters
|
|
1317
|
-
----------
|
|
1318
|
-
glossary_guid : str
|
|
1319
|
-
Unique identifier for the glossary category to retrieve terms from.
|
|
1320
|
-
glossary_term_guid: str
|
|
1321
|
-
Unique identifier for the source glossary term.
|
|
1322
|
-
new_display_named: str
|
|
1323
|
-
The display name of the new term.
|
|
1324
|
-
version_id: str
|
|
1325
|
-
The version identifier of the new term.
|
|
1326
|
-
term_status: str, optional, default = "PROPOSED"
|
|
1327
|
-
The status of the term
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
Returns
|
|
1331
|
-
-------
|
|
1332
|
-
str:
|
|
1333
|
-
The unique guid for the created term.
|
|
1334
|
-
|
|
1335
|
-
Raises
|
|
1336
|
-
------
|
|
1337
|
-
InvalidParameterException
|
|
1338
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1339
|
-
PropertyServerException
|
|
1340
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1341
|
-
NotAuthorizedException
|
|
1342
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1343
|
-
Notes
|
|
1344
|
-
-----
|
|
1345
|
-
|
|
1346
|
-
"""
|
|
1347
|
-
loop = asyncio.get_event_loop()
|
|
1348
|
-
response = loop.run_until_complete(
|
|
1349
|
-
self._async_create_term_copy(
|
|
1350
|
-
glossary_guid,
|
|
1351
|
-
glossary_term_guid,
|
|
1352
|
-
new_display_name,
|
|
1353
|
-
version_id,
|
|
1354
|
-
term_status,
|
|
1355
|
-
)
|
|
1356
|
-
)
|
|
1357
|
-
|
|
1358
|
-
return response
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
async def _async_add_term_to_category(
|
|
1362
|
-
self, glossary_term_guid: str, glossary_category_guid: str
|
|
1363
|
-
) -> None:
|
|
1364
|
-
"""Add the term to the specified category. Async Version.
|
|
1365
|
-
|
|
1366
|
-
Parameters
|
|
1367
|
-
----------
|
|
1368
|
-
glossary_term_guid : str
|
|
1369
|
-
Unique identifier for the glossary term to assign.
|
|
1370
|
-
glossary_category_guid: str
|
|
1371
|
-
Unique identifier for the category the term will be assigned to.
|
|
1372
|
-
|
|
1373
|
-
Returns
|
|
1374
|
-
-------
|
|
1375
|
-
None
|
|
1376
|
-
|
|
1377
|
-
Raises
|
|
1378
|
-
------
|
|
1379
|
-
InvalidParameterException
|
|
1380
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1381
|
-
PropertyServerException
|
|
1382
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1383
|
-
NotAuthorizedException
|
|
1384
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1385
|
-
|
|
1386
|
-
"""
|
|
1387
|
-
|
|
1388
|
-
validate_guid(glossary_term_guid)
|
|
1389
|
-
validate_guid(glossary_category_guid)
|
|
1390
|
-
|
|
1391
|
-
url = (
|
|
1392
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
1393
|
-
f"categories/{glossary_category_guid}/terms/{glossary_term_guid}"
|
|
1394
|
-
)
|
|
1395
|
-
body = {
|
|
1396
|
-
"class": "RelationshipRequestBody",
|
|
1397
|
-
"properties": {
|
|
1398
|
-
"class": "GlossaryTermCategorization"
|
|
1399
|
-
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
await self._async_make_request("POST", url, body)
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
def add_term_to_category(self, glossary_term_guid: str, glossary_category_guid: str) -> None:
|
|
1407
|
-
"""Add the term to the specified category.
|
|
1408
|
-
|
|
1409
|
-
Parameters
|
|
1410
|
-
----------
|
|
1411
|
-
glossary_term_guid : str
|
|
1412
|
-
Unique identifier for the glossary term to assign.
|
|
1413
|
-
glossary_category_guid: str
|
|
1414
|
-
Unique identifier for the category the term will be assigned to.
|
|
1415
|
-
|
|
1416
|
-
Returns
|
|
1417
|
-
-------
|
|
1418
|
-
|
|
1419
|
-
Raises
|
|
1420
|
-
------
|
|
1421
|
-
InvalidParameterException
|
|
1422
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1423
|
-
PropertyServerException
|
|
1424
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1425
|
-
NotAuthorizedException
|
|
1426
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1427
|
-
|
|
1428
|
-
"""
|
|
1429
|
-
loop = asyncio.get_event_loop()
|
|
1430
|
-
loop.run_until_complete(
|
|
1431
|
-
self._async_add_term_to_category(glossary_term_guid, glossary_category_guid)
|
|
1432
|
-
)
|
|
1433
|
-
|
|
1434
|
-
async def _async_remove_term_from_category(
|
|
1435
|
-
self, glossary_term_guid: str, glossary_category_guid: str
|
|
1436
|
-
) -> None:
|
|
1437
|
-
"""Remove the term from the specified category. Async Version.
|
|
1438
|
-
|
|
1439
|
-
Parameters
|
|
1440
|
-
----------
|
|
1441
|
-
glossary_term_guid : str
|
|
1442
|
-
Unique identifier for the glossary term to assign.
|
|
1443
|
-
glossary_category_guid: str
|
|
1444
|
-
Unique identifier for the category the term will be assigned to.
|
|
1445
|
-
|
|
1446
|
-
Returns
|
|
1447
|
-
-------
|
|
1448
|
-
None
|
|
1449
|
-
|
|
1450
|
-
Raises
|
|
1451
|
-
------
|
|
1452
|
-
InvalidParameterException
|
|
1453
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1454
|
-
PropertyServerException
|
|
1455
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1456
|
-
NotAuthorizedException
|
|
1457
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1458
|
-
|
|
1459
|
-
"""
|
|
1460
|
-
|
|
1461
|
-
validate_guid(glossary_term_guid)
|
|
1462
|
-
validate_guid(glossary_category_guid)
|
|
1463
|
-
|
|
1464
|
-
url = (
|
|
1465
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
1466
|
-
f"categories/{glossary_category_guid}/terms/{glossary_term_guid}/remove"
|
|
1467
|
-
)
|
|
1468
|
-
await self._async_make_request("POST", url)
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
def remove_term_from_category(self, glossary_term_guid: str, glossary_category_guid: str) -> None:
|
|
1472
|
-
"""Remove the term from the specified category.
|
|
1473
|
-
|
|
1474
|
-
Parameters
|
|
1475
|
-
----------
|
|
1476
|
-
glossary_term_guid : str
|
|
1477
|
-
Unique identifier for the glossary term to assign.
|
|
1478
|
-
glossary_category_guid: str
|
|
1479
|
-
Unique identifier for the category the term will be assigned to.
|
|
1480
|
-
|
|
1481
|
-
Returns
|
|
1482
|
-
-------
|
|
1483
|
-
|
|
1484
|
-
Raises
|
|
1485
|
-
------
|
|
1486
|
-
InvalidParameterException
|
|
1487
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1488
|
-
PropertyServerException
|
|
1489
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1490
|
-
NotAuthorizedException
|
|
1491
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1492
|
-
|
|
1493
|
-
"""
|
|
1494
|
-
loop = asyncio.get_event_loop()
|
|
1495
|
-
loop.run_until_complete(
|
|
1496
|
-
self._async_remove_term_from_category(glossary_term_guid, glossary_category_guid)
|
|
1497
|
-
)
|
|
1498
|
-
|
|
1499
|
-
async def _async_add_relationship_between_terms(
|
|
1500
|
-
self, term1_guid: str, term2_guid: str, relationship_type: str, body: dict = None,
|
|
1501
|
-
for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
|
|
1502
|
-
"""Add a relationship between terms. Async Version.
|
|
1503
|
-
|
|
1504
|
-
Parameters
|
|
1505
|
-
----------
|
|
1506
|
-
term1_guid : str
|
|
1507
|
-
Unique identifier of the first glossary term in relationship.
|
|
1508
|
-
term2_guid : str
|
|
1509
|
-
Unique identifier of the second glossary term in relationship.
|
|
1510
|
-
relationship_type: str
|
|
1511
|
-
Type of relationship to add.
|
|
1512
|
-
body: dict, optional, default = None
|
|
1513
|
-
Further optional details for the relationship.
|
|
1514
|
-
for_lineage: bool, default is set by server
|
|
1515
|
-
- determines if elements classified as Memento should be returned - normally false
|
|
1516
|
-
for_duplicate_processing: bool, default is set by server
|
|
1517
|
-
- Normally false. Set true when the caller is part of a deduplication function
|
|
1518
|
-
|
|
1519
|
-
Returns
|
|
1520
|
-
-------
|
|
1521
|
-
None
|
|
1522
|
-
|
|
1523
|
-
Raises
|
|
1524
|
-
------
|
|
1525
|
-
InvalidParameterException
|
|
1526
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1527
|
-
PropertyServerException
|
|
1528
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1529
|
-
NotAuthorizedException
|
|
1530
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1531
|
-
|
|
1532
|
-
Notes
|
|
1533
|
-
----
|
|
1534
|
-
Body is currently required but can be empty except for class. Basic structure is:
|
|
1535
|
-
|
|
1536
|
-
{
|
|
1537
|
-
"class" : "RelationshipRequestBody",
|
|
1538
|
-
"effectiveTime" : {{@isoTimestamp}},
|
|
1539
|
-
"properties" : {
|
|
1540
|
-
"class" : "GlossaryTermRelationship",
|
|
1541
|
-
"expression" : "",
|
|
1542
|
-
"confidence" : 0,
|
|
1543
|
-
"description" : "",
|
|
1544
|
-
"status" : "",
|
|
1545
|
-
"steward" : "",
|
|
1546
|
-
"source" : "",
|
|
1547
|
-
"effectiveFrom" : "{{@isoTimestamp}}",
|
|
1548
|
-
"effectiveTo" : "{{@isoTimestamp}}",
|
|
1549
|
-
"extendedProperties" : {
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
"""
|
|
1554
|
-
|
|
1555
|
-
validate_guid(term1_guid)
|
|
1556
|
-
validate_guid(term2_guid)
|
|
1557
|
-
|
|
1558
|
-
if body is None:
|
|
1559
|
-
body = {"class": "RelationshipRequestBody",
|
|
1560
|
-
"properties":
|
|
1561
|
-
{"class": "GlossaryTermRelationship",}
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
possible_query_params = query_string(
|
|
1565
|
-
[
|
|
1566
|
-
("forLineage", for_lineage),
|
|
1567
|
-
("forDuplicateProcessing", for_duplicate_processing),
|
|
1568
|
-
]
|
|
1569
|
-
)
|
|
1570
|
-
|
|
1571
|
-
url = (
|
|
1572
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
1573
|
-
f"terms/{term1_guid}/relationships/{relationship_type}/terms/{term2_guid}{possible_query_params}"
|
|
1574
|
-
)
|
|
1575
|
-
|
|
1576
|
-
await self._async_make_request("POST", url, body_slimmer(body))
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
def add_relationship_between_terms(
|
|
1580
|
-
self, term1_guid: str, term2_guid: str, relationship_type: str, body: dict = None,
|
|
1581
|
-
for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
|
|
1582
|
-
"""Add a relationship between terms.
|
|
1583
|
-
|
|
1584
|
-
Parameters
|
|
1585
|
-
----------
|
|
1586
|
-
term1_guid : str
|
|
1587
|
-
Unique identifier of the first glossary term in relationship.
|
|
1588
|
-
term2_guid : str
|
|
1589
|
-
Unique identifier of the second glossary term in relationship.
|
|
1590
|
-
relationship_type: str
|
|
1591
|
-
Type of relationship to add. A list of relationship types can be found using get_term_relationship_types().
|
|
1592
|
-
body: dict, optional, default = None
|
|
1593
|
-
Further optional details for the relationship.
|
|
1594
|
-
for_lineage: bool, default is set by server
|
|
1595
|
-
- determines if elements classified as Memento should be returned - normally false
|
|
1596
|
-
for_duplicate_processing: bool, default is set by server
|
|
1597
|
-
- Normally false. Set true when the caller is part of a deduplication function
|
|
1598
|
-
|
|
1599
|
-
Returns
|
|
1600
|
-
-------
|
|
1601
|
-
None
|
|
1602
|
-
|
|
1603
|
-
Raises
|
|
1604
|
-
------
|
|
1605
|
-
InvalidParameterException
|
|
1606
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1607
|
-
PropertyServerException
|
|
1608
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1609
|
-
NotAuthorizedException
|
|
1610
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1611
|
-
|
|
1612
|
-
Notes
|
|
1613
|
-
----
|
|
1614
|
-
Body is currently required but can be empty except for class. Basic structure is:
|
|
1615
|
-
|
|
1616
|
-
{
|
|
1617
|
-
"class" : "RelationshipRequestBody",
|
|
1618
|
-
"effectiveTime" : {{@isoTimestamp}},
|
|
1619
|
-
"properties" : {
|
|
1620
|
-
"class" : "GlossaryTermRelationship",
|
|
1621
|
-
"expression" : "",
|
|
1622
|
-
"confidence" : 0,
|
|
1623
|
-
"description" : "",
|
|
1624
|
-
"status" : "",
|
|
1625
|
-
"steward" : "",
|
|
1626
|
-
"source" : "",
|
|
1627
|
-
"effectiveFrom" : "{{@isoTimestamp}}",
|
|
1628
|
-
"effectiveTo" : "{{@isoTimestamp}}",
|
|
1629
|
-
"extendedProperties" : {
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
"""
|
|
1634
|
-
loop = asyncio.get_event_loop()
|
|
1635
|
-
loop.run_until_complete(
|
|
1636
|
-
self._async_add_relationship_between_terms(term1_guid, term2_guid, relationship_type,
|
|
1637
|
-
body, for_lineage, for_duplicate_processing)
|
|
1638
|
-
)
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
async def _async_update_relationship_between_terms(
|
|
1642
|
-
self, term1_guid: str, term2_guid: str, relationship_type: str, body: dict = None,
|
|
1643
|
-
for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
|
|
1644
|
-
|
|
1645
|
-
"""Update a relationship between terms. Async Version.
|
|
1646
|
-
|
|
1647
|
-
Parameters
|
|
1648
|
-
----------
|
|
1649
|
-
term1_guid : str
|
|
1650
|
-
Unique identifier of the first glossary term in relationship.
|
|
1651
|
-
term2_guid : str
|
|
1652
|
-
Unique identifier of the second glossary term in relationship.
|
|
1653
|
-
relationship_type: str
|
|
1654
|
-
Type of relationship to update.
|
|
1655
|
-
body: dict, optional, default = None
|
|
1656
|
-
Further optional details for the relationship.
|
|
1657
|
-
for_lineage: bool, default is set by server
|
|
1658
|
-
- determines if elements classified as Memento should be returned - normally false
|
|
1659
|
-
for_duplicate_processing: bool, default is set by server
|
|
1660
|
-
- Normally false. Set true when the caller is part of a deduplication function
|
|
1661
|
-
|
|
1662
|
-
Returns
|
|
1663
|
-
-------
|
|
1664
|
-
None
|
|
1665
|
-
|
|
1666
|
-
Raises
|
|
1667
|
-
------
|
|
1668
|
-
InvalidParameterException
|
|
1669
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1670
|
-
PropertyServerException
|
|
1671
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1672
|
-
NotAuthorizedException
|
|
1673
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1674
|
-
|
|
1675
|
-
Notes
|
|
1676
|
-
----
|
|
1677
|
-
Body is currently required but can be empty except for class. Basic structure is:
|
|
1678
|
-
|
|
1679
|
-
{
|
|
1680
|
-
"class" : "RelationshipRequestBody",
|
|
1681
|
-
"effectiveTime" : {{@isoTimestamp}},
|
|
1682
|
-
"properties" : {
|
|
1683
|
-
"class" : "GlossaryTermRelationship",
|
|
1684
|
-
"expression" : "",
|
|
1685
|
-
"confidence" : 0,
|
|
1686
|
-
"description" : "",
|
|
1687
|
-
"status" : "",
|
|
1688
|
-
"steward" : "",
|
|
1689
|
-
"source" : "",
|
|
1690
|
-
"effectiveFrom" : "{{@isoTimestamp}}",
|
|
1691
|
-
"effectiveTo" : "{{@isoTimestamp}}",
|
|
1692
|
-
"extendedProperties" : {
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
"""
|
|
1697
|
-
|
|
1698
|
-
validate_guid(term1_guid)
|
|
1699
|
-
validate_guid(term2_guid)
|
|
1700
|
-
|
|
1701
|
-
possible_query_params = query_string(
|
|
1702
|
-
[
|
|
1703
|
-
("forLineage", for_lineage),
|
|
1704
|
-
("forDuplicateProcessing", for_duplicate_processing),
|
|
1705
|
-
]
|
|
1706
|
-
)
|
|
1707
|
-
|
|
1708
|
-
if body is None:
|
|
1709
|
-
body = {"properties": {"class": "RelationshipRequestBody"}}
|
|
1710
|
-
|
|
1711
|
-
url = (
|
|
1712
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
1713
|
-
f"terms/{term1_guid}/relationships/{relationship_type}/terms/{term2_guid}/update{possible_query_params}"
|
|
1714
|
-
)
|
|
1715
|
-
|
|
1716
|
-
await self._async_make_request("POST", url, body_slimmer(body))
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
def update_relationship_between_terms(
|
|
1720
|
-
self, term1_guid: str, term2_guid: str, relationship_type: str, body: dict,
|
|
1721
|
-
for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
|
|
1722
|
-
"""Update a relationship between terms.
|
|
1723
|
-
|
|
1724
|
-
Parameters
|
|
1725
|
-
----------
|
|
1726
|
-
term1_guid : str
|
|
1727
|
-
Unique identifier of the first glossary term in relationship.
|
|
1728
|
-
term2_guid : str
|
|
1729
|
-
Unique identifier of the second glossary term in relationship.
|
|
1730
|
-
relationship_type: str
|
|
1731
|
-
Type of relationship to update. A list of relationship types can be found using get_term_relationship_types().
|
|
1732
|
-
body: dict
|
|
1733
|
-
Details of the relationship to update.
|
|
1734
|
-
for_lineage: bool, default is set by server
|
|
1735
|
-
- determines if elements classified as Memento should be returned - normally false
|
|
1736
|
-
for_duplicate_processing: bool, default is set by server
|
|
1737
|
-
- Normally false. Set true when the caller is part of a deduplication function
|
|
1738
|
-
|
|
1739
|
-
Returns
|
|
1740
|
-
-------
|
|
1741
|
-
None
|
|
1742
|
-
|
|
1743
|
-
Raises
|
|
1744
|
-
------
|
|
1745
|
-
InvalidParameterException
|
|
1746
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1747
|
-
PropertyServerException
|
|
1748
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1749
|
-
NotAuthorizedException
|
|
1750
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1751
|
-
|
|
1752
|
-
Notes
|
|
1753
|
-
----
|
|
1754
|
-
Body is currently required but can be empty except for class. Basic structure is:
|
|
1755
|
-
|
|
1756
|
-
{
|
|
1757
|
-
"class" : "RelationshipRequestBody",
|
|
1758
|
-
"effectiveTime" : {{@isoTimestamp}},
|
|
1759
|
-
"properties" : {
|
|
1760
|
-
"class" : "GlossaryTermRelationship",
|
|
1761
|
-
"expression" : "",
|
|
1762
|
-
"confidence" : 0,
|
|
1763
|
-
"description" : "",
|
|
1764
|
-
"status" : "",
|
|
1765
|
-
"steward" : "",
|
|
1766
|
-
"source" : "",
|
|
1767
|
-
"effectiveFrom" : "{{@isoTimestamp}}",
|
|
1768
|
-
"effectiveTo" : "{{@isoTimestamp}}",
|
|
1769
|
-
"extendedProperties" : {
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
"""
|
|
1774
|
-
loop = asyncio.get_event_loop()
|
|
1775
|
-
loop.run_until_complete(
|
|
1776
|
-
self._async_update_relationship_between_terms(term1_guid, term2_guid, relationship_type,
|
|
1777
|
-
body,for_lineage,for_duplicate_processing)
|
|
1778
|
-
)
|
|
1779
|
-
|
|
1780
|
-
async def _async_remove_relationship_between_terms(
|
|
1781
|
-
self, term1_guid: str, term2_guid: str, relationship_type: str, effective_time: str = None,
|
|
1782
|
-
for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
|
|
1783
|
-
"""Remove a relationship between terms. Async Version.
|
|
1784
|
-
|
|
1785
|
-
Parameters
|
|
1786
|
-
----------
|
|
1787
|
-
term1_guid : str
|
|
1788
|
-
Unique identifier of the first glossary term in relationship.
|
|
1789
|
-
term2_guid : str
|
|
1790
|
-
Unique identifier of the second glossary term in relationship.
|
|
1791
|
-
relationship_type: str
|
|
1792
|
-
Type of relationship to add.
|
|
1793
|
-
effective_time: str, optional, default = None
|
|
1794
|
-
Effective time to remove the relationship.
|
|
1795
|
-
for_lineage: bool, default is set by server
|
|
1796
|
-
- determines if elements classified as Memento should be returned - normally false
|
|
1797
|
-
for_duplicate_processing: bool, default is set by server
|
|
1798
|
-
- Normally false. Set true when the caller is part of a deduplication function
|
|
1799
|
-
|
|
1800
|
-
Returns
|
|
1801
|
-
-------
|
|
1802
|
-
None
|
|
1803
|
-
|
|
1804
|
-
Raises
|
|
1805
|
-
------
|
|
1806
|
-
InvalidParameterException
|
|
1807
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1808
|
-
PropertyServerException
|
|
1809
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1810
|
-
NotAuthorizedException
|
|
1811
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
"""
|
|
1815
|
-
|
|
1816
|
-
validate_guid(term1_guid)
|
|
1817
|
-
validate_guid(term2_guid)
|
|
1818
|
-
|
|
1819
|
-
possible_query_params = query_string(
|
|
1820
|
-
[
|
|
1821
|
-
("forLineage", for_lineage),
|
|
1822
|
-
("forDuplicateProcessing", for_duplicate_processing),
|
|
1823
|
-
]
|
|
1824
|
-
)
|
|
1825
|
-
|
|
1826
|
-
body = {"properties": {
|
|
1827
|
-
"class": "EffectiveTimeQueryRequestBody",
|
|
1828
|
-
"effectiveTime": effective_time
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
url = (
|
|
1833
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
1834
|
-
f"terms/{term1_guid}/relationships/{relationship_type}/terms/{term2_guid}/remove{possible_query_params}"
|
|
1835
|
-
)
|
|
1836
|
-
|
|
1837
|
-
await self._async_make_request("POST", url, body_slimmer(body))
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
def remove_relationship_between_terms(
|
|
1841
|
-
self, term1_guid: str, term2_guid: str, relationship_type: str, effective_time: str = None,
|
|
1842
|
-
for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
|
|
1843
|
-
"""Remove a relationship between terms.
|
|
1844
|
-
|
|
1845
|
-
Parameters
|
|
1846
|
-
----------
|
|
1847
|
-
term1_guid : str
|
|
1848
|
-
Unique identifier of the first glossary term in relationship.
|
|
1849
|
-
term2_guid : str
|
|
1850
|
-
Unique identifier of the second glossary term in relationship.
|
|
1851
|
-
relationship_type: str
|
|
1852
|
-
Type of relationship to remove. A list of relationship types can be found using get_term_relationship_types().
|
|
1853
|
-
effective_time: str, optional, default = None
|
|
1854
|
-
Effective time to remove the relationship.
|
|
1855
|
-
for_lineage: bool, default is set by server
|
|
1856
|
-
- determines if elements classified as Memento should be returned - normally false
|
|
1857
|
-
for_duplicate_processing: bool, default is set by server
|
|
1858
|
-
- Normally false. Set true when the caller is part of a deduplication function
|
|
1859
|
-
|
|
1860
|
-
Returns
|
|
1861
|
-
-------
|
|
1862
|
-
None
|
|
1863
|
-
|
|
1864
|
-
Raises
|
|
1865
|
-
------
|
|
1866
|
-
InvalidParameterException
|
|
1867
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1868
|
-
PropertyServerException
|
|
1869
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1870
|
-
NotAuthorizedException
|
|
1871
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1872
|
-
|
|
1873
|
-
"""
|
|
1874
|
-
loop = asyncio.get_event_loop()
|
|
1875
|
-
loop.run_until_complete(
|
|
1876
|
-
self._async_remove_relationship_between_terms(term1_guid, term2_guid, relationship_type,
|
|
1877
|
-
effective_time, for_lineage, for_duplicate_processing)
|
|
1878
|
-
)
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
async def _async_add_confidentiality_to_term(
|
|
1883
|
-
self,
|
|
1884
|
-
glossary_term_guid: str,
|
|
1885
|
-
confidentiality_level: int,
|
|
1886
|
-
) -> None:
|
|
1887
|
-
"""Add the confidentiality classification to a glossary term
|
|
1888
|
-
|
|
1889
|
-
Async Version.
|
|
1890
|
-
|
|
1891
|
-
Parameters
|
|
1892
|
-
----------
|
|
1893
|
-
glossary_term_guid: str
|
|
1894
|
-
Unique identifier for the source glossary term.
|
|
1895
|
-
confidentiality_level: int
|
|
1896
|
-
The level of confidentiality to classify the term with.
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
Returns
|
|
1900
|
-
-------
|
|
1901
|
-
None
|
|
1902
|
-
|
|
1903
|
-
Raises
|
|
1904
|
-
------
|
|
1905
|
-
InvalidParameterException
|
|
1906
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1907
|
-
PropertyServerException
|
|
1908
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1909
|
-
NotAuthorizedException
|
|
1910
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1911
|
-
Notes
|
|
1912
|
-
-----
|
|
1913
|
-
See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
|
|
1914
|
-
for a list of default confidentiality levels.
|
|
1915
|
-
|
|
1916
|
-
"""
|
|
1917
|
-
|
|
1918
|
-
validate_guid(glossary_term_guid)
|
|
1919
|
-
|
|
1920
|
-
url = (
|
|
1921
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/elements/"
|
|
1922
|
-
f"{glossary_term_guid}/confidentiality"
|
|
1923
|
-
)
|
|
1924
|
-
|
|
1925
|
-
body = {
|
|
1926
|
-
"class": "ClassificationRequestBody",
|
|
1927
|
-
"properties": {
|
|
1928
|
-
"class": "GovernanceClassificationProperties",
|
|
1929
|
-
"levelIdentifier": confidentiality_level,
|
|
1930
|
-
},
|
|
1931
|
-
}
|
|
1932
|
-
|
|
1933
|
-
await self._async_make_request("POST", url, body)
|
|
1934
|
-
return
|
|
1935
|
-
|
|
1936
|
-
def add_confidentiality_to_term(
|
|
1937
|
-
self,
|
|
1938
|
-
glossary_term_guid: str,
|
|
1939
|
-
confidentiality_level: int,
|
|
1940
|
-
) -> str:
|
|
1941
|
-
"""Add the confidentiality classification to a glossary term
|
|
1942
|
-
|
|
1943
|
-
Parameters
|
|
1944
|
-
----------
|
|
1945
|
-
glossary_term_guid: str
|
|
1946
|
-
Unique identifier for the source glossary term.
|
|
1947
|
-
confidentiality_level: int
|
|
1948
|
-
The level of confidentiality to classify the term with.
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
Returns
|
|
1952
|
-
-------
|
|
1953
|
-
None
|
|
1954
|
-
|
|
1955
|
-
Raises
|
|
1956
|
-
------
|
|
1957
|
-
InvalidParameterException
|
|
1958
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
1959
|
-
PropertyServerException
|
|
1960
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
1961
|
-
NotAuthorizedException
|
|
1962
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
1963
|
-
Notes
|
|
1964
|
-
-----
|
|
1965
|
-
See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
|
|
1966
|
-
for a list of default confidentiality levels.
|
|
1967
|
-
|
|
1968
|
-
"""
|
|
1969
|
-
loop = asyncio.get_event_loop()
|
|
1970
|
-
response = loop.run_until_complete(
|
|
1971
|
-
self._async_add_confidentiality_to_term(
|
|
1972
|
-
glossary_term_guid, confidentiality_level
|
|
1973
|
-
)
|
|
1974
|
-
)
|
|
1975
|
-
|
|
1976
|
-
return
|
|
1977
|
-
|
|
1978
|
-
async def _async_add_subject_area_to_term(
|
|
1979
|
-
self, glossary_term_guid: str, subject_area: str
|
|
1980
|
-
) -> None:
|
|
1981
|
-
"""Add the confidentiality classification to a glossary term
|
|
1982
|
-
|
|
1983
|
-
Async Version.
|
|
1984
|
-
|
|
1985
|
-
Parameters
|
|
1986
|
-
----------
|
|
1987
|
-
glossary_term_guid: str
|
|
1988
|
-
Unique identifier for the source glossary term.
|
|
1989
|
-
subject_area: str
|
|
1990
|
-
The subject area to classify the term with.
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
Returns
|
|
1994
|
-
-------
|
|
1995
|
-
None
|
|
1996
|
-
|
|
1997
|
-
Raises
|
|
1998
|
-
------
|
|
1999
|
-
InvalidParameterException
|
|
2000
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
2001
|
-
PropertyServerException
|
|
2002
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
2003
|
-
NotAuthorizedException
|
|
2004
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
2005
|
-
Notes
|
|
2006
|
-
-----
|
|
2007
|
-
See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
|
|
2008
|
-
for a list of default confidentiality levels.
|
|
2009
|
-
|
|
2010
|
-
"""
|
|
2011
|
-
|
|
2012
|
-
validate_guid(glossary_term_guid)
|
|
2013
|
-
|
|
2014
|
-
url = (
|
|
2015
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/elements/"
|
|
2016
|
-
f"{glossary_term_guid}/subject-area-member"
|
|
2017
|
-
)
|
|
2018
|
-
|
|
2019
|
-
body = {
|
|
2020
|
-
"class": "ClassificationRequestBody",
|
|
2021
|
-
"properties": {
|
|
2022
|
-
"class": "SubjectAreaMemberProperties",
|
|
2023
|
-
"subjectAreaName": subject_area,
|
|
2024
|
-
},
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
await self._async_make_request("POST", url, body)
|
|
2028
|
-
return
|
|
2029
|
-
|
|
2030
|
-
def add_subject_area_to_term(
|
|
2031
|
-
self, glossary_term_guid: str, subject_area: str
|
|
2032
|
-
) -> None:
|
|
2033
|
-
"""Add the confidentiality classification to a glossary term
|
|
2034
|
-
|
|
2035
|
-
Parameters
|
|
2036
|
-
----------
|
|
2037
|
-
glossary_term_guid: str
|
|
2038
|
-
Unique identifier for the source glossary term.
|
|
2039
|
-
subject_area: str
|
|
2040
|
-
The subject area to classify the term with.
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
Returns
|
|
2044
|
-
-------
|
|
2045
|
-
None
|
|
2046
|
-
|
|
2047
|
-
Raises
|
|
2048
|
-
------
|
|
2049
|
-
InvalidParameterException
|
|
2050
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
2051
|
-
PropertyServerException
|
|
2052
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
2053
|
-
NotAuthorizedException
|
|
2054
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
2055
|
-
Notes
|
|
2056
|
-
-----
|
|
2057
|
-
See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
|
|
2058
|
-
for a list of default confidentiality levels.
|
|
2059
|
-
|
|
2060
|
-
"""
|
|
2061
|
-
loop = asyncio.get_event_loop()
|
|
2062
|
-
response = loop.run_until_complete(
|
|
2063
|
-
self._async_add_subject_area_to_term(glossary_term_guid, subject_area)
|
|
2064
|
-
)
|
|
2065
|
-
|
|
2066
|
-
return
|
|
2067
|
-
|
|
2068
|
-
async def _async_update_term(
|
|
2069
|
-
self,
|
|
2070
|
-
glossary_term_guid: str,
|
|
2071
|
-
body: dict,
|
|
2072
|
-
is_merge_update: bool = False,
|
|
2073
|
-
for_lineage: bool = False,
|
|
2074
|
-
for_duplicate_processig: bool = False,
|
|
2075
|
-
) -> None:
|
|
2076
|
-
"""Add the data field values classification to a glossary term
|
|
2077
|
-
|
|
2078
|
-
Async Version.
|
|
2079
|
-
|
|
2080
|
-
Parameters
|
|
2081
|
-
----------
|
|
2082
|
-
glossary_term_guid: str
|
|
2083
|
-
Unique identifier for the source glossary term.
|
|
2084
|
-
body: dict
|
|
2085
|
-
Body containing information about the data field to add
|
|
2086
|
-
is_merge_update: bool, optional, default = True
|
|
2087
|
-
Whether the data field values should be merged with existing definition or replace it.
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
Returns
|
|
2091
|
-
-------
|
|
2092
|
-
None
|
|
2093
|
-
|
|
2094
|
-
Raises
|
|
2095
|
-
------
|
|
2096
|
-
InvalidParameterException
|
|
2097
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
2098
|
-
PropertyServerException
|
|
2099
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
2100
|
-
NotAuthorizedException
|
|
2101
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
2102
|
-
Notes
|
|
2103
|
-
-----
|
|
2104
|
-
An example body is:
|
|
2105
|
-
|
|
2106
|
-
{
|
|
2107
|
-
"class" : "ReferenceableRequestBody",
|
|
2108
|
-
"elementProperties" :
|
|
2109
|
-
{
|
|
2110
|
-
"class" : "GlossaryTermProperties",
|
|
2111
|
-
"description" : "This is the long description of the term. And this is some more text."
|
|
2112
|
-
},
|
|
2113
|
-
"updateDescription" : "Final updates based on in-house review comments."
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2116
|
-
"""
|
|
2117
|
-
|
|
2118
|
-
validate_guid(glossary_term_guid)
|
|
2119
|
-
is_merge_update_s = str(is_merge_update).lower()
|
|
2120
|
-
for_lineage_s = str(for_lineage).lower()
|
|
2121
|
-
for_duplicate_processing_s = str(for_duplicate_processig).lower()
|
|
2122
|
-
|
|
2123
|
-
url = (
|
|
2124
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/terms/{glossary_term_guid}/"
|
|
2125
|
-
f"update?isMergeUpdate={is_merge_update_s}&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}"
|
|
2126
|
-
)
|
|
2127
|
-
|
|
2128
|
-
await self._async_make_request("POST", url, body)
|
|
2129
|
-
return
|
|
2130
|
-
|
|
2131
|
-
def update_term(
|
|
2132
|
-
self,
|
|
2133
|
-
glossary_term_guid: str,
|
|
2134
|
-
body: dict,
|
|
2135
|
-
is_merge_update: bool = True,
|
|
2136
|
-
for_lineage: bool = False,
|
|
2137
|
-
for_duplicate_processig: bool = False,
|
|
2138
|
-
) -> None:
|
|
2139
|
-
"""Add the data field values classification to a glossary term
|
|
2140
|
-
|
|
2141
|
-
Async Version.
|
|
2142
|
-
|
|
2143
|
-
Parameters
|
|
2144
|
-
----------
|
|
2145
|
-
glossary_term_guid: str
|
|
2146
|
-
Unique identifier for the source glossary term.
|
|
2147
|
-
body: dict
|
|
2148
|
-
Body containing information about the data field to add
|
|
2149
|
-
is_merge_update: bool, optional, default = True
|
|
2150
|
-
Whether the data field values should be merged with existing definition or replace it.
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
Returns
|
|
2154
|
-
-------
|
|
2155
|
-
None
|
|
2156
|
-
|
|
2157
|
-
Raises
|
|
2158
|
-
------
|
|
2159
|
-
InvalidParameterException
|
|
2160
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
2161
|
-
PropertyServerException
|
|
2162
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
2163
|
-
NotAuthorizedException
|
|
2164
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
2165
|
-
Notes
|
|
2166
|
-
-----
|
|
2167
|
-
An example body is:
|
|
2168
|
-
|
|
2169
|
-
{
|
|
2170
|
-
"class" : "ReferenceableRequestBody",
|
|
2171
|
-
"elementProperties" :
|
|
2172
|
-
{
|
|
2173
|
-
"class" : "GlossaryTermProperties",
|
|
2174
|
-
"description" : "This is the long description of the term. And this is some more text."
|
|
2175
|
-
},
|
|
2176
|
-
"updateDescription" : "Final updates based on in-house review comments."
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
"""
|
|
2180
|
-
loop = asyncio.get_event_loop()
|
|
2181
|
-
loop.run_until_complete(
|
|
2182
|
-
self._async_update_term(
|
|
2183
|
-
glossary_term_guid,
|
|
2184
|
-
body,
|
|
2185
|
-
is_merge_update,
|
|
2186
|
-
for_lineage,
|
|
2187
|
-
for_duplicate_processig,
|
|
2188
|
-
)
|
|
2189
|
-
)
|
|
2190
|
-
|
|
2191
|
-
return
|
|
2192
|
-
|
|
2193
|
-
async def _async_update_term_version_id(
|
|
2194
|
-
self,
|
|
2195
|
-
glossary_term_guid: str,
|
|
2196
|
-
new_version_identifier: str,
|
|
2197
|
-
) -> None:
|
|
2198
|
-
"""Update a glossary term's version identifier
|
|
2199
|
-
|
|
2200
|
-
Async Version.
|
|
2201
|
-
|
|
2202
|
-
Parameters
|
|
2203
|
-
----------
|
|
2204
|
-
glossary_term_guid: str
|
|
2205
|
-
Unique identifier for the source glossary term.
|
|
2206
|
-
new_version_identifier: str
|
|
2207
|
-
The new version identifier to update the term with.
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
Returns
|
|
2211
|
-
-------
|
|
2212
|
-
None
|
|
2213
|
-
|
|
2214
|
-
Raises
|
|
2215
|
-
------
|
|
2216
|
-
InvalidParameterException
|
|
2217
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
2218
|
-
PropertyServerException
|
|
2219
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
2220
|
-
NotAuthorizedException
|
|
2221
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
2222
|
-
Notes
|
|
2223
|
-
-----
|
|
2224
|
-
This is a useful example of a term update, specifying a new version identifier.
|
|
2225
|
-
|
|
2226
|
-
"""
|
|
2227
|
-
|
|
2228
|
-
validate_guid(glossary_term_guid)
|
|
2229
|
-
|
|
2230
|
-
url = (
|
|
2231
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/terms/{glossary_term_guid}/"
|
|
2232
|
-
f"update?isMergeUpdate=true"
|
|
2233
|
-
)
|
|
2234
|
-
|
|
2235
|
-
body = {
|
|
2236
|
-
"class": "ReferenceableRequestBody",
|
|
2237
|
-
"elementProperties": {
|
|
2238
|
-
"class": "GlossaryTermProperties",
|
|
2239
|
-
"publishVersionIdentifier": new_version_identifier,
|
|
2240
|
-
},
|
|
2241
|
-
}
|
|
2242
|
-
await self._async_make_request("POST", url, body)
|
|
2243
|
-
return
|
|
2244
|
-
|
|
2245
|
-
def update_term_version_id(
|
|
2246
|
-
self,
|
|
2247
|
-
glossary_term_guid: str,
|
|
2248
|
-
new_version_identifier: str,
|
|
2249
|
-
) -> None:
|
|
2250
|
-
"""Update a glossary term's version identifier
|
|
2251
|
-
|
|
2252
|
-
Async Version.
|
|
2253
|
-
|
|
2254
|
-
Parameters
|
|
2255
|
-
----------
|
|
2256
|
-
glossary_term_guid: str
|
|
2257
|
-
Unique identifier for the source glossary term.
|
|
2258
|
-
new_version_identifier: str
|
|
2259
|
-
The new version identifier to update the term with.
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
Returns
|
|
2263
|
-
-------
|
|
2264
|
-
None
|
|
2265
|
-
|
|
2266
|
-
Raises
|
|
2267
|
-
------
|
|
2268
|
-
InvalidParameterException
|
|
2269
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
2270
|
-
PropertyServerException
|
|
2271
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
2272
|
-
NotAuthorizedException
|
|
2273
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
2274
|
-
Notes
|
|
2275
|
-
-----
|
|
2276
|
-
This is a useful example of a term update, specifying a new version identifier.
|
|
2277
|
-
|
|
2278
|
-
"""
|
|
2279
|
-
loop = asyncio.get_event_loop()
|
|
2280
|
-
loop.run_until_complete(
|
|
2281
|
-
self._async_update_term_version_id(
|
|
2282
|
-
glossary_term_guid, new_version_identifier
|
|
2283
|
-
)
|
|
2284
|
-
)
|
|
2285
|
-
|
|
2286
|
-
async def _async_undo_term_update(self, glossary_term_guid: str) -> None:
|
|
2287
|
-
"""Undo an update to a glossary term
|
|
2288
|
-
|
|
2289
|
-
Async Version.
|
|
2290
|
-
|
|
2291
|
-
Parameters
|
|
2292
|
-
----------
|
|
2293
|
-
glossary_term_guid: str
|
|
2294
|
-
Unique identifier for the source glossary term.
|
|
2295
|
-
|
|
2296
|
-
Returns
|
|
2297
|
-
-------
|
|
2298
|
-
None
|
|
2299
|
-
|
|
2300
|
-
Raises
|
|
2301
|
-
------
|
|
2302
|
-
InvalidParameterException
|
|
2303
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
2304
|
-
PropertyServerException
|
|
2305
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
2306
|
-
NotAuthorizedException
|
|
2307
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
2308
|
-
Notes
|
|
2309
|
-
-----
|
|
2310
|
-
This creates a new version with the state of the term before the last update.
|
|
2311
|
-
|
|
2312
|
-
"""
|
|
2313
|
-
|
|
2314
|
-
validate_guid(glossary_term_guid)
|
|
2315
|
-
|
|
2316
|
-
url = (
|
|
2317
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/terms/"
|
|
2318
|
-
f"{glossary_term_guid}/undo"
|
|
2319
|
-
)
|
|
2320
|
-
|
|
2321
|
-
await self._async_make_request("POST", url)
|
|
2322
|
-
|
|
2323
|
-
def undo_term_update(self, glossary_term_guid: str) -> None:
|
|
2324
|
-
"""Undo an update to a glossary term
|
|
2325
|
-
|
|
2326
|
-
Parameters
|
|
2327
|
-
----------
|
|
2328
|
-
glossary_term_guid: str
|
|
2329
|
-
Unique identifier for the source glossary term.
|
|
2330
|
-
|
|
2331
|
-
Returns
|
|
2332
|
-
-------
|
|
2333
|
-
None
|
|
2334
|
-
|
|
2335
|
-
Raises
|
|
2336
|
-
------
|
|
2337
|
-
InvalidParameterException
|
|
2338
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
2339
|
-
PropertyServerException
|
|
2340
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
2341
|
-
NotAuthorizedException
|
|
2342
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
2343
|
-
Notes
|
|
2344
|
-
-----
|
|
2345
|
-
This creates a new version with the state of the term before the last update.
|
|
2346
|
-
|
|
2347
|
-
"""
|
|
2348
|
-
loop = asyncio.get_event_loop()
|
|
2349
|
-
loop.run_until_complete(self._async_undo_term_update(glossary_term_guid))
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
async def _async_delete_term(
|
|
2354
|
-
self,
|
|
2355
|
-
term_guid: str,
|
|
2356
|
-
for_lineage: bool = False,
|
|
2357
|
-
for_duplicate_processing: bool = False,
|
|
2358
|
-
) -> list | str:
|
|
2359
|
-
"""Delete the glossary terms associated with the specified glossary. Async version.
|
|
2360
|
-
|
|
2361
|
-
Parameters
|
|
2362
|
-
----------
|
|
2363
|
-
term_guid : str,
|
|
2364
|
-
The unique identifier for the term to delete.
|
|
2365
|
-
for_lineage: bool, opt, default = False
|
|
2366
|
-
Set true for lineage processing - generally false.
|
|
2367
|
-
for_duplicate_processing: bool, opt, default = False
|
|
2368
|
-
Set true if duplicate processing handled externally - generally set False.
|
|
2369
|
-
|
|
2370
|
-
Returns
|
|
2371
|
-
-------
|
|
2372
|
-
None
|
|
2373
|
-
|
|
2374
|
-
Raises
|
|
2375
|
-
------
|
|
2376
|
-
InvalidParameterException
|
|
2377
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
2378
|
-
PropertyServerException
|
|
2379
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
2380
|
-
NotAuthorizedException
|
|
2381
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
2382
|
-
Notes
|
|
2383
|
-
-----
|
|
2384
|
-
"""
|
|
2385
|
-
|
|
2386
|
-
validate_guid(term_guid)
|
|
2387
|
-
|
|
2388
|
-
url = (
|
|
2389
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
|
|
2390
|
-
f"terms/{term_guid}/remove?forLineage={for_lineage}&forDuplicateProcessing={for_duplicate_processing}"
|
|
2391
|
-
)
|
|
2392
|
-
|
|
2393
|
-
await self._async_make_request("POST", url)
|
|
2394
|
-
return
|
|
2395
|
-
|
|
2396
|
-
def delete_term(
|
|
2397
|
-
self,
|
|
2398
|
-
term_guid: str,
|
|
2399
|
-
for_lineage: bool = False,
|
|
2400
|
-
for_duplicate_processing: bool = False,
|
|
2401
|
-
) -> list | str:
|
|
2402
|
-
"""Delete the glossary terms associated with the specified glossary.
|
|
2403
|
-
|
|
2404
|
-
Parameters
|
|
2405
|
-
----------
|
|
2406
|
-
term_guid : str,
|
|
2407
|
-
The unique identifier for the term to delete.
|
|
2408
|
-
for_lineage: bool, opt, default = False
|
|
2409
|
-
Set true for lineage processing - generally false.
|
|
2410
|
-
for_duplicate_processing: bool, opt, default = False
|
|
2411
|
-
Set true if duplicate processing handled externally - generally set False.
|
|
2412
|
-
|
|
2413
|
-
Returns
|
|
2414
|
-
-------
|
|
2415
|
-
None
|
|
2416
|
-
|
|
2417
|
-
Raises
|
|
2418
|
-
------
|
|
2419
|
-
InvalidParameterException
|
|
2420
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
|
2421
|
-
PropertyServerException
|
|
2422
|
-
Raised by the server when an issue arises in processing a valid request.
|
|
2423
|
-
NotAuthorizedException
|
|
2424
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
|
2425
|
-
Notes
|
|
2426
|
-
-----
|
|
2427
|
-
"""
|
|
2428
|
-
loop = asyncio.get_event_loop()
|
|
2429
|
-
loop.run_until_complete(
|
|
2430
|
-
self._async_delete_term(term_guid, for_lineage, for_duplicate_processing)
|
|
2431
|
-
)
|
|
2432
|
-
|
|
2433
|
-
return
|
|
2434
|
-
|
|
2435
|
-
async def _async_relate_terms(self, term1_guid: str, term2_guid: str, relationship: str) -> None:
|
|
2436
|
-
pass
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
if __name__ == "__main__":
|
|
2440
|
-
print("Main-Glossary Manager")
|