pyegeria 5.3.8.8__py3-none-any.whl → 5.3.8.9__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 CHANGED
@@ -11,24 +11,10 @@ the server platform and servers.
11
11
 
12
12
  """
13
13
 
14
- from ._globals import (
15
- INTEGRATION_GUIDS,
16
- TEMPLATE_GUIDS,
17
- default_time_out,
18
- disable_ssl_warnings,
19
- enable_ssl_check,
20
- is_debug,
21
- max_paging_size,
22
- NO_ELEMENTS_FOUND,
23
- NO_ASSETS_FOUND,
24
- NO_SERVERS_FOUND,
25
- NO_CATALOGS_FOUND,
26
- NO_GLOSSARIES_FOUND,
27
- NO_TERMS_FOUND,
28
- NO_CATEGORIES_FOUND,
29
- NO_ELEMENT_FOUND,
30
- NO_PROJECTS_FOUND,
31
- )
14
+ from ._globals import (INTEGRATION_GUIDS, TEMPLATE_GUIDS, default_time_out, disable_ssl_warnings, enable_ssl_check,
15
+ is_debug, max_paging_size, NO_ELEMENTS_FOUND, NO_ASSETS_FOUND, NO_SERVERS_FOUND,
16
+ NO_CATALOGS_FOUND, NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_CATEGORIES_FOUND, NO_ELEMENT_FOUND,
17
+ NO_PROJECTS_FOUND, )
32
18
 
33
19
  if disable_ssl_warnings:
34
20
  from urllib3 import disable_warnings
@@ -38,22 +24,10 @@ if disable_ssl_warnings:
38
24
 
39
25
  from ._client import Client
40
26
  from ._deprecated_gov_engine import GovEng
41
- from ._exceptions import (
42
- InvalidParameterException,
43
- PropertyServerException,
44
- UserNotAuthorizedException,
45
- print_exception_response,
46
- )
47
- from ._validators import (
48
- is_json,
49
- validate_guid,
50
- validate_name,
51
- validate_public,
52
- validate_search_string,
53
- validate_server_name,
54
- validate_url,
55
- validate_user_id,
56
- )
27
+ from ._exceptions import (InvalidParameterException, PropertyServerException, UserNotAuthorizedException,
28
+ print_exception_response, )
29
+ from ._validators import (is_json, validate_guid, validate_name, validate_public, validate_search_string,
30
+ validate_server_name, validate_url, validate_user_id, )
57
31
  from .asset_catalog_omvs import AssetCatalog
58
32
  from .automated_curation_omvs import AutomatedCuration
59
33
  from .classification_manager_omvs import ClassificationManager
@@ -69,16 +43,8 @@ from .feedback_manager_omvs import FeedbackManager
69
43
  from .full_omag_server_config import FullServerConfig
70
44
  from .glossary_browser_omvs import GlossaryBrowser
71
45
  from .glossary_manager_omvs import GlossaryManager
72
- from .mermaid_utilities import (
73
- construct_mermaid_web,
74
- construct_mermaid_jup,
75
- generate_process_graph,
76
- load_mermaid,
77
- parse_mermaid_code,
78
- render_mermaid,
79
- save_mermaid_graph,
80
- save_mermaid_html,
81
- )
46
+ from .mermaid_utilities import (construct_mermaid_web, construct_mermaid_jup, generate_process_graph, load_mermaid,
47
+ parse_mermaid_code, render_mermaid, save_mermaid_graph, save_mermaid_html, )
82
48
  from .metadata_explorer_omvs import MetadataExplorer
83
49
  from .my_profile_omvs import MyProfile
84
50
  from .platform_services import Platform
@@ -91,12 +57,13 @@ from .utils import body_slimmer, print_response
91
57
  from .valid_metadata_omvs import ValidMetadataManager
92
58
  from .x_action_author_omvs import ActionAuthor
93
59
  from .md_processing_utils import (extract_command, process_glossary_upsert_command, process_term_upsert_command,
94
- process_category_upsert_command,
95
- get_current_datetime_string, process_per_proj_upsert_command, command_list,
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)
60
+ process_category_upsert_command, get_current_datetime_string,
61
+ process_per_proj_upsert_command, command_list, render_markdown,
62
+ process_provenance_command, process_blueprint_upsert_command,
63
+ process_solution_component_upsert_command, process_term_list_command,
64
+ process_glossary_list_command, process_category_list_command,
65
+ process_term_history_command, process_glossary_structure_command,
66
+ process_term_revision_history_command)
100
67
 
101
68
  #
102
69
  # The following assignments were generated by the `create_tech_guid_lists.py` utility that uses the pyegeria functions
@@ -482,6 +449,5 @@ INTEGRATION_GUIDS['OpenLineageCataloguer'] = '3347ac71-8dd2-403a-bc16-75a71be64b
482
449
  INTEGRATION_GUIDS['ApacheAtlasExchange'] = '5721627a-2dd4-4f95-a274-6cfb128edb97'
483
450
  INTEGRATION_GUIDS['HarvestSurveys'] = 'fae162c3-2bfd-467f-9c47-2e3b63a655de'
484
451
 
485
-
486
452
  if __name__ == "__main__":
487
453
  print("Main-Init")
@@ -13,7 +13,8 @@ from pyegeria import (extract_command, process_glossary_upsert_command, process_
13
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
- process_category_list_command, process_glossary_list_command, process_term_history_command)
16
+ process_category_list_command, process_glossary_list_command, process_term_history_command,
17
+ process_glossary_structure_command, process_term_revision_history_command,)
17
18
 
18
19
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
19
20
  EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
@@ -89,21 +90,20 @@ def process_markdown_file(file_path: str, directive: str, server: str, url: str,
89
90
  result = process_glossary_upsert_command(client, current_block, directive)
90
91
  elif potential_command in ["Create Category", "Update Category"]:
91
92
  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)
95
93
  elif potential_command in ["Create Term", "Update Term"]:
96
94
  result = process_term_upsert_command(client, current_block, directive)
97
95
  elif potential_command in ["List Term History", "Term History"]:
98
96
  result = process_term_history_command(client, current_block, directive)
97
+ elif potential_command in ["List Term Update History", "List Term Revision History"]:
98
+ result = process_term_revision_history_command(client, current_block, directive)
99
99
  elif potential_command in ["List Terms", "List Glossary Terms"]:
100
100
  result = process_term_list_command(client, current_block, directive)
101
101
  elif potential_command in ["List Categories", "List Glossary Categories"]:
102
- result = process_category_list_command(client, dr_egeria_state.get_element_dictionary(), current_block,
103
- directive)
102
+ result = process_category_list_command(client, current_block, directive)
103
+ elif potential_command in ["List Glossary Structure"]:
104
+ result = process_glossary_structure_command(client, current_block, directive)
104
105
  elif potential_command in ["List Glossaries"]:
105
- result = process_glossary_list_command(client, dr_egeria_state.get_element_dictionary(), current_block,
106
- directive)
106
+ result = process_glossary_list_command(client, current_block, directive)
107
107
  elif potential_command in ["Create Personal Project", "Update Personal Project"]:
108
108
  result = process_per_proj_upsert_command(client, current_block, directive)
109
109
  elif potential_command in ["Create Blueprint", "Update Blueprint", "Create Solution Blueprint",
@@ -640,11 +640,11 @@ class GlossaryBrowser(Client):
640
640
  output_format (str): Output format (FORM, REPORT, LIST, etc.)
641
641
 
642
642
  Returns:
643
- str: The parent category name or '---' if no parent
643
+ str: The parent category name or ' ' if no parent
644
644
  """
