pyegeria 5.3.8.5__py3-none-any.whl → 5.3.8.8__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.
- pyegeria/__init__.py +4 -4
- pyegeria/commands/cat/Dr-Egeria_md-orig.py +6 -6
- pyegeria/commands/cat/dr_egeria_jupyter.py +3 -5
- pyegeria/commands/cat/dr_egeria_md.py +15 -23
- pyegeria/commands/cat/list_categories.py +1 -1
- pyegeria/commands/cat/list_terms.py +7 -7
- pyegeria/glossary_browser_omvs.py +19 -13
- pyegeria/md_processing_utils.py +151 -158
- pyegeria/md_processing_utils_orig.py +3 -3
- {pyegeria-5.3.8.5.dist-info → pyegeria-5.3.8.8.dist-info}/METADATA +1 -1
- {pyegeria-5.3.8.5.dist-info → pyegeria-5.3.8.8.dist-info}/RECORD +14 -14
- {pyegeria-5.3.8.5.dist-info → pyegeria-5.3.8.8.dist-info}/LICENSE +0 -0
- {pyegeria-5.3.8.5.dist-info → pyegeria-5.3.8.8.dist-info}/WHEEL +0 -0
- {pyegeria-5.3.8.5.dist-info → pyegeria-5.3.8.8.dist-info}/entry_points.txt +0 -0
pyegeria/__init__.py
CHANGED
@@ -91,12 +91,12 @@ from .utils import body_slimmer, print_response
|
|
91
91
|
from .valid_metadata_omvs import ValidMetadataManager
|
92
92
|
from .x_action_author_omvs import ActionAuthor
|
93
93
|
from .md_processing_utils import (extract_command, process_glossary_upsert_command, process_term_upsert_command,
|
94
|
-
|
94
|
+
process_category_upsert_command,
|
95
95
|
get_current_datetime_string, process_per_proj_upsert_command, command_list,
|
96
96
|
render_markdown, process_provenance_command, process_blueprint_upsert_command,
|
97
|
-
process_solution_component_upsert_command,
|
98
|
-
process_term_list_command, process_glossary_list_command,process_category_list_command,
|
99
|
-
process_term_history_command
|
97
|
+
process_solution_component_upsert_command,
|
98
|
+
process_term_list_command, process_glossary_list_command, process_category_list_command,
|
99
|
+
process_term_history_command)
|
100
100
|
|
101
101
|
#
|
102
102
|
# The following assignments were generated by the `create_tech_guid_lists.py` utility that uses the pyegeria functions
|
@@ -13,8 +13,8 @@ from pyegeria.md_processing_utils import (extract_command, process_glossary_upse
|
|
13
13
|
|
14
14
|
import click
|
15
15
|
from pyegeria import (extract_command, process_glossary_upsert_command, process_term_upsert_command,
|
16
|
-
|
17
|
-
get_current_datetime_string, process_per_proj_upsert_command, commands,EgeriaTech
|
16
|
+
process_category_upsert_command,
|
17
|
+
get_current_datetime_string, process_per_proj_upsert_command, commands, EgeriaTech
|
18
18
|
)
|
19
19
|
from datetime import datetime
|
20
20
|
|
@@ -116,13 +116,13 @@ def process_markdown_file(
|
|
116
116
|
prov_found = True
|
117
117
|
result = process_provenance_command(file_path, block)
|
118
118
|
elif potential_command in ["Create Glossary", "Update Glossary"]:
|
119
|
-
result = process_glossary_upsert_command(client,
|
119
|
+
result = process_glossary_upsert_command(client, block, directive)
|
120
120
|
elif potential_command in ["Create Category", "Update Category"]:
|
121
|
-
result =
|
121
|
+
result = process_category_upsert_command(client, block, directive)
|
122
122
|
elif potential_command in ["Create Term", "Update Term"]:
|
123
|
-
result = process_term_upsert_command(client,
|
123
|
+
result = process_term_upsert_command(client, block, directive)
|
124
124
|
elif potential_command in ["Create Personal Project", "Update Personal Project"]:
|
125
|
-
result = process_per_proj_upsert_command(client,
|
125
|
+
result = process_per_proj_upsert_command(client, block, directive)
|
126
126
|
else:
|
127
127
|
# If command is not recognized, copy the block as-is
|
128
128
|
result = None
|
@@ -79,14 +79,12 @@ def process_jupyter_notebook(
|
|
79
79
|
potential_command = extract_command(cell.source)
|
80
80
|
if potential_command in command_list:
|
81
81
|
if potential_command in ["Create Glossary", "Update Glossary"]:
|
82
|
-
result = process_glossary_upsert_command(client,
|
83
|
-
cell.source, directive)
|
82
|
+
result = process_glossary_upsert_command(client, cell.source, directive)
|
84
83
|
|
85
84
|
elif potential_command in ["Create Term", "Update Term"]:
|
86
|
-
result = process_term_upsert_command(client,
|
87
|
-
cell.source, directive)
|
85
|
+
result = process_term_upsert_command(client, cell.source, directive)
|
88
86
|
elif potential_command in ["Create Personal Project", "Update Personal Project"]:
|
89
|
-
result = process_per_proj_upsert_command(client,
|
87
|
+
result = process_per_proj_upsert_command(client, cell.source, directive)
|
90
88
|
else:
|
91
89
|
# If command is not recognized, copy the block as-is
|
92
90
|
result = None
|
@@ -9,8 +9,8 @@ from rich import print
|
|
9
9
|
from rich.console import Console
|
10
10
|
|
11
11
|
from pyegeria import (extract_command, process_glossary_upsert_command, process_term_upsert_command,
|
12
|
-
|
13
|
-
|
12
|
+
process_category_upsert_command, process_provenance_command,
|
13
|
+
get_current_datetime_string,
|
14
14
|
process_per_proj_upsert_command, command_list, EgeriaTech, process_blueprint_upsert_command,
|
15
15
|
process_solution_component_upsert_command, dr_egeria_state, process_term_list_command,
|
16
16
|
process_category_list_command, process_glossary_list_command, process_term_history_command)
|
@@ -86,39 +86,31 @@ def process_markdown_file(file_path: str, directive: str, server: str, url: str,
|
|
86
86
|
prov_found = True
|
87
87
|
|
88
88
|
elif potential_command in ["Create Glossary", "Update Glossary"]:
|
89
|
-
result = process_glossary_upsert_command(client,
|
90
|
-
current_block, directive)
|
89
|
+
result = process_glossary_upsert_command(client, current_block, directive)
|
91
90
|
elif potential_command in ["Create Category", "Update Category"]:
|
92
|
-
result =
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
current_block, directive)
|
91
|
+
result = process_category_upsert_command(client, current_block, directive)
|
92
|
+
# elif potential_command in ["Set Parent Category", "UnSet Parent Category"]:
|
93
|
+
# result = process_set_categories_parent_command(client, dr_egeria_state.get_element_dictionary(),
|
94
|
+
# current_block, directive)
|
97
95
|
elif potential_command in ["Create Term", "Update Term"]:
|
98
|
-
result = process_term_upsert_command(client,
|
99
|
-
directive)
|
96
|
+
result = process_term_upsert_command(client, current_block, directive)
|
100
97
|
elif potential_command in ["List Term History", "Term History"]:
|
101
|
-
result = process_term_history_command(client,
|
102
|
-
directive)
|
98
|
+
result = process_term_history_command(client, current_block, directive)
|
103
99
|
elif potential_command in ["List Terms", "List Glossary Terms"]:
|
104
|
-
result = process_term_list_command(client,
|
105
|
-
directive)
|
100
|
+
result = process_term_list_command(client, current_block, directive)
|
106
101
|
elif potential_command in ["List Categories", "List Glossary Categories"]:
|
107
102
|
result = process_category_list_command(client, dr_egeria_state.get_element_dictionary(), current_block,
|
108
|
-
|
103
|
+
directive)
|
109
104
|
elif potential_command in ["List Glossaries"]:
|
110
105
|
result = process_glossary_list_command(client, dr_egeria_state.get_element_dictionary(), current_block,
|
111
|
-
|
106
|
+
directive)
|
112
107
|
elif potential_command in ["Create Personal Project", "Update Personal Project"]:
|
113
|
-
result = process_per_proj_upsert_command(client,
|
114
|
-
current_block, directive)
|
108
|
+
result = process_per_proj_upsert_command(client, current_block, directive)
|
115
109
|
elif potential_command in ["Create Blueprint", "Update Blueprint", "Create Solution Blueprint",
|
116
110
|
"Update Solution Blueprint"]:
|
117
|
-
result = process_blueprint_upsert_command(client,
|
118
|
-
current_block, directive)
|
111
|
+
result = process_blueprint_upsert_command(client, current_block, directive)
|
119
112
|
elif potential_command in ["Create Solution Component", "Update Solution Component"]:
|
120
|
-
result = process_solution_component_upsert_command(client,
|
121
|
-
current_block, directive)
|
113
|
+
result = process_solution_component_upsert_command(client, current_block, directive)
|
122
114
|
|
123
115
|
|
124
116
|
else:
|
@@ -136,7 +136,7 @@ def display_categories(
|
|
136
136
|
classification_props = category["elementHeader"]['classifications'][0].get('classificationProperties',None)
|
137
137
|
glossary_qualified_name = '---'
|
138
138
|
if classification_props is not None:
|
139
|
-
glossary_guid = classification_props.get('
|
139
|
+
glossary_guid = classification_props.get('anchorScopeGUID','---')
|
140
140
|
glossary_qualified_name = (
|
141
141
|
m_client.get_glossary_by_guid(glossary_guid))['glossaryProperties']['qualifiedName']
|
142
142
|
cat_info = m_client.get_category_parent(category_guid)
|
@@ -187,23 +187,23 @@ def display_glossary_terms(
|
|
187
187
|
q_name = Text(
|
188
188
|
f"{qualified_name}\n&\n{term_guid}", style=style, justify="center"
|
189
189
|
)
|
190
|
-
abbrev = Text(props.get("abbreviation", "
|
191
|
-
summary = Text(props.get("summary", "
|
192
|
-
description = Markdown(props.get("description"))
|
190
|
+
abbrev = Text(props.get("abbreviation", "---"), style=style, justify="center")
|
191
|
+
summary = Text(props.get("summary", "---"), style=style)
|
192
|
+
description = Markdown(props.get("description",'---'))
|
193
193
|
version = Text(
|
194
|
-
props.get("publishVersionIdentifier", "
|
194
|
+
props.get("publishVersionIdentifier", "---"),
|
195
195
|
style=style,
|
196
196
|
justify="center",
|
197
197
|
)
|
198
|
-
example = props.get("example", "
|
199
|
-
usage = props.get("usage", "
|
198
|
+
example = props.get("example", "---")
|
199
|
+
usage = props.get("usage", "---")
|
200
200
|
ex_us_out = Markdown(f"Example:\n{example}\n---\nUsage: \n{usage}")
|
201
201
|
|
202
202
|
classifications = term["elementHeader"]["classifications"]
|
203
203
|
glossary_guid = None
|
204
204
|
for c in classifications:
|
205
205
|
if c["classificationName"] == "Anchors":
|
206
|
-
glossary_guid = c["classificationProperties"]["
|
206
|
+
glossary_guid = c["classificationProperties"]["anchorScopeGUID"]
|
207
207
|
|
208
208
|
if glossary_guid and glossary_guid in glossary_info:
|
209
209
|
glossary_name = glossary_info[glossary_guid]
|
@@ -847,16 +847,21 @@ class GlossaryBrowser(Client):
|
|
847
847
|
# Get parent category
|
848
848
|
parent_cat_md = self._get_parent_category_name(category_guid, output_format)
|
849
849
|
|
850
|
-
# Get subcategories
|
851
|
-
_, subcategory_list_md = self._get_subcategories_list(category_guid, output_format)
|
852
|
-
|
853
850
|
# Get glossary information
|
854
851
|
glossary_qualified_name = self._get_glossary_name_for_element(element, output_format)
|
855
852
|
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
853
|
+
# Only include subcategories if output_format is not FORM, REPORT, or MD
|
854
|
+
if output_format not in ['FORM', 'REPORT', 'MD']:
|
855
|
+
# Get subcategories
|
856
|
+
_, subcategory_list_md = self._get_subcategories_list(category_guid, output_format)
|
857
|
+
return {
|
858
|
+
'in_glossary': glossary_qualified_name, 'parent_category': parent_cat_md,
|
859
|
+
'subcategories': subcategory_list_md
|
860
|
+
}
|
861
|
+
else:
|
862
|
+
return {
|
863
|
+
'in_glossary': glossary_qualified_name, 'parent_category': parent_cat_md
|
864
|
+
}
|
860
865
|
|
861
866
|
def _generate_category_md(self, elements: list, elements_action: str, output_format: str) -> str:
|
862
867
|
"""
|
@@ -1528,6 +1533,7 @@ class GlossaryBrowser(Client):
|
|
1528
1533
|
|
1529
1534
|
return response.json().get("elementList", "No categories found")
|
1530
1535
|
|
1536
|
+
|
1531
1537
|
def get_glossary_subcategories(self, glossary_category_guid: str, effective_time: str = None, start_from: int = 0,
|
1532
1538
|
page_size: int = max_paging_size, for_lineage: bool = False,
|
1533
1539
|
for_duplicate_processing: bool = False, ) -> dict | str:
|
@@ -1979,8 +1985,8 @@ class GlossaryBrowser(Client):
|
|
1979
1985
|
self._async_get_categories_by_name(name, glossary_guid, status, start_from, page_size))
|
1980
1986
|
return response
|
1981
1987
|
|
1982
|
-
async def
|
1983
|
-
|
1988
|
+
async def _async_get_category_by_guid(self, glossary_category_guid: str, effective_time: str = None,
|
1989
|
+
output_format: str = 'JSON', ) -> list | str:
|
1984
1990
|
"""Retrieve the requested glossary category metadata element. The optional request body contain an effective
|
1985
1991
|
time for the query..
|
1986
1992
|
|
@@ -2035,8 +2041,8 @@ class GlossaryBrowser(Client):
|
|
2035
2041
|
return self.generate_categories_md(element, "GUID", output_format)
|
2036
2042
|
return response.json().get("element", NO_CATEGORIES_FOUND)
|
2037
2043
|
|
2038
|
-
def
|
2039
|
-
|
2044
|
+
def get_category_by_guid(self, glossary_category_guid: str, effective_time: str = None,
|
2045
|
+
output_format: str = 'JSON', ) -> list | str:
|
2040
2046
|
"""Retrieve the requested glossary category metadata element. The optional request body contain an effective
|
2041
2047
|
time for the query..
|
2042
2048
|
|
@@ -2074,7 +2080,7 @@ class GlossaryBrowser(Client):
|
|
2074
2080
|
"""
|
2075
2081
|
loop = asyncio.get_event_loop()
|
2076
2082
|
response = loop.run_until_complete(
|
2077
|
-
self.
|
2083
|
+
self._async_get_category_by_guid(glossary_category_guid, effective_time, output_format))
|
2078
2084
|
return response
|
2079
2085
|
|
2080
2086
|
async def _async_get_category_parent(self, glossary_category_guid: str, effective_time: str = None, ) -> list | str:
|
@@ -2849,7 +2855,7 @@ class GlossaryBrowser(Client):
|
|
2849
2855
|
"""
|
2850
2856
|
|
2851
2857
|
loop = asyncio.get_event_loop()
|
2852
|
-
response = loop.run_until_complete(self.
|
2858
|
+
response = loop.run_until_complete(self._async_get_term_by_guid(term_guid, output_format))
|
2853
2859
|
|
2854
2860
|
return response
|
2855
2861
|
|
pyegeria/md_processing_utils.py
CHANGED
@@ -9,7 +9,7 @@ import os
|
|
9
9
|
import re
|
10
10
|
import sys
|
11
11
|
from datetime import datetime
|
12
|
-
from typing import List, Optional
|
12
|
+
from typing import List, Optional, Any
|
13
13
|
|
14
14
|
from rich import print
|
15
15
|
from rich.console import Console
|
@@ -31,8 +31,8 @@ command_list = ["Provenance", "Create Glossary", "Update Glossary", "Create Term
|
|
31
31
|
"List Glossaries", "List Categories", "List Glossary Categories",
|
32
32
|
"Create Personal Project", "Update Personal Project", "Create Category",
|
33
33
|
"Update Category", "Create Solution Blueprint", "Update Solution Blueprint",
|
34
|
-
"Create Solution Component", "Update Solution Component", "
|
35
|
-
|
34
|
+
"Create Solution Component", "Update Solution Component", "Update Category Structure",
|
35
|
+
]
|
36
36
|
# verbosity - verbose, quiet, debug
|
37
37
|
debug_level = "debug"
|
38
38
|
message_types = {
|
@@ -45,12 +45,13 @@ INFO = "INFO"
|
|
45
45
|
WARNING = "WARNING"
|
46
46
|
pre_command = "\n---\n==> Processing command:"
|
47
47
|
command_seperator = Markdown("\n---\n")
|
48
|
+
EXISTS_REQUIRED = "Exists Required"
|
48
49
|
|
49
50
|
GLOSSARY_NAME_LABELS = ["Glossary Name", "Glossary", "Glossaries", "Owning Glossary", "In Glossary"]
|
50
51
|
CATEGORY_NAME_LABELS = ["Glossary Category Name", "Glossary Category", "Glossary Categories", "Category Name",
|
51
52
|
"Category", "Categories"]
|
52
53
|
PARENT_CATEGORY_LABELS = ["Parent Category Name", "Parent Category", "parent category name", "parent category"]
|
53
|
-
CHILD_CATEGORY_LABELS = ["Child
|
54
|
+
CHILD_CATEGORY_LABELS = ["Child Categories", "Child Category", "child category names", "child categories", "Child Category Names"]
|
54
55
|
TERM_NAME_LABELS = ["Glossary Term Name", "Glossary Term", "Glossary Terms", "Term Name", "Term", "Terms", "Term Names"]
|
55
56
|
PROJECT_NAME_LABELS = ["Project Name", "Project", "Project Names", "Projects"]
|
56
57
|
BLUEPRINT_NAME_LABELS = ["Solution Blueprint Name", "Solution Blueprint", "Solution Blueprints", "Blueprint Name",
|
@@ -219,7 +220,7 @@ def extract_command(block: str) -> str | None:
|
|
219
220
|
return None
|
220
221
|
|
221
222
|
|
222
|
-
def extract_attribute(text: str, labels: [str]) -> str | None:
|
223
|
+
def extract_attribute(text: str, labels: list[str]) -> str | None:
|
223
224
|
"""
|
224
225
|
Extracts the attribute value from a string.
|
225
226
|
|
@@ -228,7 +229,7 @@ def extract_attribute(text: str, labels: [str]) -> str | None:
|
|
228
229
|
labels: List of equivalent labels to search for
|
229
230
|
|
230
231
|
Returns:
|
231
|
-
The
|
232
|
+
The value of the attribute, or None if not found.
|
232
233
|
|
233
234
|
Note:
|
234
235
|
Lines beginning with '>' are ignored.
|
@@ -251,6 +252,8 @@ def extract_attribute(text: str, labels: [str]) -> str | None:
|
|
251
252
|
if not extracted_text.isspace() and extracted_text:
|
252
253
|
return extracted_text # Return the cleaned text - I removed the title casing
|
253
254
|
|
255
|
+
return None
|
256
|
+
|
254
257
|
|
255
258
|
def print_msg(msg_level: str, msg: str, verbosity: str):
|
256
259
|
"""
|
@@ -375,14 +378,14 @@ def process_provenance_command(file_path: str, txt: [str]) -> str:
|
|
375
378
|
return f"\n# Provenance:\n{existing_prov}\n{output}\n"
|
376
379
|
|
377
380
|
|
378
|
-
def process_element_identifiers(egeria_client: EgeriaTech, element_type: str, element_labels: [str], txt: str,
|
381
|
+
def process_element_identifiers(egeria_client: EgeriaTech, element_type: str, element_labels: list[str], txt: str,
|
379
382
|
action: str, version: str = None) -> tuple[str, str, bool, bool]:
|
380
383
|
"""
|
381
384
|
Processes element identifiers by extracting display name and qualified name from the input text,
|
382
385
|
checking if the element exists in Egeria, and validating the information.
|
383
386
|
|
384
|
-
Parameters
|
385
|
-
|
387
|
+
Parameters
|
388
|
+
----------
|
386
389
|
egeria_client: EgeriaTech
|
387
390
|
Client object for interacting with Egeria.
|
388
391
|
element_type: str
|
@@ -441,7 +444,7 @@ def process_element_identifiers(egeria_client: EgeriaTech, element_type: str, el
|
|
441
444
|
update_element_dictionary(q_name, {'display_name': element_name})
|
442
445
|
elif qualified_name:
|
443
446
|
update_element_dictionary(qualified_name, {'display_name': element_name})
|
444
|
-
elif action ==
|
447
|
+
elif action == EXISTS_REQUIRED:
|
445
448
|
if not exists:
|
446
449
|
msg = f"Required {element_type} `{element_name}` does not exist"
|
447
450
|
print_msg("DEBUG-ERROR", msg, debug_level)
|
@@ -537,10 +540,10 @@ def get_element_by_name(egeria_client, element_type: str, element_name: str) ->
|
|
537
540
|
# method_name} not found on client"
|
538
541
|
|
539
542
|
|
540
|
-
def
|
541
|
-
|
543
|
+
def process_name_list(egeria_client: EgeriaTech, element_type: str, txt: str, element_labels: list[str]) -> tuple[str, list[
|
544
|
+
Any], bool | Any, bool | None | Any] | None:
|
542
545
|
"""
|
543
|
-
Processes a list of
|
546
|
+
Processes a list of names specified in the given text, retrieves details for each
|
544
547
|
element based on the provided type, and generates a list of valid qualified names.
|
545
548
|
|
546
549
|
The function reads a text block, extracts a list of element names according to the specified
|
@@ -552,8 +555,8 @@ def process_q_name_list(egeria_client: EgeriaTech, element_type: str, txt: str,
|
|
552
555
|
|
553
556
|
egeria_client (EgeriaTech): The client instance to connect and query elements from an
|
554
557
|
external system.
|
555
|
-
|
556
|
-
|
558
|
+
Element_type (str): The type of element, such as schema or attribute, to process.
|
559
|
+
Txt (str): The raw input text containing element names to be processed.
|
557
560
|
element_labels: a list of equivalent label names to use in processing the element.
|
558
561
|
|
559
562
|
Returns:
|
@@ -604,8 +607,7 @@ def process_q_name_list(egeria_client: EgeriaTech, element_type: str, txt: str,
|
|
604
607
|
return elements, new_element_list, valid, exists
|
605
608
|
|
606
609
|
|
607
|
-
def process_blueprint_upsert_command(egeria_client: EgeriaTech,
|
608
|
-
directive: str = "display") -> Optional[str]:
|
610
|
+
def process_blueprint_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
609
611
|
"""
|
610
612
|
Processes a blueprint create or update command by extracting key attributes such as
|
611
613
|
blueprint name, description, and version from the given cell.
|
@@ -676,11 +678,11 @@ def process_blueprint_upsert_command(egeria_client: EgeriaTech, element_dictiona
|
|
676
678
|
print_msg("ALWAYS", msg, debug_level)
|
677
679
|
|
678
680
|
# update with get blueprint by guid
|
679
|
-
return 'Would return get blueprint by guid and return md' # egeria_client.
|
681
|
+
return 'Would return get blueprint by guid and return md' # egeria_client.get_term_by_guid( #
|
680
682
|
# known_guid, 'md')
|
681
683
|
|
682
684
|
elif object_action == "Update" and directive == "validate":
|
683
|
-
return 'Would call get_blueprint_by_guid and return md' # egeria_client.
|
685
|
+
return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_term_by_guid( #
|
684
686
|
# known_guid, 'md')
|
685
687
|
|
686
688
|
elif object_action == "Create":
|
@@ -699,7 +701,7 @@ def process_blueprint_upsert_command(egeria_client: EgeriaTech, element_dictiona
|
|
699
701
|
print_msg("ALWAYS", msg, debug_level)
|
700
702
|
|
701
703
|
update_element_dictionary(q_name, {'guid': new_guid, 'display_name': display_name})
|
702
|
-
return 'Would return get blueprint by guid results as md' # egeria_client.
|
704
|
+
return 'Would return get blueprint by guid results as md' # egeria_client.get_term_by_guid( #
|
703
705
|
# term_guid, 'MD')
|
704
706
|
|
705
707
|
except Exception as e:
|
@@ -709,8 +711,7 @@ def process_blueprint_upsert_command(egeria_client: EgeriaTech, element_dictiona
|
|
709
711
|
return None
|
710
712
|
|
711
713
|
|
712
|
-
def process_solution_component_upsert_command(egeria_client: EgeriaTech,
|
713
|
-
directive: str = "display") -> Optional[str]:
|
714
|
+
def process_solution_component_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
714
715
|
"""
|
715
716
|
Processes a solution componentt create or update command by extracting key attributes such as
|
716
717
|
solution component name, description, version, solution component type etc from the given cell.
|
@@ -756,9 +757,9 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, element
|
|
756
757
|
if solution_blueprints: # Find information about blueprints that include this component
|
757
758
|
msg = "Checking for blueprints that include this solution component"
|
758
759
|
print_msg("DEBUG-INFO", msg, debug_level)
|
759
|
-
solution_blueprints, bp_qname_list, bp_valid, bp_exist =
|
760
|
+
solution_blueprints, bp_qname_list, bp_valid, bp_exist = process_name_list(egeria_client,
|
760
761
|
'Solution Blueprints', txt,
|
761
|
-
|
762
|
+
BLUEPRINT_NAME_LABELS)
|
762
763
|
if bp_exist and bp_valid:
|
763
764
|
msg = f"Found valid blueprints that include this solution component:\n\t{solution_blueprints}"
|
764
765
|
print_msg("INFO", msg, debug_level)
|
@@ -769,7 +770,7 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, element
|
|
769
770
|
msg = f"Parent Components are missing"
|
770
771
|
print_msg("INFO", msg, debug_level)
|
771
772
|
else:
|
772
|
-
parent_components, parent_qname_list, parents_valid, parent_components_exist =
|
773
|
+
parent_components, parent_qname_list, parents_valid, parent_components_exist = process_name_list(
|
773
774
|
egeria_client, 'Parent Components', txt, COMPONENT_NAME_LABELS)
|
774
775
|
if parent_components_exist and parents_valid:
|
775
776
|
msg = f"Found valid parent components that include this solution component:\n\t{parent_qname_list}"
|
@@ -844,10 +845,10 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, element
|
|
844
845
|
print_msg("ALWAYS", msg, debug_level)
|
845
846
|
# update with get solution component by guid
|
846
847
|
return 'Would return get Solution Component by guid and return md' # #
|
847
|
-
# egeria_client.
|
848
|
+
# egeria_client.get_term_by_guid(known_guid, 'md')
|
848
849
|
|
849
850
|
elif object_action == "Update" and directive == "validate":
|
850
|
-
return 'Would call get_blueprint_by_guid and return md' # egeria_client.
|
851
|
+
return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_term_by_guid( #
|
851
852
|
# known_guid, 'md')
|
852
853
|
|
853
854
|
elif object_action == "Create":
|
@@ -866,7 +867,7 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, element
|
|
866
867
|
print_msg("ALWAYS", msg, debug_level)
|
867
868
|
update_element_dictionary(known_q_name, {'guid': known_guid, 'display_name': display_name})
|
868
869
|
return 'Would return get solution component by guid results as md' # #
|
869
|
-
# egeria_client.
|
870
|
+
# egeria_client.get_term_by_guid(term_guid, 'MD')
|
870
871
|
|
871
872
|
except Exception as e:
|
872
873
|
msg = f"Error creating term {display_name}: {e}"
|
@@ -875,8 +876,7 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, element
|
|
875
876
|
return None
|
876
877
|
|
877
878
|
|
878
|
-
def process_glossary_upsert_command(egeria_client: EgeriaTech,
|
879
|
-
directive: str = "display") -> Optional[str]:
|
879
|
+
def process_glossary_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
880
880
|
"""
|
881
881
|
Processes a glossary create or update command by extracting key attributes such as
|
882
882
|
glossary name, language, description, and usage from the given text.
|
@@ -886,13 +886,11 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, element_dictionar
|
|
886
886
|
:param directive: an optional string indicating the directive to be used - display, validate or execute
|
887
887
|
:return: A string summarizing the outcome of the processing.
|
888
888
|
"""
|
889
|
-
|
890
|
-
# object_type = command.split(' ')[1].strip()
|
891
|
-
# object_action = command.split(' ')[0].strip()
|
889
|
+
|
892
890
|
command, object_type, object_action = extract_command_plus(txt)
|
893
891
|
set_debug_level(directive)
|
894
892
|
|
895
|
-
glossary_name = process_simple_attribute(txt,
|
893
|
+
glossary_name = process_simple_attribute(txt, GLOSSARY_NAME_LABELS)
|
896
894
|
print(Markdown(
|
897
895
|
f"{pre_command} `{object_action}` `{object_type}` for glossary: `\'{glossary_name}\'` with directive: `"
|
898
896
|
f"{directive}` "))
|
@@ -903,7 +901,9 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, element_dictionar
|
|
903
901
|
|
904
902
|
if glossary_name is None:
|
905
903
|
valid = False
|
906
|
-
known_q_name
|
904
|
+
known_q_name = None
|
905
|
+
known_guid = None
|
906
|
+
glossary_exists = False
|
907
907
|
else:
|
908
908
|
element_labels = GLOSSARY_NAME_LABELS
|
909
909
|
element_labels.append('Display Name')
|
@@ -998,8 +998,7 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, element_dictionar
|
|
998
998
|
return egeria_client.get_glossary_by_guid(glossary_guid, output_format='MD')
|
999
999
|
|
1000
1000
|
|
1001
|
-
def
|
1002
|
-
directive: str = "display") -> Optional[str]:
|
1001
|
+
def process_category_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1003
1002
|
"""
|
1004
1003
|
Processes a glossary category create or update command by extracting key attributes such as
|
1005
1004
|
category name, qualified, description, and anchor glossary from the given txt..
|
@@ -1011,9 +1010,7 @@ def process_categories_upsert_command(egeria_client: EgeriaTech, element_diction
|
|
1011
1010
|
"""
|
1012
1011
|
valid = True
|
1013
1012
|
set_debug_level(directive)
|
1014
|
-
|
1015
|
-
# object_type = command.split(' ')[1].strip()
|
1016
|
-
# object_action = command.split(' ')[0].strip()
|
1013
|
+
|
1017
1014
|
command, object_type, object_action = extract_command_plus(txt)
|
1018
1015
|
|
1019
1016
|
category_name = process_simple_attribute(txt, ['Category Name', 'category_name', 'Cat'])
|
@@ -1023,6 +1020,9 @@ def process_categories_upsert_command(egeria_client: EgeriaTech, element_diction
|
|
1023
1020
|
description = process_simple_attribute(txt, ['Description'])
|
1024
1021
|
q_name = process_simple_attribute(txt, ['Qualified Name'])
|
1025
1022
|
|
1023
|
+
parent_category_name = process_simple_attribute(txt, PARENT_CATEGORY_LABELS, "INFO")
|
1024
|
+
|
1025
|
+
|
1026
1026
|
element_labels = CATEGORY_NAME_LABELS
|
1027
1027
|
element_labels.append('Display Name')
|
1028
1028
|
# Check if category exists (and get qname and guid)
|
@@ -1036,21 +1036,32 @@ def process_categories_upsert_command(egeria_client: EgeriaTech, element_diction
|
|
1036
1036
|
element_labels, txt,
|
1037
1037
|
object_action, None)
|
1038
1038
|
|
1039
|
+
|
1039
1040
|
# Check if owning glossary exists (and get qname)
|
1040
1041
|
if owning_glossary_name is None:
|
1041
1042
|
valid = False
|
1042
1043
|
known_glossary_q_name, known_glossary__guid, glossary_exists = None
|
1044
|
+
|
1043
1045
|
else:
|
1044
1046
|
known_glossary_q_name, known_glossary_guid, valid, owning_glossary_exists = process_element_identifiers(
|
1045
|
-
egeria_client, "Glossary", GLOSSARY_NAME_LABELS, txt,
|
1047
|
+
egeria_client, "Glossary", GLOSSARY_NAME_LABELS, txt, EXISTS_REQUIRED, None)
|
1048
|
+
|
1049
|
+
if parent_category_name:
|
1050
|
+
_, parent_guid, parent_valid, parent_exists = get_element_by_name(
|
1051
|
+
egeria_client, 'Glossary Categories', parent_category_name)
|
1052
|
+
else:
|
1053
|
+
parent_guid = None
|
1054
|
+
parent_exists = False
|
1055
|
+
parent_valid = False
|
1046
1056
|
|
1047
1057
|
category_display = (
|
1048
1058
|
f"\n* Command: {command}\n\t* Category: {category_name}\n\t* In Glossary: {owning_glossary_name}\n\t"
|
1049
|
-
f"* Description:\n{description}\n\t*
|
1059
|
+
f"* Description:\n{description}\n\t* Parent Category: {parent_category_name}\n\t"
|
1060
|
+
f"* Qualified Name: {q_name}\n\t")
|
1050
1061
|
|
1051
1062
|
if object_action == 'Update':
|
1052
1063
|
guid = process_simple_attribute(txt, ['GUID', 'guid', 'Guid'])
|
1053
|
-
|
1064
|
+
|
1054
1065
|
category_display += (f"* GUID: {guid}\n\n")
|
1055
1066
|
if not category_exists:
|
1056
1067
|
msg = f"Category {category_name} can't be updated; {category_name} not found."
|
@@ -1097,14 +1108,22 @@ def process_categories_upsert_command(egeria_client: EgeriaTech, element_diction
|
|
1097
1108
|
f"command\n")
|
1098
1109
|
return update_a_command(txt, command, object_type, known_q_name, known_guid)
|
1099
1110
|
|
1111
|
+
# Update the basic category properties
|
1100
1112
|
egeria_client.update_category(known_guid, category_name, description, known_q_name, None)
|
1101
1113
|
msg = f"->Updated category `{category_name}`with GUID {known_guid}"
|
1102
1114
|
print_msg(ALWAYS, msg, debug_level)
|
1115
|
+
|
1116
|
+
# Update parent-child relationships
|
1117
|
+
|
1103
1118
|
update_element_dictionary(known_q_name, {
|
1104
1119
|
'guid': known_guid, 'display_name': category_name
|
1105
1120
|
})
|
1106
1121
|
print_msg(ALWAYS, f"Updated Category `{category_name}` with GUID {known_guid}", debug_level)
|
1107
|
-
|
1122
|
+
|
1123
|
+
category_sync = update_category_parent(egeria_client, known_guid,
|
1124
|
+
parent_category_name)
|
1125
|
+
print_msg(ALWAYS, f"Updated Category hierarchy for `{category_name}` with outcome {category_sync}", debug_level)
|
1126
|
+
return egeria_client.get_category_by_guid(known_guid, output_format='FORM')
|
1108
1127
|
|
1109
1128
|
elif object_action == "Create":
|
1110
1129
|
is_root = True
|
@@ -1116,7 +1135,7 @@ def process_categories_upsert_command(egeria_client: EgeriaTech, element_diction
|
|
1116
1135
|
return update_a_command(txt, command, object_type, known_q_name, known_guid)
|
1117
1136
|
else:
|
1118
1137
|
category_guid = egeria_client.create_category(known_glossary_guid, category_name, description, is_root)
|
1119
|
-
category_details = egeria_client.
|
1138
|
+
category_details = egeria_client.get_category_by_guid(category_guid)
|
1120
1139
|
|
1121
1140
|
if category_details == NO_CATEGORIES_FOUND:
|
1122
1141
|
msg = f"Just created category with GUID {category_guid} but category not found"
|
@@ -1128,121 +1147,98 @@ def process_categories_upsert_command(egeria_client: EgeriaTech, element_diction
|
|
1128
1147
|
'guid': category_guid, 'display_name': category_name
|
1129
1148
|
})
|
1130
1149
|
print_msg(ALWAYS, f"Created Category `{category_name}` with GUID {category_guid}", debug_level)
|
1131
|
-
|
1150
|
+
if parent_valid & parent_exists:
|
1151
|
+
egeria_client.set_parent_category(parent_guid, category_guid)
|
1152
|
+
print_msg(ALWAYS, f"Set parent category for `{category_name}` to `{parent_category_name}`", debug_level)
|
1153
|
+
else:
|
1154
|
+
print_msg(ERROR, f"Parent category `{parent_category_name}` not found or invalid for `{category_name}`", debug_level)
|
1155
|
+
return egeria_client.get_category_by_guid(category_guid, output_format='FORM')
|
1156
|
+
return None
|
1157
|
+
return None
|
1132
1158
|
|
1133
1159
|
|
1134
|
-
def
|
1135
|
-
directive: str = "display") -> Optional[str]:
|
1160
|
+
def update_category_parent(egeria_client, category_guid: str, parent_category_name: str = None) -> bool:
|
1136
1161
|
"""
|
1137
|
-
|
1138
|
-
parent and child category names from the given text.
|
1162
|
+
Updates the parent relationship for a category.
|
1139
1163
|
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
"""
|
1145
|
-
valid = True
|
1146
|
-
set_debug_level(directive)
|
1164
|
+
If a parent category is specified, it will check if a parent is currently set.
|
1165
|
+
If a parent category was set and is the same as the parent category specified, no change is needed.
|
1166
|
+
If a parent category was set and is different from the parent_category_name, the parent category is updated.
|
1167
|
+
If parent_category_name is None or empty and an existing parent category was set, the parent category is removed.
|
1147
1168
|
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1169
|
+
Parameters
|
1170
|
+
----------
|
1171
|
+
egeria_client: EgeriaTech
|
1172
|
+
The Egeria client to use for API calls
|
1173
|
+
category_guid: str
|
1174
|
+
The GUID of the category to update
|
1175
|
+
parent_category_name: str, optional
|
1176
|
+
The name of the parent category to set, or None to remove the parent
|
1154
1177
|
|
1155
|
-
|
1156
|
-
|
1157
|
-
else:
|
1158
|
-
parent_cat_q_name, parent_cat_guid, parent_cat_valid, parent_cat_exists = (
|
1159
|
-
get_element_by_name(egeria_client, 'Glossary Categories', parent_category_name))
|
1160
|
-
child_cat_q_name, child_cat_guid, child_cat_valid, child_cat_exists = (
|
1161
|
-
get_element_by_name(egeria_client, 'Glossary Categories', child_category_name))
|
1178
|
+
Returns
|
1179
|
+
-------
|
1162
1180
|
|
1163
|
-
|
1181
|
+
True if successful, False otherwise.
|
1164
1182
|
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
if
|
1170
|
-
|
1171
|
-
|
1183
|
+
"""
|
1184
|
+
outcome = True
|
1185
|
+
# Handle parent category updates
|
1186
|
+
if parent_category_name:
|
1187
|
+
# Check if a parent is currently set
|
1188
|
+
current_parent = egeria_client.get_category_parent(category_guid)
|
1189
|
+
|
1190
|
+
if isinstance(current_parent, str) and "No Parent Category found" in current_parent:
|
1191
|
+
# No parent currently set, need to set it
|
1192
|
+
parent_q_name, parent_guid, parent_valid, parent_exists = get_element_by_name(
|
1193
|
+
egeria_client, 'Glossary Categories', parent_category_name)
|
1194
|
+
|
1195
|
+
if parent_exists and parent_guid:
|
1196
|
+
egeria_client.set_parent_category(parent_guid, category_guid)
|
1197
|
+
print_msg(ALWAYS, f"Set parent category of category to `{parent_category_name}`", debug_level)
|
1198
|
+
else:
|
1199
|
+
print_msg(ERROR, f"Parent category `{parent_category_name}` not found", debug_level)
|
1200
|
+
outcome = False
|
1172
1201
|
else:
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1202
|
+
# Parent is set, check if it's the same
|
1203
|
+
current_parent_name = current_parent.get('glossaryCategoryProperties', {}).get('qualifiedName', '')
|
1204
|
+
|
1205
|
+
if current_parent_name != parent_category_name:
|
1206
|
+
# Different parent, need to update
|
1207
|
+
# First remove the current parent
|
1208
|
+
current_parent_guid = current_parent.get('elementHeader', {}).get('guid', '')
|
1209
|
+
if current_parent_guid:
|
1210
|
+
egeria_client.remove_parent_category(current_parent_guid, category_guid)
|
1211
|
+
|
1212
|
+
# Then set the new parent
|
1213
|
+
parent_q_name, parent_guid, parent_valid, parent_exists = get_element_by_name(
|
1214
|
+
egeria_client, 'Glossary Categories', parent_category_name)
|
1215
|
+
|
1216
|
+
if parent_exists and parent_guid:
|
1217
|
+
egeria_client.set_parent_category(parent_guid, category_guid)
|
1218
|
+
print_msg(ALWAYS, f"Updated parent category from `{current_parent_name}` to `{parent_category_name}`", debug_level)
|
1219
|
+
else:
|
1220
|
+
print_msg(ERROR, f"Parent category `{parent_category_name}` not found", debug_level)
|
1221
|
+
outcome = False
|
1222
|
+
elif parent_category_name is None or parent_category_name == '':
|
1223
|
+
# Check if a parent is currently set and remove it if needed
|
1224
|
+
current_parent = egeria_client.get_category_parent(category_guid)
|
1176
1225
|
|
1226
|
+
if not isinstance(current_parent, str) or "No Parent Category found" not in current_parent:
|
1227
|
+
# Parent is set, need to remove it
|
1228
|
+
current_parent_guid = current_parent.get('elementHeader', {}).get('guid', '')
|
1229
|
+
current_parent_name = current_parent.get('glossaryCategoryProperties', {}).get('qualifiedName', '')
|
1177
1230
|
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
f"* Qualified Name: {parent_cat_q_name}\n\t\t* GUID: {parent_cat_guid}\n\t"
|
1185
|
-
f"* Child Category:\n{child_category_name}\n\t\t* Qualified Name: {child_cat_q_name}\n\t\t"
|
1186
|
-
f"* GUID: {child_cat_guid}\n")
|
1187
|
-
|
1188
|
-
# if object_action == 'Remove Parent Category':
|
1189
|
-
# parent_guid = process_simple_attribute(txt, ['GUID', 'guid', 'Guid'])
|
1190
|
-
#
|
1191
|
-
# category_display += (f"* GUID: {guid}\n\n")
|
1192
|
-
# if not category_exists:
|
1193
|
-
# msg = f"Category {category_name} can't be updated; {category_name} not found."
|
1194
|
-
# print_msg(ERROR, msg, debug_level)
|
1195
|
-
# valid = False
|
1196
|
-
# else:
|
1197
|
-
# msg = f"Glossary can be updated; {category_name} found"
|
1198
|
-
# print_msg(ALWAYS, msg, debug_level)
|
1199
|
-
#
|
1200
|
-
# elif object_action == "Create":
|
1201
|
-
# if category_exists:
|
1202
|
-
# msg = f"Category {category_name} can't be created because it already exists.\n"
|
1203
|
-
# print_msg("ERROR", msg, debug_level)
|
1204
|
-
# valid = False
|
1205
|
-
# elif valid:
|
1206
|
-
# msg = f"It is valid to create Category `{category_name}` with:\n"
|
1207
|
-
# print_msg("ALWAYS", msg, debug_level)
|
1231
|
+
if current_parent_guid:
|
1232
|
+
egeria_client.remove_parent_category(current_parent_guid, category_guid)
|
1233
|
+
print_msg(ALWAYS, f"Removed parent category `{current_parent_name}`", debug_level)
|
1234
|
+
|
1235
|
+
|
1236
|
+
return outcome
|
1208
1237
|
|
1209
|
-
if directive == "display":
|
1210
|
-
print(Markdown(category_display))
|
1211
|
-
return None
|
1212
1238
|
|
1213
|
-
elif directive == "validate":
|
1214
|
-
if valid:
|
1215
|
-
print(Markdown(category_display))
|
1216
|
-
else:
|
1217
|
-
msg = f"Validation failed for {object_type} `{parent_category_name}`\n"
|
1218
|
-
print_msg(ERROR, msg, debug_level)
|
1219
|
-
print(Markdown(category_display))
|
1220
|
-
return valid
|
1221
1239
|
|
1222
|
-
elif directive == "process":
|
1223
|
-
if valid:
|
1224
|
-
print(Markdown(category_display))
|
1225
|
-
else:
|
1226
|
-
msg = f"* --> Validation failed for {object_type} `{parent_category_name}`\n"
|
1227
|
-
print_msg(ERROR, msg, debug_level)
|
1228
|
-
print(Markdown(category_display))
|
1229
|
-
return None
|
1230
1240
|
|
1231
|
-
|
1232
|
-
egeria_client.set_parent_category(parent_cat_guid, child_cat_guid)
|
1233
|
-
print_msg(ALWAYS, f"Set parent category of `{child_category_name}` to `{parent_category_name}`",
|
1234
|
-
debug_level)
|
1235
|
-
output_txt = txt.replace("Set Parent", "UnSet Parent")
|
1236
|
-
return output_txt
|
1237
|
-
|
1238
|
-
elif object_action in ["UnSet", "UnSet Parent", "Unset Parent", "Unset", "Remove Parent"]:
|
1239
|
-
egeria_client.remove_parent_category(parent_cat_guid, child_cat_guid)
|
1240
|
-
print_msg(ALWAYS, f"UnSet parent category `{child_category_name}` from {parent_category_name}", debug_level)
|
1241
|
-
output_txt = txt.replace("UnSet Parent", "Set Parent")
|
1242
|
-
return output_txt
|
1243
|
-
|
1244
|
-
def process_term_list_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
|
1245
|
-
directive: str = "display") -> Optional[str]:
|
1241
|
+
def process_term_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1246
1242
|
""" List terms as a markdown table. Filter based on optional search string. """
|
1247
1243
|
set_debug_level(directive)
|
1248
1244
|
valid = True
|
@@ -1296,7 +1292,7 @@ def process_term_list_command(egeria_client: EgeriaTech, element_dictionary: dic
|
|
1296
1292
|
return None
|
1297
1293
|
|
1298
1294
|
def process_category_list_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
|
1299
|
-
|
1295
|
+
directive: str = "display") -> Optional[str]:
|
1300
1296
|
""" List terms as a markdown table. Filter based on optional search string. """
|
1301
1297
|
set_debug_level(directive)
|
1302
1298
|
valid = True
|
@@ -1349,7 +1345,7 @@ def process_category_list_command(egeria_client: EgeriaTech, element_dictionary:
|
|
1349
1345
|
return None
|
1350
1346
|
|
1351
1347
|
def process_glossary_list_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
|
1352
|
-
|
1348
|
+
directive: str = "display") -> Optional[str]:
|
1353
1349
|
""" List terms as a markdown table. Filter based on optional search string. """
|
1354
1350
|
set_debug_level(directive)
|
1355
1351
|
valid = True
|
@@ -1391,8 +1387,7 @@ def process_glossary_list_command(egeria_client: EgeriaTech, element_dictionary:
|
|
1391
1387
|
console.print_exception(show_locals=True)
|
1392
1388
|
return None
|
1393
1389
|
|
1394
|
-
def process_term_history_command(egeria_client: EgeriaTech,
|
1395
|
-
directive: str = "display") -> Optional[str]:
|
1390
|
+
def process_term_history_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1396
1391
|
""" List terms as a markdown table. Filter based on optional search string. """
|
1397
1392
|
set_debug_level(directive)
|
1398
1393
|
valid = True
|
@@ -1439,8 +1434,7 @@ def process_term_history_command(egeria_client: EgeriaTech, element_dictionary:
|
|
1439
1434
|
|
1440
1435
|
|
1441
1436
|
|
1442
|
-
def process_term_upsert_command(egeria_client: EgeriaTech,
|
1443
|
-
directive: str = "display") -> Optional[str]:
|
1437
|
+
def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
|
1444
1438
|
"""
|
1445
1439
|
Processes a term create or update command by extracting key attributes such as
|
1446
1440
|
term name, summary, description, abbreviation, examples, usage, version, and status from the given cell.
|
@@ -1492,16 +1486,16 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
|
|
1492
1486
|
glossary_exists = False
|
1493
1487
|
else:
|
1494
1488
|
known_glossary_q_name, known_glossary_guid, glossary_valid, glossary_exists = process_element_identifiers(
|
1495
|
-
egeria_client, "Glossary", GLOSSARY_NAME_LABELS, txt,
|
1489
|
+
egeria_client, "Glossary", GLOSSARY_NAME_LABELS, txt, EXISTS_REQUIRED, None)
|
1496
1490
|
|
1497
1491
|
# process categories, if present
|
1498
1492
|
categories = process_simple_attribute(txt, ['Glossary Categories', 'Glossary Category', 'Category', 'Categories'])
|
1499
1493
|
if categories: # Find information about categoriess that classify this term
|
1500
1494
|
msg = "Checking for categories that classify this term"
|
1501
1495
|
print_msg("DEBUG-INFO", msg, debug_level)
|
1502
|
-
categories_list, cat_q_name_list, cat_valid, cat_exist =
|
1496
|
+
categories_list, cat_q_name_list, cat_valid, cat_exist = process_name_list(egeria_client,
|
1503
1497
|
'Glossary Categories', txt,
|
1504
|
-
|
1498
|
+
CATEGORY_NAME_LABELS)
|
1505
1499
|
if cat_exist and cat_valid:
|
1506
1500
|
msg = f"Found valid glossary categories to classify the term:\n\t{term_name}"
|
1507
1501
|
print_msg("INFO", msg, debug_level)
|
@@ -1566,11 +1560,11 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
|
|
1566
1560
|
print_msg(ALWAYS,
|
1567
1561
|
f"\tUpdated Term `{term_name}` with GUID {known_guid}\n\tand categories `{categories}`",
|
1568
1562
|
debug_level)
|
1569
|
-
return egeria_client.
|
1563
|
+
return egeria_client.get_term_by_guid(known_guid,
|
1570
1564
|
'md') # return update_a_command(txt, command, object_type,
|
1571
1565
|
# known_q_name, known_guid)
|
1572
1566
|
elif object_action == "Update" and directive == "validate": # is sthis reachable?
|
1573
|
-
return egeria_client.
|
1567
|
+
return egeria_client.get_term_by_guid(known_guid, 'md')
|
1574
1568
|
|
1575
1569
|
elif object_action == "Create":
|
1576
1570
|
if term_exists:
|
@@ -1622,8 +1616,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
|
|
1622
1616
|
return None
|
1623
1617
|
|
1624
1618
|
|
1625
|
-
def process_per_proj_upsert_command(egeria_client: ProjectManager,
|
1626
|
-
directive: str = "display") -> str | None:
|
1619
|
+
def process_per_proj_upsert_command(egeria_client: ProjectManager, txt: str, directive: str = "display") -> str | None:
|
1627
1620
|
"""
|
1628
1621
|
Processes a personal project create or update command by extracting key attributes such as
|
1629
1622
|
glossary name, language, description, and usage from the given cell.
|
@@ -629,7 +629,7 @@ def process_categories_upsert_command(egeria_client: GlossaryManager, element_di
|
|
629
629
|
'guid': known_guid, 'display_name': category_name
|
630
630
|
}
|
631
631
|
# return update_a_command(txt, command, object_type, known_q_name, known_guid)
|
632
|
-
return egeria_client.
|
632
|
+
return egeria_client.get_category_by_guid(known_guid, output_format='FORM')
|
633
633
|
|
634
634
|
elif object_action == "Create":
|
635
635
|
is_root = False
|
@@ -639,7 +639,7 @@ def process_categories_upsert_command(egeria_client: GlossaryManager, element_di
|
|
639
639
|
return update_a_command(txt, command, object_type, known_q_name, known_guid)
|
640
640
|
else:
|
641
641
|
category_guid = egeria_client.create_category(glossary_guid, category_name, description, is_root)
|
642
|
-
category = egeria_client.
|
642
|
+
category = egeria_client.get_category_by_guid(category_guid)
|
643
643
|
|
644
644
|
if category == NO_CATEGORIES_FOUND:
|
645
645
|
print(f"{ERROR}Just created with GUID {category_guid} but category not found\n")
|
@@ -649,7 +649,7 @@ def process_categories_upsert_command(egeria_client: GlossaryManager, element_di
|
|
649
649
|
'guid': category_guid, 'display_name': category_name
|
650
650
|
}
|
651
651
|
# return update_a_command(txt, command, object_type, qualified_name, category_guid)
|
652
|
-
return egeria_client.
|
652
|
+
return egeria_client.get_category_by_guid(category_guid, output_format='MD')
|
653
653
|
|
654
654
|
|
655
655
|
def process_term_upsert_command(egeria_client: GlossaryManager, element_dictionary: dict, txt: str,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
pyegeria/README.md,sha256=PwX5OC7-YSZUCIsoyHh1O-WBM2hE84sm3Bd4O353NOk,1464
|
2
|
-
pyegeria/__init__.py,sha256=
|
2
|
+
pyegeria/__init__.py,sha256=4226Kaq5Xf439GRkRu6ckhzSSJ8L30EbdZocdLfcBwE,30568
|
3
3
|
pyegeria/_client.py,sha256=lCWq8XJOFg3MnEO4ulMVuCJrW3uU4eWUCcbLEd90_LU,34673
|
4
4
|
pyegeria/_deprecated_gov_engine.py,sha256=dWNcwVsE5__dF2u4QiIyQrssozzzOjBbLld8MdpmVCQ,17264
|
5
5
|
pyegeria/_exceptions.py,sha256=1SrnV194V4_YJNnNAU0myTHQ3dhLn4GF2B2gZcj1u90,18153
|
@@ -11,12 +11,12 @@ pyegeria/classification_manager_omvs.py,sha256=n55-62Mby-_5pxPGaz3nkjM9NWlY4PzSl
|
|
11
11
|
pyegeria/collection_manager_omvs.py,sha256=xNuF3Ki6Rg-TehdbFGS8exSOUXpkQ3X63__OdXuCkc8,101746
|
12
12
|
pyegeria/commands/README.md,sha256=hJdOWhZ5eCfwTkY4Tx6De6Y1XVo7cbaddQEvjqppvls,2036
|
13
13
|
pyegeria/commands/__init__.py,sha256=R2o66ctVicTZ8B5VSPtc7EDRKNiNclzFbYX0o2Zg2dQ,1120
|
14
|
-
pyegeria/commands/cat/Dr-Egeria_md-orig.py,sha256=
|
14
|
+
pyegeria/commands/cat/Dr-Egeria_md-orig.py,sha256=M88fR52MYKUDSNmGKaJ12lO3PC-gKuNIswBOtR4eimk,7584
|
15
15
|
pyegeria/commands/cat/README.md,sha256=-aaAnIT2fcfU63vajgB-RzQk4l4yFdhkyVfSaTPiqRY,967
|
16
16
|
pyegeria/commands/cat/__init__.py,sha256=5OCy4m_yZsnSxdy_gvkCyP_OkjvuWKimqUGHYCJc_qA,450
|
17
17
|
pyegeria/commands/cat/dr_egeria_inbox/glossary_creation_experiment.ipynb,sha256=dbzNu90fCKNohOWVSRBOB1GLyd95x8Qw51I5AkaPtso,11552
|
18
|
-
pyegeria/commands/cat/dr_egeria_jupyter.py,sha256=
|
19
|
-
pyegeria/commands/cat/dr_egeria_md.py,sha256=
|
18
|
+
pyegeria/commands/cat/dr_egeria_jupyter.py,sha256=h9LmDmejmaPDlDuGNlVor-bqNnKPvSBhcC7JFWBdOEM,5710
|
19
|
+
pyegeria/commands/cat/dr_egeria_md.py,sha256=plTcv6Rq-crQD-W7r4iMYJ3NithzXlsuJFfwsLrC9oU,11367
|
20
20
|
pyegeria/commands/cat/exp_list_glossaries.py,sha256=dC6Bnfm3YSMTKPP146qeslIFRiZnGu5b7iDYE07p4iU,5817
|
21
21
|
pyegeria/commands/cat/get_asset_graph.py,sha256=xnXJfpDTVH1TJ2TwE3dtjaXU36Di6-N6JAyhothzz2o,12461
|
22
22
|
pyegeria/commands/cat/get_collection.py,sha256=kXPcP8u-SMWfrVyyBhNoxG8mcgB7EV_5i9N9w_IBU7o,5379
|
@@ -25,7 +25,7 @@ pyegeria/commands/cat/get_project_structure.py,sha256=5uxWMqNve592OT73GRCO2KoBkg
|
|
25
25
|
pyegeria/commands/cat/get_tech_type_elements.py,sha256=IznytHXwDOFriGM6mypV9wuEeM-vT2s66cUzf-IROog,6147
|
26
26
|
pyegeria/commands/cat/glossary_actions.py,sha256=zK26fNiv-lpWUP8tHC3wTmdQ6L0_XxlmuNGUyrnSclc,19606
|
27
27
|
pyegeria/commands/cat/list_assets.py,sha256=CdJ2coKvvQv2VwJO0Sp9Eg9Fu_uvpC21tgjrdtT9Yz4,6315
|
28
|
-
pyegeria/commands/cat/list_categories.py,sha256=
|
28
|
+
pyegeria/commands/cat/list_categories.py,sha256=Csdrb59oqu77GBDfjZvnEc1B-nqVGb36BrUbY9XvOXg,7901
|
29
29
|
pyegeria/commands/cat/list_cert_types.py,sha256=HmrTks0SSYgSMsYz3LqfX5kwDQ6D9KMcynoR_xlWtnE,7137
|
30
30
|
pyegeria/commands/cat/list_collections.py,sha256=kCxl5OuBAGtctHNVmttOe4aJ6r37cGdCFnK1i7A90ls,5996
|
31
31
|
pyegeria/commands/cat/list_deployed_catalogs.py,sha256=VdN6R9kRVWX-fGIgubOigvMVPzhF-hKQepHHlS-w-D8,8258
|
@@ -36,7 +36,7 @@ pyegeria/commands/cat/list_glossaries.py,sha256=D2ovkffSmnO-NQ7y-Jw0aDBtK2j06CQz
|
|
36
36
|
pyegeria/commands/cat/list_projects.py,sha256=NzWTuepTGUEyxK-eWvuUxtBgCtNWubVwmz2eqm2UN1c,7997
|
37
37
|
pyegeria/commands/cat/list_tech_type_elements.py,sha256=-9omj5en9dSP1xMSljYVHyfXsuhuE1bO2IFj_bZPhAs,6873
|
38
38
|
pyegeria/commands/cat/list_tech_types.py,sha256=uqZcXHCzAznhEG6WWeM5j-spwUh8ycygFqpVDeXOG-0,4653
|
39
|
-
pyegeria/commands/cat/list_terms.py,sha256=
|
39
|
+
pyegeria/commands/cat/list_terms.py,sha256=HPZ_S_5EwJezdgf8UY1dZiDbN5P9aD88pI_rBHftm1M,12185
|
40
40
|
pyegeria/commands/cat/list_todos.py,sha256=NitCw0uyVVjmN1hxb1W-I4FbOsa8wQxW2ICyOElHyc8,6556
|
41
41
|
pyegeria/commands/cat/list_user_ids.py,sha256=X5Q-YNEp38saPYDuy9VwdQC5Qpa4HyC3WvAdbyp_P6M,5108
|
42
42
|
pyegeria/commands/cli/__init__.py,sha256=hpTVSMP2gnPRhcAZPdeUEsQ-eaDySlXlk239dNWYmng,292
|
@@ -226,12 +226,12 @@ pyegeria/egeria_my_client.py,sha256=eOKLk2zdI6FHZnhAimfR_0yNdBjpUgD41dJZcJODcqE,
|
|
226
226
|
pyegeria/egeria_tech_client.py,sha256=uycgYfCpb4jzFfaQ7I5JxbZ5PKsWdaWxLOJjbw6C2Zk,3817
|
227
227
|
pyegeria/feedback_manager_omvs.py,sha256=0xBs0p54vmdfVYYgQ8pOanLC4fxfgTk1Z61Y6D1U7_I,152978
|
228
228
|
pyegeria/full_omag_server_config.py,sha256=CQqLCy_3DZFvJZEOcGf50HWdFaWpiAIs6z-kKyjvpDA,47464
|
229
|
-
pyegeria/glossary_browser_omvs.py,sha256=
|
229
|
+
pyegeria/glossary_browser_omvs.py,sha256=k0VfD9sB5CEf27cLxqpMheO5Rn5LcitcsQfKNEx4jbY,153382
|
230
230
|
pyegeria/glossary_manager_omvs.py,sha256=QojY-B0UMWzLoAzzLwPTScKhTQnYLdc4c9wkZljvokM,72206
|
231
231
|
pyegeria/m_test.py,sha256=M5-M2ZczsAJLXWfSeqTTADHdx6Ku-y4PbQ4M21JthAE,7778
|
232
232
|
pyegeria/md_processing_helpers.py,sha256=sV-ciVg_xOGVGTH_CMpH2B5k3V5jzdFp_XvnQQ5xafw,2131
|
233
|
-
pyegeria/md_processing_utils.py,sha256=
|
234
|
-
pyegeria/md_processing_utils_orig.py,sha256=
|
233
|
+
pyegeria/md_processing_utils.py,sha256=8TjD_ffnTMLEZEkb2npnZy59glboWFkaRh0OK_YN9cw,83314
|
234
|
+
pyegeria/md_processing_utils_orig.py,sha256=64eVP86__zI4EdzwveskDyLiw6EyWJXZW4pqk9aLpuM,52486
|
235
235
|
pyegeria/mermaid_utilities.py,sha256=sQqdFUWdNpHu9d3Tk9UVe80M-5bOzses0XcFYX5FF-E,54254
|
236
236
|
pyegeria/metadata_explorer_omvs.py,sha256=xHnZTQKbd6XwOhYia-RiIisrvZcqHi0SL1l6OCf04Gk,86911
|
237
237
|
pyegeria/my_profile_omvs.py,sha256=d0oJYCJG7pS9BINPuGciVa00ac0jwPHNANXDCLginEc,34720
|
@@ -245,8 +245,8 @@ pyegeria/template_manager_omvs.py,sha256=chBljs1vy5wr9DRAtbvIt4Cob_7HxGfxLkCNlDT
|
|
245
245
|
pyegeria/utils.py,sha256=GCt1C0bp0Xng1ahzbZhzV9qQwH7Dj93IaCt2dvWb-sg,5417
|
246
246
|
pyegeria/valid_metadata_omvs.py,sha256=Xq9DqBQvBFFJzaFIRKcVZ2k4gJvSh9yeXs_j-O3vn1w,65050
|
247
247
|
pyegeria/x_action_author_omvs.py,sha256=RcqSzahUKCtvb_3u_wyintAlc9WFkC_2v0E12TZs8lQ,6433
|
248
|
-
pyegeria-5.3.8.
|
249
|
-
pyegeria-5.3.8.
|
250
|
-
pyegeria-5.3.8.
|
251
|
-
pyegeria-5.3.8.
|
252
|
-
pyegeria-5.3.8.
|
248
|
+
pyegeria-5.3.8.8.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
249
|
+
pyegeria-5.3.8.8.dist-info/METADATA,sha256=pBubP-kEh2Sch13w9G8vU8BZoUzeyByX-qn5rgskY9o,2740
|
250
|
+
pyegeria-5.3.8.8.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
251
|
+
pyegeria-5.3.8.8.dist-info/entry_points.txt,sha256=eAvQ_vkejlF3JzMzEc5VD93ymLA_hSFV0HM8fntG-d8,6791
|
252
|
+
pyegeria-5.3.8.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|