645
645
  parent_cat = self.get_category_parent(category_guid)
646
646
  if isinstance(parent_cat, str):
647
- return '---'
647
+ return ' '
648
648
 
649
649
  # Return qualified name for FORM output, display name for REPORT and LIST output
650
650
  if output_format == 'FORM':
@@ -3107,6 +3107,109 @@ class GlossaryBrowser(Client):
3107
3107
 
3108
3108
  return response
3109
3109
 
3110
+ def list_term_revision_history(self, term_guid: str, output_format: str = "DICT") -> list | str:
3111
+ """
3112
+ Retrieve the revision history for a term.
3113
+
3114
+ This method retrieves the revision logs associated with a term, and for each revision log,
3115
+ retrieves the revision history. The results are formatted according to the specified output format.
3116
+
3117
+ Parameters
3118
+ ----------
3119
+ term_guid : str
3120
+ The GUID of the glossary term to retrieve the revision history for.
3121
+ output_format : str, optional
3122
+ The format in which to return the results. Can be "DICT", "MD", or "LIST".
3123
+ Defaults to "DICT".
3124
+
3125
+ Returns
3126
+ -------
3127
+ list | str
3128
+ If output_format is "DICT", returns a list of dictionaries containing the revision history.
3129
+ If output_format is "MD", returns a markdown representation of the revision history.
3130
+ If output_format is "LIST", returns a markdown table of the revision history.
3131
+ If no revision logs are found, returns a string message "No revision logs found".
3132
+ """
3133
+ import re
3134
+ validate_guid(term_guid)
3135
+
3136
+ # Get revision logs for the term
3137
+ revision_logs = self.get_term_revision_logs(term_guid)
3138
+ if isinstance(revision_logs, str):
3139
+ return "No revision logs found"
3140
+
3141
+ # Process each revision log
3142
+ all_entries = []
3143
+ for log in revision_logs:
3144
+ log_guid = log['elementHeader']['guid']
3145
+ qualified_name = log.get('properties', {}).get('qualifiedName', '---')
3146
+
3147
+ # Get revision history for this log
3148
+ history = self.get_term_revision_history(log_guid)
3149
+ if isinstance(history, str):
3150
+ continue
3151
+
3152
+ # Process each entry in the history
3153
+ for entry in history:
3154
+ # Extract update time from the title
3155
+ title = entry.get('properties', {}).get('title', '---')
3156
+
3157
+ keyword_index = title.index('on')
3158
+ update_time = title[keyword_index + 2:].strip()
3159
+
3160
+ entry_data = {
3161
+ 'qualifiedName': qualified_name,
3162
+ 'title': title,
3163
+ 'text': entry.get('properties', {}).get('text', '---'),
3164
+ 'updateTime': update_time # Use extracted date/time or fall back to title
3165
+ }
3166
+ all_entries.append(entry_data)
3167
+
3168
+ # Sort entries by update time
3169
+ sorted_entries = sorted(all_entries, key=lambda x: x['updateTime'] if x['updateTime'] != '---' else '', reverse=True)
3170
+
3171
+ # Return in the specified format
3172
+ if output_format == "DICT":
3173
+ return sorted_entries
3174
+ elif output_format == "LIST":
3175
+ # Create markdown table
3176
+ if not sorted_entries:
3177
+ return "No revision entries found"
3178
+
3179
+ # Get headers
3180
+ headers = sorted_entries[0].keys()
3181
+
3182
+ # Create header row
3183
+ header_row = " | ".join(headers)
3184
+ separator_row = " | ".join(["---"] * len(headers))
3185
+
3186
+ # Create rows
3187
+ rows = []
3188
+ for entry in sorted_entries:
3189
+ row = " | ".join(str(entry.get(header, "---")) for header in headers)
3190
+ rows.append(row)
3191
+
3192
+ # Combine into table
3193
+ markdown_table = f"{header_row}\n{separator_row}\n" + "\n".join(rows)
3194
+ return markdown_table
3195
+ elif output_format == "MD":
3196
+ # Create markdown representation
3197
+ if not sorted_entries:
3198
+ return "No revision entries found"
3199
+
3200
+ md_output = "\n"
3201
+
3202
+ for entry in sorted_entries:
3203
+ md_output += f"* Note Log Name: \n{entry['qualifiedName']}\n\n"
3204
+ md_output += f"* Note Log Entry Title: \n{entry['title']}\n\n"
3205
+ md_output += f"* Note Log Entry: \n\t{entry['text']}\n\n"
3206
+ md_output += "---\n\n"
3207
+
3208
+ return md_output
3209
+ else:
3210
+ # Default to DICT format
3211
+ return sorted_entries
3212
+
3110
3213
 
3111
3214
  def list_full_term_history(self, term_guid: str, output_type: str = "DICT") -> list | str:
3112
3215
  """
@@ -3138,19 +3241,19 @@ class GlossaryBrowser(Client):
3138
3241
  return "No History Found"
3139
3242
  version_history = []
3140
3243
  for ver in history:
3141
- create_time = ver["elementHeader"]["versions"].get("createTime", "---")
3142
- update_time = ver["elementHeader"]["versions"].get("createTime", "---")
3143
- created_by = ver["elementHeader"]["versions"].get("createdBy", "---")
3244
+ create_time = ver["elementHeader"]["versions"].get("createTime", " ")
3245
+ update_time = ver["elementHeader"]["versions"].get("createTime", " ")
3246
+ created_by = ver["elementHeader"]["versions"].get("createdBy", " ")
3144
3247
  updated_by = ver["elementHeader"]["versions"].get("updatedBy", "---")
3145
3248
  version = ver["elementHeader"]["versions"].get("version")
3146
3249
 
3147
- qualified_name = ver["glossaryTermProperties"].get("qualifiedName", '---')
3148
- display_name = ver["glossaryTermProperties"].get("displayName", '---')
3149
- summary = ver["glossaryTermProperties"].get("summary", '---')
3150
- description = ver["glossaryTermProperties"].get("description", '---')
3151
- examples = ver["glossaryTermProperties"].get("examples", '---')
3152
- usage = ver["glossaryTermProperties"].get("usage", '---')
3153
- version_identifier = ver["glossaryTermProperties"].get("versionIdentifier", '---')
3250
+ qualified_name = ver["glossaryTermProperties"].get("qualifiedName", ' ')
3251
+ display_name = ver["glossaryTermProperties"].get("displayName", ' ')
3252
+ summary = ver["glossaryTermProperties"].get("summary", ' ')
3253
+ description = ver["glossaryTermProperties"].get("description", ' ')
3254
+ examples = ver["glossaryTermProperties"].get("examples", ' ')
3255
+ usage = ver["glossaryTermProperties"].get("usage", ' ')
3256
+ version_identifier = ver["glossaryTermProperties"].get("versionIdentifier", ' ')
3154
3257
 
3155
3258
  version_history.append({
3156
3259
  "version": version, "displayName": display_name, "summary": summary, "created": create_time,
@@ -3178,6 +3281,8 @@ class GlossaryBrowser(Client):
3178
3281
  # Combine everything into a Markdown table string
3179
3282
  markdown_table = f"{header_row}\n{separator_row}\n" + "\n".join(rows)
3180
3283
  return markdown_table
3284
+ else:
3285
+ return None
3181
3286
 
3182
3287
  async def _async_find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
3183
3288
  effective_time: str = None, starts_with: bool = False, ends_with: bool = False, ignore_case: bool = False,
@@ -4,7 +4,7 @@ This file contains functions to parse and process Egeria Markdown (Freddie)
4
4
 
5
5
 
6
6
  """
7
-
7
+ import json
8
8
  import os
9
9
  import re
10
10
  import sys
@@ -16,8 +16,7 @@ from rich.console import Console
16
16
  from rich.markdown import Markdown
17
17
 
18
18
  from pyegeria import body_slimmer
19
- from pyegeria._globals import (NO_GLOSSARIES_FOUND, NO_ELEMENTS_FOUND, NO_PROJECTS_FOUND, \
20
- NO_CATEGORIES_FOUND)
19
+ from pyegeria._globals import (NO_GLOSSARIES_FOUND, NO_ELEMENTS_FOUND, NO_PROJECTS_FOUND, NO_CATEGORIES_FOUND)
21
20
  from pyegeria.dr_egeria_state import get_element_dictionary, update_element_dictionary, find_key_with_value
22
21
  from pyegeria.egeria_tech_client import EgeriaTech
23
22
  # from pyegeria.md_processing_helpers import process_q_name_list
@@ -27,12 +26,11 @@ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "170"))
27
26
  console = Console(width=EGERIA_WIDTH)
28
27
 
29
28
  command_list = ["Provenance", "Create Glossary", "Update Glossary", "Create Term", "Update Term", "List Terms",
30
- "List Glossary Terms", "List Term History", "Term Journal Report", "List Glossary Structure",
31
- "List Glossaries", "List Categories", "List Glossary Categories",
32
- "Create Personal Project", "Update Personal Project", "Create Category",
33
- "Update Category", "Create Solution Blueprint", "Update Solution Blueprint",
34
- "Create Solution Component", "Update Solution Component", "Update Category Structure",
35
- ]
29
+ "List Glossary Terms", "List Term History", "List Term Revision History", "List Term Update History",
30
+ "List Glossary Structure", "List Glossaries", "List Categories", "List Glossary Categories",
31
+ "Create Personal Project", "Update Personal Project", "Create Category", "Update Category",
32
+ "Create Solution Blueprint", "Update Solution Blueprint", "Create Solution Component",
33
+ "Update Solution Component", ]
36
34
  # verbosity - verbose, quiet, debug
37
35
  debug_level = "debug"
38
36
  message_types = {
@@ -51,7 +49,8 @@ GLOSSARY_NAME_LABELS = ["Glossary Name", "Glossary", "Glossaries", "Owning Gloss
51
49
  CATEGORY_NAME_LABELS = ["Glossary Category Name", "Glossary Category", "Glossary Categories", "Category Name",
52
50
  "Category", "Categories"]
53
51
  PARENT_CATEGORY_LABELS = ["Parent Category Name", "Parent Category", "parent category name", "parent category"]
54
- CHILD_CATEGORY_LABELS = ["Child Categories", "Child Category", "child category names", "child categories", "Child Category Names"]
52
+ CHILD_CATEGORY_LABELS = ["Child Categories", "Child Category", "child category names", "child categories",
53
+ "Child Category Names"]
55
54
  TERM_NAME_LABELS = ["Glossary Term Name", "Glossary Term", "Glossary Terms", "Term Name", "Term", "Terms", "Term Names"]
56
55
  PROJECT_NAME_LABELS = ["Project Name", "Project", "Project Names", "Projects"]
57
56
  BLUEPRINT_NAME_LABELS = ["Solution Blueprint Name", "Solution Blueprint", "Solution Blueprints", "Blueprint Name",
@@ -65,8 +64,12 @@ SOLUTION_ACTOR_ROLE_LABELS = ["Solution Actor Role Name", "Solution Actor Role N
65
64
  SOLUTION_LINKING_ROLE_LABELS = ["Solution Linking Role Name", "Solution Linking Role Names", "Solution Linking Role",
66
65
  "Solution Linking Roles", "Linking Role Name", "Linking Role", "Linking Roles",
67
66
  "Linking Role Names"]
67
+ OUTPUT_LABELS = ["Output", "Output Format"]
68
+ SEARCH_LABELS = ['Search String', 'Filter']
68
69
  GUID_LABELS = ['GUID', 'guid']
69
70
 
71
+ ELEMENT_OUTPUT_FORMATS = ["LIST", "DICT", "MD", "FORM", "REPORT"]
72
+
70
73
 
71
74
  def render_markdown(markdown_text: str) -> None:
72
75
  """Renders the given markdown text in the console."""
@@ -152,12 +155,13 @@ def update_term_categories(egeria_client: EgeriaTech, term_guid: str, categories
152
155
  egeria_client.remove_term_from_category(term_guid, cat)
153
156
  msg = f"Removed term {term_guid} from category {cat}"
154
157
  print_msg("DEBUG-INFO", msg, debug_level)
155
- else: # No categories specified - so remove any categories a term is in
158
+ else: # No categories specified - so remove any categories a term is in
156
159
  for cat in current_categories:
157
160
  egeria_client.remove_term_from_category(term_guid, cat)
158
161
  msg = f"Removed term {term_guid} from category {cat}"
159
162
  print_msg("DEBUG-INFO", msg, debug_level)
160
163
 
164
+
161
165
  def extract_command_plus(block: str) -> tuple[str, str, str] | None:
162
166
  """
163
167
  Extracts a multi-word object and its associated action from the given block of text.
@@ -291,7 +295,7 @@ def print_msg(msg_level: str, msg: str, verbosity: str):
291
295
  sys.exit(1)
292
296
 
293
297
 
294
- def process_simple_attribute(txt: str, labels: [str], if_missing: str = INFO) -> str | None:
298
+ def process_simple_attribute(txt: str, labels: list[str], if_missing: str = INFO) -> str | None:
295
299
  """Process a simple attribute based on the provided labels and if_missing value.
296
300
  Extract the attribute value from the text and return it if it exists.
297
301
  If it doesn`t exist, return None and print an error message with severity of if_missing.
@@ -531,17 +535,17 @@ def get_element_by_name(egeria_client, element_type: str, element_name: str) ->
531
535
  unique = True
532
536
  return el_qname, el_guid, unique, exists
533
537
 
534
- # Convert element_type to plural form for method name construction # if element_type.endswith('y'): # #
535
- # plural_type = f"{element_type[:-1]}ies" # elif element_type.endswith('s'): # plural_type = f"{ #
538
+ # Convert element_type to plural form for method name construction # if element_type.endswith('y'): # # #
539
+ # plural_type = f"{element_type[:-1]}ies" # elif element_type.endswith('s'): # plural_type = f"{ # #
536
540
  # element_type}es" # else: # plural_type = f"{element_type}s" # # # Construct method name # method_name
537
541
  # = f"get_{plural_type}_by_name" # # # Check if the method exists on the client # if hasattr(egeria_client,
538
542
  # method_name): # # Call the method # method = getattr(egeria_client, method_name) # result = #
539
- # method(element_name) # return result # else: # # Method doesn't exist # return f"Method { #
543
+ # method(element_name) # return result # else: # # Method doesn't exist # return f"Method { # #
540
544
  # method_name} not found on client"
541
545
 
542
546
 
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:
547
+ def process_name_list(egeria_client: EgeriaTech, element_type: str, txt: str, element_labels: list[str]) -> tuple[str,
548
+ list[Any], bool | Any, bool | None | Any] | None:
545
549
  """
546
550
  Processes a list of names specified in the given text, retrieves details for each
547
551
  element based on the provided type, and generates a list of valid qualified names.
@@ -678,11 +682,11 @@ def process_blueprint_upsert_command(egeria_client: EgeriaTech, txt: str, direct
678
682
  print_msg("ALWAYS", msg, debug_level)
679
683
 
680
684
  # update with get blueprint by guid
681
- return 'Would return get blueprint by guid and return md' # egeria_client.get_term_by_guid( #
685
+ return 'Would return get blueprint by guid and return md' # egeria_client.get_term_by_guid( # #
682
686
  # known_guid, 'md')
683
687
 
684
688
  elif object_action == "Update" and directive == "validate":
685
- return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_term_by_guid( #
689
+ return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_term_by_guid( # #
686
690
  # known_guid, 'md')
687
691
 
688
692
  elif object_action == "Create":
@@ -711,7 +715,8 @@ def process_blueprint_upsert_command(egeria_client: EgeriaTech, txt: str, direct
711
715
  return None
712
716
 
713
717
 
714
- def process_solution_component_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
718
+ def process_solution_component_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> \
719
+ Optional[str]:
715
720
  """
716
721
  Processes a solution componentt create or update command by extracting key attributes such as
717
722
  solution component name, description, version, solution component type etc from the given cell.
@@ -757,9 +762,8 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, txt: st
757
762
  if solution_blueprints: # Find information about blueprints that include this component
758
763
  msg = "Checking for blueprints that include this solution component"
759
764
  print_msg("DEBUG-INFO", msg, debug_level)
760
- solution_blueprints, bp_qname_list, bp_valid, bp_exist = process_name_list(egeria_client,
761
- 'Solution Blueprints', txt,
762
- BLUEPRINT_NAME_LABELS)
765
+ solution_blueprints, bp_qname_list, bp_valid, bp_exist = process_name_list(egeria_client, 'Solution Blueprints',
766
+ txt, BLUEPRINT_NAME_LABELS)
763
767
  if bp_exist and bp_valid:
764
768
  msg = f"Found valid blueprints that include this solution component:\n\t{solution_blueprints}"
765
769
  print_msg("INFO", msg, debug_level)
@@ -770,8 +774,8 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, txt: st
770
774
  msg = f"Parent Components are missing"
771
775
  print_msg("INFO", msg, debug_level)
772
776
  else:
773
- parent_components, parent_qname_list, parents_valid, parent_components_exist = process_name_list(
774
- egeria_client, 'Parent Components', txt, COMPONENT_NAME_LABELS)
777
+ parent_components, parent_qname_list, parents_valid, parent_components_exist = process_name_list(egeria_client,
778
+ 'Parent Components', txt, COMPONENT_NAME_LABELS)
775
779
  if parent_components_exist and parents_valid:
776
780
  msg = f"Found valid parent components that include this solution component:\n\t{parent_qname_list}"
777
781
  print_msg("INFO", msg, debug_level)
@@ -844,11 +848,11 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, txt: st
844
848
  msg = f"\nUpdated Solution Component `{display_name}` with GUID {known_guid}"
845
849
  print_msg("ALWAYS", msg, debug_level)
846
850
  # update with get solution component by guid
847
- return 'Would return get Solution Component by guid and return md' # #
851
+ return 'Would return get Solution Component by guid and return md' # # #
848
852
  # egeria_client.get_term_by_guid(known_guid, 'md')
849
853
 
850
854
  elif object_action == "Update" and directive == "validate":
851
- return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_term_by_guid( #
855
+ return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_term_by_guid( # #
852
856
  # known_guid, 'md')
853
857
 
854
858
  elif object_action == "Create":
@@ -866,7 +870,7 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, txt: st
866
870
  msg = f"\nCreated Solution Component `{display_name}` with GUID {known_guid}"
867
871
  print_msg("ALWAYS", msg, debug_level)
868
872
  update_element_dictionary(known_q_name, {'guid': known_guid, 'display_name': display_name})
869
- return 'Would return get solution component by guid results as md' # #
873
+ return 'Would return get solution component by guid results as md' # # #
870
874
  # egeria_client.get_term_by_guid(term_guid, 'MD')
871
875
 
872
876
  except Exception as e:
@@ -960,9 +964,8 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, txt: str, directi
960
964
 
961
965
  if object_action == "Update":
962
966
  if not glossary_exists:
963
- print(
964
- f"\n{ERROR}Glossary `{glossary_name}` does not exist! Updating result document with Create "
965
- f"command\n")
967
+ print(f"\n{ERROR}Glossary `{glossary_name}` does not exist! Updating result document with Create "
968
+ f"command\n")
966
969
  return update_a_command(txt, command, object_type, known_q_name, known_guid)
967
970
 
968
971
  body = {
@@ -996,6 +999,10 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, txt: str, directi
996
999
  # return update_a_command(txt, command, object_type, qualified_name, glossary_guid)
997
1000
  print_msg(ALWAYS, f"Created Glossary `{glossary_name}` with GUID {glossary_guid}", debug_level)
998
1001
  return egeria_client.get_glossary_by_guid(glossary_guid, output_format='MD')
1002
+ else:
1003
+ return None
1004
+ else:
1005
+ return None
999
1006
 
1000
1007
 
1001
1008
  def process_category_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
@@ -1022,7 +1029,6 @@ def process_category_upsert_command(egeria_client: EgeriaTech, txt: str, directi
1022
1029
 
1023
1030
  parent_category_name = process_simple_attribute(txt, PARENT_CATEGORY_LABELS, "INFO")
1024
1031
 
1025
-
1026
1032
  element_labels = CATEGORY_NAME_LABELS
1027
1033
  element_labels.append('Display Name')
1028
1034
  # Check if category exists (and get qname and guid)
@@ -1036,7 +1042,6 @@ def process_category_upsert_command(egeria_client: EgeriaTech, txt: str, directi
1036
1042
  element_labels, txt,
1037
1043
  object_action, None)
1038
1044
 
1039
-
1040
1045
  # Check if owning glossary exists (and get qname)
1041
1046
  if owning_glossary_name is None:
1042
1047
  valid = False
@@ -1047,8 +1052,8 @@ def process_category_upsert_command(egeria_client: EgeriaTech, txt: str, directi
1047
1052
  egeria_client, "Glossary", GLOSSARY_NAME_LABELS, txt, EXISTS_REQUIRED, None)
1048
1053
 
1049
1054
  if parent_category_name:
1050
- _, parent_guid, parent_valid, parent_exists = get_element_by_name(
1051
- egeria_client, 'Glossary Categories', parent_category_name)
1055
+ _, parent_guid, parent_valid, parent_exists = get_element_by_name(egeria_client, 'Glossary Categories',
1056
+ parent_category_name)
1052
1057
  else:
1053
1058
  parent_guid = None
1054
1059
  parent_exists = False
@@ -1120,9 +1125,9 @@ def process_category_upsert_command(egeria_client: EgeriaTech, txt: str, directi
1120
1125
  })
1121
1126
  print_msg(ALWAYS, f"Updated Category `{category_name}` with GUID {known_guid}", debug_level)
1122
1127
 
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)
1128
+ category_sync = update_category_parent(egeria_client, known_guid, parent_category_name)
1129
+ print_msg(ALWAYS, f"Updated Category hierarchy for `{category_name}` with outcome {category_sync}",
1130
+ debug_level)
1126
1131
  return egeria_client.get_category_by_guid(known_guid, output_format='FORM')
1127
1132
 
1128
1133
  elif object_action == "Create":
@@ -1149,9 +1154,12 @@ def process_category_upsert_command(egeria_client: EgeriaTech, txt: str, directi
1149
1154
  print_msg(ALWAYS, f"Created Category `{category_name}` with GUID {category_guid}", debug_level)
1150
1155
  if parent_valid & parent_exists:
1151
1156
  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)
1157
+ print_msg(ALWAYS, f"Set parent category for `{category_name}` to `{parent_category_name}`",
1158
+ debug_level)
1153
1159
  else:
1154
- print_msg(ERROR, f"Parent category `{parent_category_name}` not found or invalid for `{category_name}`", debug_level)
1160
+ print_msg(ERROR,
1161
+ f"Parent category `{parent_category_name}` not found or invalid for `{category_name}`",
1162
+ debug_level)
1155
1163
  return egeria_client.get_category_by_guid(category_guid, output_format='FORM')
1156
1164
  return None
1157
1165
  return None
@@ -1189,8 +1197,8 @@ def update_category_parent(egeria_client, category_guid: str, parent_category_na
1189
1197
 
1190
1198
  if isinstance(current_parent, str) and "No Parent Category found" in current_parent:
1191
1199
  # 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)
1200
+ _, parent_guid, _, parent_exists = get_element_by_name(egeria_client, 'Glossary Categories',
1201
+ parent_category_name)
1194
1202
 
1195
1203
  if parent_exists and parent_guid:
1196
1204
  egeria_client.set_parent_category(parent_guid, category_guid)
@@ -1210,12 +1218,14 @@ def update_category_parent(egeria_client, category_guid: str, parent_category_na
1210
1218
  egeria_client.remove_parent_category(current_parent_guid, category_guid)
1211
1219
 
1212
1220
  # 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)
1221
+ _, parent_guid, _, parent_exists = get_element_by_name(egeria_client, 'Glossary Categories',
1222
+ parent_category_name)
1215
1223
 
1216
1224
  if parent_exists and parent_guid:
1217
1225
  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)
1226
+ print_msg(ALWAYS,
1227
+ f"Updated parent category from `{current_parent_name}` to `{parent_category_name}`",
1228
+ debug_level)
1219
1229
  else:
1220
1230
  print_msg(ERROR, f"Parent category `{parent_category_name}` not found", debug_level)
1221
1231
  outcome = False
@@ -1232,43 +1242,39 @@ def update_category_parent(egeria_client, category_guid: str, parent_category_na
1232
1242
  egeria_client.remove_parent_category(current_parent_guid, category_guid)
1233
1243
  print_msg(ALWAYS, f"Removed parent category `{current_parent_name}`", debug_level)
1234
1244
 
1235
-
1236
1245
  return outcome
1237
1246
 
1238
1247
 
1239
-
1240
-
1241
1248
  def process_term_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
1242
1249
  """ List terms as a markdown table. Filter based on optional search string. """
1243
1250
  set_debug_level(directive)
1244
1251
  valid = True
1245
1252
  command = extract_command(txt)
1246
- object_type = command.split(' ')[1].strip()
1247
- object_action = command.split(' ')[0].strip()
1248
- known_glossary_q = ""
1249
- known_glossary_guid = ""
1250
- glossary_exists = False
1251
- glossary_valid = False
1252
-
1253
1253
 
1254
- search_string = process_simple_attribute(txt, ['Search String', 'Filter'])
1254
+ search_string = process_simple_attribute(txt, SEARCH_LABELS)
1255
1255
  if search_string is None:
1256
1256
  search_string = '*'
1257
1257
  print(Markdown(f"{pre_command} `{command}` with search string:`{search_string}` with directive: `{directive}`"))
1258
1258
 
1259
1259
  glossary = process_simple_attribute(txt, ['Glossary', 'In Glossary'])
1260
1260
  if glossary is not None:
1261
- _, glossary_guid, _, glossary_exists = get_element_by_name(
1262
- egeria_client, "Glossary", glossary)
1261
+ _, glossary_guid, _, glossary_exists = get_element_by_name(egeria_client, "Glossary", glossary)
1263
1262
  msg = f"Found glossary `{glossary}` with GUID {glossary_guid}"
1264
1263
  print_msg(INFO, msg, debug_level)
1265
1264
  else:
1266
- glossary_guid= None
1265
+ glossary_guid = None
1267
1266
  msg = f"No glossary found"
1268
1267
  print_msg(INFO, msg, debug_level)
1269
1268
 
1269
+ output_format = process_simple_attribute(txt, OUTPUT_LABELS)
1270
+ if output_format is None:
1271
+ output_format = "LIST"
1272
+ elif output_format not in ELEMENT_OUTPUT_FORMATS:
1273
+ valid = False
1274
+ print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
1270
1275
 
1271
- request_display = f"\n* Search String: {search_string}\n* Glossary: {glossary}\n"
1276
+ request_display = (f"\n\t* Search String: {search_string}\n\t* Glossary: {glossary}\n\t* Output Format: "
1277
+ f"{output_format}\n")
1272
1278
 
1273
1279
  if directive == "display":
1274
1280
  print(Markdown(request_display))
@@ -1282,47 +1288,49 @@ def process_term_list_command(egeria_client: EgeriaTech, txt: str, directive: st
1282
1288
  if not valid: # First validate the term before we process it
1283
1289
  return None
1284
1290
 
1285
- md_table = egeria_client.find_glossary_terms(search_string,glossary_guid, output_format = "LIST")
1291
+ term_list_md = f"\n# Term List for search string: `{search_string}`\n\n"
1292
+ if output_format == "DICT":
1293
+ struct = egeria_client.find_glossary_terms(search_string, glossary_guid, output_format=output_format)
1294
+ term_list_md += f"{json.dumps(struct, indent=4)}\n"
1295
+ else:
1296
+ term_list_md += egeria_client.find_glossary_terms(search_string, glossary_guid, output_format=output_format)
1297
+ print_msg("ALWAYS", f"Wrote Term List for search string: `{search_string}`", debug_level)
1298
+
1299
+ return term_list_md
1300
+
1301
+
1302
+ md_table = egeria_client.find_glossary_terms(search_string, glossary_guid, output_format=output_format)
1286
1303
 
1304
+ print_msg("ALWAYS", f"Wrote Term list for search string `{search_string}`", debug_level)
1287
1305
  return md_table
1288
1306
 
1289
1307
  except Exception as e:
1290
- print(f"{ERROR}Error creating Glossary Term list: {e}")
1308
+ print(f"{ERROR}Error performing {command}: {e}")
1291
1309
  console.print_exception(show_locals=True)
1292
1310
  return None
1311
+ else:
1312
+ return None
1293
1313
 
1294
- def process_category_list_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
1295
- directive: str = "display") -> Optional[str]:
1314
+
1315
+ def process_category_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
1296
1316
  """ List terms as a markdown table. Filter based on optional search string. """
1297
1317
  set_debug_level(directive)
1298
1318
  valid = True
1299
1319
  command = extract_command(txt)
1300
- object_type = command.split(' ')[1].strip()
1301
- object_action = command.split(' ')[0].strip()
1302
- known_glossary_q = ""
1303
- known_glossary_guid = ""
1304
- glossary_exists = False
1305
- glossary_valid = False
1306
-
1307
1320
 
1308
- search_string = process_simple_attribute(txt, ['Search String', 'Filter'])
1321
+ search_string = process_simple_attribute(txt, SEARCH_LABELS, "INFO")
1309
1322
  if search_string is None:
1310
1323
  search_string = '*'
1311
1324
  print(Markdown(f"{pre_command} `{command}` with search string:`{search_string}` with directive: `{directive}`"))
1312
1325
 
1313
- # glossary = process_simple_attribute(txt, ['Glossary', 'In Glossary'])
1314
- # if glossary is not None:
1315
- # _, glossary_guid, _, glossary_exists = get_element_by_name(
1316
- # egeria_client, "Glossary", glossary)
1317
- # msg = f"Found glossary `{glossary}` with GUID {glossary_guid}"
1318
- # print_msg(INFO, msg, debug_level)
1319
- # else:
1320
- # glossary_guid= None
1321
- # msg = f"No glossary found"
1322
- # print_msg(INFO, msg, debug_level)
1323
-
1326
+ output_format = process_simple_attribute(txt, OUTPUT_LABELS, "INFO")
1327
+ if output_format is None:
1328
+ output_format = "LIST"
1329
+ elif output_format not in ELEMENT_OUTPUT_FORMATS:
1330
+ valid = False
1331
+ print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
1324
1332
 
1325
- request_display = f"\n* Search String: {search_string}\n"
1333
+ request_display = f"\n\t* Search String: {search_string}\n\t* Output Format: {output_format}\n"
1326
1334
 
1327
1335
  if directive == "display":
1328
1336
  print(Markdown(request_display))
@@ -1335,36 +1343,102 @@ def process_category_list_command(egeria_client: EgeriaTech, element_dictionary:
1335
1343
  print(Markdown(request_display))
1336
1344
  if not valid: # First validate the term before we process it
1337
1345
  return None
1338
- md_table = egeria_client.find_glossary_categories(search_string, output_format = "LIST")
1339
1346
 
1340
- return md_table
1347
+ cat_list_md = f"\n# Category List for search string: `{search_string}`\n\n"
1348
+ if output_format == "DICT":
1349
+ struct = egeria_client.find_glossary_categories(search_string, output_format=output_format)
1350
+ cat_list_md += f"{json.dumps(struct, indent=4)}\n"
1351
+ else:
1352
+ cat_list_md += egeria_client.find_glossary_categories(search_string, output_format=output_format)
1353
+ print_msg("ALWAYS", f"Wrote Category List for search string: `{search_string}`", debug_level)
1354
+
1355
+ return cat_list_md
1341
1356
 
1342
1357
  except Exception as e:
1343
- print(f"{ERROR}Error creating Glossary Category list: {e}")
1358
+ print(f"{ERROR}Error performing {command}: {e}")
1344
1359
  console.print_exception(show_locals=True)
1345
1360
  return None
1361
+ else:
1362
+
1363
+ return None
1346
1364
 
1347
- def process_glossary_list_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
1348
- directive: str = "display") -> Optional[str]:
1365
+
1366
+ def process_glossary_structure_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[
1367
+ str]:
1349
1368
  """ List terms as a markdown table. Filter based on optional search string. """
1350
1369
  set_debug_level(directive)
1351
1370
  valid = True
1352
1371
  command = extract_command(txt)
1353
- object_type = command.split(' ')[1].strip()
1354
- object_action = command.split(' ')[0].strip()
1355
- known_glossary_q = ""
1372
+
1356
1373
  known_glossary_guid = ""
1357
- glossary_exists = False
1358
- glossary_valid = False
1359
1374
 
1375
+ glossary_name = process_simple_attribute(txt, GLOSSARY_NAME_LABELS, "ERROR")
1360
1376
 
1361
- search_string = process_simple_attribute(txt, ['Search String', 'Filter'])
1377
+ _, known_glossary_guid, valid, _ = process_element_identifiers(egeria_client, "Glossary", GLOSSARY_NAME_LABELS, txt,
1378
+ EXISTS_REQUIRED, None)
1379
+
1380
+ print(Markdown(f"{pre_command} `{command}` for glossary:`{glossary_name}` with directive: `{directive}`"))
1381
+
1382
+ output_format = process_simple_attribute(txt, OUTPUT_LABELS, "INFO")
1383
+ if output_format is None:
1384
+ output_format = "MD"
1385
+ elif output_format not in ["DICT", "LIST", "MD"]:
1386
+ valid = False
1387
+ print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
1388
+
1389
+ request_display = f"\n\t* Glossary name: {glossary_name}\n\t* Output Format: {output_format}\n"
1390
+
1391
+ if directive == "display":
1392
+ print(Markdown(request_display))
1393
+ return None
1394
+ elif directive == "validate":
1395
+ print(Markdown(request_display))
1396
+ return str(valid)
1397
+ elif directive == "process":
1398
+ try:
1399
+ print(Markdown(request_display))
1400
+ if not valid: # First validate the term before we process it
1401
+ return None
1402
+
1403
+ glossary_structure_md = f"\n# Glossary Structure for `{glossary_name}`\n\n"
1404
+ if output_format == "DICT":
1405
+ struct = egeria_client.get_glossary_category_structure(known_glossary_guid, output_format=output_format)
1406
+ glossary_structure_md += f"{json.dumps(struct, indent=4)}\n"
1407
+ else:
1408
+ glossary_structure_md += egeria_client.get_glossary_category_structure(known_glossary_guid, output_format=output_format)
1409
+ print_msg("ALWAYS", f"Wrote Glossary Structure for glossary: `{glossary_name}`", debug_level)
1410
+
1411
+ return glossary_structure_md
1412
+
1413
+ except Exception as e:
1414
+ print(f"{ERROR}Error performing {command}: {e}")
1415
+ console.print_exception(show_locals=True)
1416
+ return None
1417
+ else:
1418
+ return None
1419
+
1420
+
1421
+ def process_glossary_list_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
1422
+ """ List terms as a markdown table. Filter based on optional search string. """
1423
+ set_debug_level(directive)
1424
+ valid = True
1425
+ command = extract_command(txt)
1426
+
1427
+ search_string = process_simple_attribute(txt, SEARCH_LABELS, "INFO")
1362
1428
  if search_string is None:
1363
1429
  search_string = '*'
1364
1430
  print(Markdown(f"{pre_command} `{command}` with search string:`{search_string}` with directive: `{directive}`"))
1431
+ if search_string is None:
1432
+ search_string = '*'
1365
1433
 
1434
+ output_format = process_simple_attribute(txt, OUTPUT_LABELS, "INFO")
1435
+ if output_format is None:
1436
+ output_format = "LIST"
1437
+ elif output_format not in ELEMENT_OUTPUT_FORMATS:
1438
+ valid = False
1439
+ print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
1366
1440
 
1367
- request_display = f"\n* Search String: {search_string}\n"
1441
+ request_display = f"\n\t* Search String: {search_string}\n\t* Output Format: {output_format}\n"
1368
1442
 
1369
1443
  if directive == "display":
1370
1444
  print(request_display)
@@ -1378,14 +1452,23 @@ def process_glossary_list_command(egeria_client: EgeriaTech, element_dictionary:
1378
1452
  if not valid: # First validate the term before we process it
1379
1453
  return None
1380
1454
 
1381
- md_table = egeria_client.find_glossaries(search_string, output_format = "LIST")
1455
+ glossary_list_md = f"\n# Glossary List for `{search_string}`\n\n"
1456
+ if output_format == "DICT":
1457
+ struct = egeria_client.find_glossaries(search_string, output_format=output_format)
1458
+ glossary_list_md += f"{json.dumps(struct, indent=4)}\n"
1459
+ else:
1460
+ glossary_list_md += egeria_client.find_glossaries(search_string, output_format=output_format)
1461
+ print_msg("ALWAYS", f"Wrote Glossary List for search string: `{search_string}`", debug_level)
1382
1462
 
1383
- return md_table
1463
+ return glossary_list_md
1384
1464
 
1385
1465
  except Exception as e:
1386
- print(f"{ERROR}Error creating Glossary list: {e}")
1466
+ print(f"{ERROR}Error performing {command}: {e}")
1387
1467
  console.print_exception(show_locals=True)
1388
1468
  return None
1469
+ else:
1470
+ return None
1471
+
1389
1472
 
1390
1473
  def process_term_history_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
1391
1474
  """ List terms as a markdown table. Filter based on optional search string. """
@@ -1399,16 +1482,20 @@ def process_term_history_command(egeria_client: EgeriaTech, txt: str, directive:
1399
1482
  element_labels.append('Display Name')
1400
1483
 
1401
1484
  term_name = process_simple_attribute(txt, element_labels, "ERROR")
1402
- print(Markdown(f"{pre_command} `{command}` for term: `\'{term_name}\'` with directive: `{directive}` "))
1403
1485
 
1404
1486
  known_q_name, known_guid, valid, term_exists = process_element_identifiers(egeria_client, object_type,
1405
- element_labels, txt, object_action,
1406
- )
1487
+ element_labels, txt, object_action, )
1407
1488
 
1408
1489
  print(Markdown(f"{pre_command} `{command}` for term:`{term_name}` with directive: `{directive}`"))
1409
1490
 
1491
+ output_format = process_simple_attribute(txt, OUTPUT_LABELS, "INFO")
1492
+ if output_format is None:
1493
+ output_format = "LIST"
1494
+ elif output_format not in ["DICT", "LIST"]:
1495
+ valid = False
1496
+ print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
1410
1497
 
1411
- request_display = f"\n\t* Term Name: {term_name}\n\t* Qualified Name: {known_q_name}\n\t* GUID: {known_guid}\n"
1498
+ request_display = f"\n\t* Term Name: {term_name}\n\t* Output Format {output_format}\n\t* GUID: {known_guid}\n"
1412
1499
 
1413
1500
  if directive == "display":
1414
1501
  print(request_display)
@@ -1422,16 +1509,76 @@ def process_term_history_command(egeria_client: EgeriaTech, txt: str, directive:
1422
1509
  if not valid: # First validate the term before we process it
1423
1510
  return None
1424
1511
  term_history_md = f"\n# Term History for `{term_name}`\n\n"
1425
- term_history_md += egeria_client.list_full_term_history(known_guid, 'LIST')
1512
+ if output_format == "DICT":
1513
+ struct = egeria_client.list_term_revision_history(known_guid, output_format=output_format)
1514
+ term_history_md += f"{json.dumps(struct, indent=4)}\n"
1515
+ else:
1516
+ term_history_md += egeria_client.list_full_term_history(known_guid, output_format)
1517
+ print_msg("ALWAYS", f"Wrote Term History for term `{term_name}`", debug_level)
1426
1518
 
1427
1519
  return term_history_md
1428
1520
 
1429
1521
  except Exception as e:
1430
- print(f"{ERROR}Error creating Glossary list: {e}")
1522
+ print(f"{ERROR}Error performing {command}: {e}")
1431
1523
  console.print_exception(show_locals=True)
1432
1524
  return None
1525
+ else:
1526
+ return None
1433
1527
 
1434
1528
 
1529
+ def process_term_revision_history_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[
1530
+ str]:
1531
+ """ List term revision history as a markdown table or list."""
1532
+ set_debug_level(directive)
1533
+ valid = True
1534
+ command = extract_command(txt)
1535
+ object_type = command.split(' ')[1].strip()
1536
+ object_action = command.split(' ')[0].strip()
1537
+ known_q_name = None
1538
+ known_guid = None
1539
+
1540
+ element_labels = TERM_NAME_LABELS
1541
+
1542
+ term_name = process_simple_attribute(txt, element_labels, "ERROR")
1543
+ print(Markdown(f"{pre_command} `{command}` for term: `{term_name}` with directive: `{directive}` "))
1544
+
1545
+ known_q_name, known_guid, valid, _ = process_element_identifiers(egeria_client, object_type, element_labels, txt,
1546
+ object_action, )
1547
+ output_format = process_simple_attribute(txt, ['Output Format', 'Format'], 'INFO')
1548
+ if output_format is None:
1549
+ output_format = "LIST"
1550
+ elif output_format not in ["DICT", "LIST", "MD"]:
1551
+ valid = False
1552
+ print_msg(ERROR, f"Invalid output format: `{output_format}`", debug_level)
1553
+
1554
+ request_display = f"\n\t* Term Name: {term_name}\n\t* Output Format: {output_format}\n"
1555
+
1556
+ if directive == "display":
1557
+ print(request_display)
1558
+ return None
1559
+ elif directive == "validate":
1560
+ print(request_display)
1561
+ return str(valid)
1562
+ elif directive == "process":
1563
+ try:
1564
+ print(request_display)
1565
+ if not valid: # First validate the term before we process it
1566
+ return None
1567
+ term_history_md = f"\n# Term Revision History for `{term_name}`\n\n"
1568
+ if output_format == "DICT":
1569
+ struct = egeria_client.list_term_revision_history(known_guid, output_format)
1570
+ term_history_md += f"{json.dumps(struct, indent=4)}\n"
1571
+ else:
1572
+ term_history_md += egeria_client.list_term_revision_history(known_guid, output_format)
1573
+ print_msg("ALWAYS", f"Wrote Term Revision History for term `{term_name}`", debug_level)
1574
+ return term_history_md
1575
+
1576
+ except Exception as e:
1577
+ print(f"{ERROR}Error performing {command}: {e}")
1578
+ console.print_exception(show_locals=True)
1579
+ return None
1580
+ else:
1581
+ return None
1435
1582
 
1436
1583
 
1437
1584
  def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive: str = "display") -> Optional[str]:
@@ -1493,9 +1640,8 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
1493
1640
  if categories: # Find information about categoriess that classify this term
1494
1641
  msg = "Checking for categories that classify this term"
1495
1642
  print_msg("DEBUG-INFO", msg, debug_level)
1496
- categories_list, cat_q_name_list, cat_valid, cat_exist = process_name_list(egeria_client,
1497
- 'Glossary Categories', txt,
1498
- CATEGORY_NAME_LABELS)
1643
+ categories_list, cat_q_name_list, cat_valid, cat_exist = process_name_list(egeria_client, 'Glossary Categories',
1644
+ txt, CATEGORY_NAME_LABELS)
1499
1645
  if cat_exist and cat_valid:
1500
1646
  msg = f"Found valid glossary categories to classify the term:\n\t{term_name}"
1501
1647
  print_msg("INFO", msg, debug_level)
@@ -1561,7 +1707,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
1561
1707
  f"\tUpdated Term `{term_name}` with GUID {known_guid}\n\tand categories `{categories}`",
1562
1708
  debug_level)
1563
1709
  return egeria_client.get_term_by_guid(known_guid,
1564
- 'md') # return update_a_command(txt, command, object_type,
1710
+ 'md') # return update_a_command(txt, command, object_type,
1565
1711
  # known_q_name, known_guid)
1566
1712
  elif object_action == "Update" and directive == "validate": # is sthis reachable?
1567
1713
  return egeria_client.get_term_by_guid(known_guid, 'md')
@@ -1608,7 +1754,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, txt: str, directive:
1608
1754
  update_element_dictionary(known_q_name, {'guid': term_guid, 'display_name': term_name})
1609
1755
  print_msg(ALWAYS, f"Created term `{term_name}` with GUID {term_guid}", debug_level)
1610
1756
  return egeria_client.get_term_by_guid(term_guid,
1611
- 'MD') # return update_a_command(txt, command,
1757
+ 'MD') # return update_a_command(txt, command,
1612
1758
  # object_type, q_name, term_guid)
1613
1759
  except Exception as e:
1614
1760
  print(f"{ERROR}Error creating term {term_name}: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyegeria
3
- Version: 5.3.8.8
3
+ Version: 5.3.8.9
4
4
  Summary: A python client for Egeria
5
5
  License: Apache 2.0
6
6
  Keywords: egeria,metadata,governance
@@ -1,5 +1,5 @@
1
1
  pyegeria/README.md,sha256=PwX5OC7-YSZUCIsoyHh1O-WBM2hE84sm3Bd4O353NOk,1464
2
- pyegeria/__init__.py,sha256=4226Kaq5Xf439GRkRu6ckhzSSJ8L30EbdZocdLfcBwE,30568
2
+ pyegeria/__init__.py,sha256=tRz08uRCYvJVVOzgUESDxStAoaXHYDr7wLfL1s21moM,30681
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
@@ -16,7 +16,7 @@ pyegeria/commands/cat/README.md,sha256=-aaAnIT2fcfU63vajgB-RzQk4l4yFdhkyVfSaTPiq
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
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
19
+ pyegeria/commands/cat/dr_egeria_md.py,sha256=C3-4iVfHH1inrsbyc0YBrWkmIPyX04aTRQ3D-uiRnH8,11331
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
@@ -226,11 +226,11 @@ 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=k0VfD9sB5CEf27cLxqpMheO5Rn5LcitcsQfKNEx4jbY,153382
229
+ pyegeria/glossary_browser_omvs.py,sha256=N8qP7q5dNwmV3QxxseapnFdTjVVdyT7SkWrNA_W2pPI,157486
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=8TjD_ffnTMLEZEkb2npnZy59glboWFkaRh0OK_YN9cw,83314
233
+ pyegeria/md_processing_utils.py,sha256=tEwi10Z--p5qv7YZNJJq0DJru3bOfJHHUSsSvNpZbTw,90012
234
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
@@ -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.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,,
248
+ pyegeria-5.3.8.9.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
249
+ pyegeria-5.3.8.9.dist-info/METADATA,sha256=7eNN-nHxckL5g37fvQKaGD1Mn0Vjr1vD8iE8-9U5yZ4,2740
250
+ pyegeria-5.3.8.9.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
251
+ pyegeria-5.3.8.9.dist-info/entry_points.txt,sha256=eAvQ_vkejlF3JzMzEc5VD93ymLA_hSFV0HM8fntG-d8,6791
252
+ pyegeria-5.3.8.9.dist-info/RECORD,,