pyegeria 5.3.8.2__py3-none-any.whl → 5.3.8.4__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.
@@ -11,30 +11,30 @@ import sys
11
11
  from datetime import datetime
12
12
  from typing import List, Optional
13
13
 
14
- from prompt_toolkit.filters import Always
15
14
  from rich import print
16
15
  from rich.console import Console
17
16
  from rich.markdown import Markdown
18
17
 
19
18
  from pyegeria import body_slimmer
20
- from pyegeria._globals import (NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_ELEMENTS_FOUND,
21
- NO_PROJECTS_FOUND, \
19
+ from pyegeria._globals import (NO_GLOSSARIES_FOUND, NO_ELEMENTS_FOUND, NO_PROJECTS_FOUND, \
22
20
  NO_CATEGORIES_FOUND)
21
+ from pyegeria.dr_egeria_state import get_element_dictionary, update_element_dictionary, find_key_with_value
23
22
  from pyegeria.egeria_tech_client import EgeriaTech
24
-
25
23
  # from pyegeria.md_processing_helpers import process_q_name_list
26
24
  from pyegeria.project_manager_omvs import ProjectManager
27
- from pyegeria.shared_state import get_element_dictionary, update_element_dictionary, find_key_with_value
28
25
 
29
26
  EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "170"))
30
27
  console = Console(width=EGERIA_WIDTH)
31
28
 
32
- command_list = ["Provenance", "Create Glossary", "Update Glossary", "Create Term", "Update Term",
33
- "Create Personal Project", "Update Personal Project", "Create Category", "Update Category",
34
- "Create Solution Blueprint", "Update Solution Blueprint", "Create Solution Component",
35
- "Update Solution Component", ]
29
+ 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", "Set Parent Category",
35
+ "UnSet Parent Category", "Unset Parent Category"]
36
36
  # verbosity - verbose, quiet, debug
37
- debug_level = "verbose"
37
+ debug_level = "debug"
38
38
  message_types = {
39
39
  "INFO": "INFO-", "WARNING": "WARNING->", "ERROR": "ERROR->", "DEBUG-INFO": "DEBUG-INFO->",
40
40
  "DEBUG-WARNING": "DEBUG-WARNING->", "DEBUG-ERROR": "DEBUG-ERROR->", "ALWAYS": "\n\n==> "
@@ -47,15 +47,25 @@ pre_command = "\n---\n==> Processing command:"
47
47
  command_seperator = Markdown("\n---\n")
48
48
 
49
49
  GLOSSARY_NAME_LABELS = ["Glossary Name", "Glossary", "Glossaries", "Owning Glossary", "In Glossary"]
50
- CATEGORY_NAME_LABELS = [ "Glossary Category Name", "Glossary Category", "Glossary Categories", "Category Name", "Category", "Categories"]
51
- TERM_NAME_LABELS= ["Glossary Term Name", "Glossary Term", "Glossary Terms", "Term Name", "Term", "Terms", "Term Names"]
50
+ CATEGORY_NAME_LABELS = ["Glossary Category Name", "Glossary Category", "Glossary Categories", "Category Name",
51
+ "Category", "Categories"]
52
+ PARENT_CATEGORY_LABELS = ["Parent Category Name", "Parent Category", "parent category name", "parent category"]
53
+ CHILD_CATEGORY_LABELS = ["Child Category Name", "Child Category", "child category name", "child category"]
54
+ TERM_NAME_LABELS = ["Glossary Term Name", "Glossary Term", "Glossary Terms", "Term Name", "Term", "Terms", "Term Names"]
52
55
  PROJECT_NAME_LABELS = ["Project Name", "Project", "Project Names", "Projects"]
53
- BLUEPRINT_NAME_LABELS = ["Solution Blueprint Name", "Solution Blueprint", "Solution Blueprints", "Blueprint Name", "Blueprint", "Blueprints"]
54
- COMPONENT_NAME_LABELS = ["Solution Component Name", "Solution Component", "Solution Components", "Component Name", "Component", "Components", "Parent Components", "Parent Component"]
56
+ BLUEPRINT_NAME_LABELS = ["Solution Blueprint Name", "Solution Blueprint", "Solution Blueprints", "Blueprint Name",
57
+ "Blueprint", "Blueprints"]
58
+ COMPONENT_NAME_LABELS = ["Solution Component Name", "Solution Component", "Solution Components", "Component Name",
59
+ "Component", "Components", "Parent Components", "Parent Component"]
55
60
  SOLUTION_ROLE_LABELS = ["Solution Role Name", "Solution Role", "Solution Roles", "Role Name", "Role", "Roles"]
56
- SOLUTION_ACTOR_ROLE_LABELS = [ "Solution Actor Role Name", "Solution Actor Role Names","Solution Actor Role", "Solution Actor Roles", "Actor Role Name", "Actor Role", "Actor Roles", "Actor Role Names"]
57
- SOLUTION_LINKING_ROLE_LABELS = [ "Solution Linking Role Name", "Solution Linking Role Names", "Solution Linking Role", "Solution Linking Roles", "Linking Role Name", "Linking Role", "Linking Roles", "Linking Role Names"]
58
- GUID_LABELS = ['GUID','guid']
61
+ SOLUTION_ACTOR_ROLE_LABELS = ["Solution Actor Role Name", "Solution Actor Role Names", "Solution Actor Role",
62
+ "Solution Actor Roles", "Actor Role Name", "Actor Role", "Actor Roles",
63
+ "Actor Role Names"]
64
+ SOLUTION_LINKING_ROLE_LABELS = ["Solution Linking Role Name", "Solution Linking Role Names", "Solution Linking Role",
65
+ "Solution Linking Roles", "Linking Role Name", "Linking Role", "Linking Roles",
66
+ "Linking Role Names"]
67
+ GUID_LABELS = ['GUID', 'guid']
68
+
59
69
 
60
70
  def render_markdown(markdown_text: str) -> None:
61
71
  """Renders the given markdown text in the console."""
@@ -70,6 +80,7 @@ def is_valid_iso_date(date_text) -> bool:
70
80
  except ValueError:
71
81
  return False
72
82
 
83
+
73
84
  def set_debug_level(directive: str) -> None:
74
85
  """Sets the debug level for the script."""
75
86
  global debug_level
@@ -83,10 +94,11 @@ def get_current_datetime_string():
83
94
  return now
84
95
 
85
96
 
86
- def add_term_to_categories(egeria_client: EgeriaTech, term_guid: str, categories_exist: bool,
97
+ def update_term_categories(egeria_client: EgeriaTech, term_guid: str, categories_exist: bool,
87
98
  categories_list: List[str]) -> None:
88
99
  """
89
- Adds a term to specified categories in a glossary.
100
+
101
+ Adds or removes a term to/from specified categories in a glossary.
90
102
 
91
103
  This function associates a term, identified by its GUID, with one or more
92
104
  categories. It uses the provided EgeriaTech client to assign the term
@@ -104,6 +116,14 @@ def add_term_to_categories(egeria_client: EgeriaTech, term_guid: str, categories
104
116
  Returns:
105
117
  None
106
118
  """
119
+ to_be_cat_guids: list[str] = []
120
+ # find the categories a term is currently in.
121
+ existing_categories = egeria_client.get_categories_for_term(term_guid)
122
+ if type(existing_categories) is str:
123
+ current_categories = []
124
+ else:
125
+ current_categories = [cat['elementHeader']['guid'] for cat in existing_categories]
126
+
107
127
  if categories_exist is True and categories_list is not None:
108
128
  if type(categories_list) is str:
109
129
  categories_list = categories_list.split(",").trim()
@@ -116,8 +136,26 @@ def add_term_to_categories(egeria_client: EgeriaTech, term_guid: str, categories
116
136
  cat_guid = cat.get('guid', None) if cat else None
117
137
  if cat_guid is None:
118
138
  cat_guid = egeria_client.__get_guid__(qualified_name=cat_el)
119
- egeria_client.add_term_to_category(term_guid, cat_guid)
139
+ update_element_dictionary(cat_el, {'guid': cat_guid})
140
+ to_be_cat_guids.append(cat_guid)
141
+
142
+ for cat in to_be_cat_guids:
143
+ if cat not in current_categories:
144
+ egeria_client.add_term_to_category(term_guid, cat)
145
+ current_categories.append(cat)
146
+ msg = f"Added term {term_guid} to category {cat}"
147
+ print_msg("DEBUG-INFO", msg, debug_level)
120
148
 
149
+ for cat in current_categories:
150
+ if cat not in to_be_cat_guids:
151
+ egeria_client.remove_term_from_category(term_guid, cat)
152
+ msg = f"Removed term {term_guid} from category {cat}"
153
+ print_msg("DEBUG-INFO", msg, debug_level)
154
+ else: # No categories specified - so remove any categories a term is in
155
+ for cat in current_categories:
156
+ egeria_client.remove_term_from_category(term_guid, cat)
157
+ msg = f"Removed term {term_guid} from category {cat}"
158
+ print_msg("DEBUG-INFO", msg, debug_level)
121
159
 
122
160
  def extract_command_plus(block: str) -> tuple[str, str, str] | None:
123
161
  """
@@ -129,6 +167,8 @@ def extract_command_plus(block: str) -> tuple[str, str, str] | None:
129
167
  be the first part, while the rest is treated as the object type. If
130
168
  no match is found, the function returns None.
131
169
 
170
+ Lines beginning with '>' are ignored.
171
+
132
172
  Args:
133
173
  block: A string containing the block of text to search for the
134
174
  command and action.
@@ -137,13 +177,17 @@ def extract_command_plus(block: str) -> tuple[str, str, str] | None:
137
177
  A tuple containing the command, the object type and the object action if a
138
178
  match is found. Otherwise, returns None.
139
179
  """
140
- match = re.search(r"#(.*?)(?:##|\n|$)", block) # Using a non capturing group
180
+ # Filter out lines beginning with '>'
181
+ filtered_lines = [line for line in block.split('\n') if not line.strip().startswith('>')]
182
+ filtered_block = '\n'.join(filtered_lines)
183
+
184
+ match = re.search(r"#(.*?)(?:##|\n|$)", filtered_block) # Using a non capturing group
141
185
  if match:
142
186
  clean_match = match.group(1).strip()
143
187
  if ' ' in clean_match:
144
188
  parts = clean_match.split(' ')
145
189
  object_action = parts[0].strip()
146
- # Join the rest of the parts to allow object_type to be one or two words
190
+ # Join the rest of the parts to allow object_type to be one or two words
147
191
  object_type = ' '.join(parts[1:]).strip()
148
192
  else:
149
193
  object_type = clean_match.split(' ')[1].strip()
@@ -177,7 +221,7 @@ def extract_command(block: str) -> str | None:
177
221
 
178
222
  def extract_attribute(text: str, labels: [str]) -> str | None:
179
223
  """
180
- Extracts the glossary name from a string.
224
+ Extracts the attribute value from a string.
181
225
 
182
226
  Args:
183
227
  text: The input string.
@@ -185,17 +229,27 @@ def extract_attribute(text: str, labels: [str]) -> str | None:
185
229
 
186
230
  Returns:
187
231
  The glossary name, or None if not found.
232
+
233
+ Note:
234
+ Lines beginning with '>' are ignored.
188
235
  """
189
236
  # Iterate over the list of labels
190
237
  for label in labels:
191
238
  # Construct pattern for the current label
192
- pattern = rf"## {re.escape(label)}\n(.*?)(?:#|___|$)" # modified from --- to enable embedded tables
239
+ pattern = rf"## {re.escape(label)}\n(.*?)(?:#|___|>|$)" # modified from --- to enable embedded tables
193
240
  match = re.search(pattern, text, re.DOTALL)
194
241
  if match:
195
- # Extract matched text and replace consecutive \n with a single \n
196
- extracted_text = re.sub(r'\n+', '\n', match.group(1).strip())
242
+ # Extract matched text
243
+ matched_text = match.group(1).strip()
244
+
245
+ # Filter out lines beginning with '>'
246
+ filtered_lines = [line for line in matched_text.split('\n') if not line.strip().startswith('>')]
247
+ filtered_text = '\n'.join(filtered_lines)
248
+
249
+ # Replace consecutive \n with a single \n
250
+ extracted_text = re.sub(r'\n+', '\n', filtered_text)
197
251
  if not extracted_text.isspace() and extracted_text:
198
- return extracted_text.title() # Return the cleaned text
252
+ return extracted_text # Return the cleaned text - I removed the title casing
199
253
 
200
254
 
201
255
  def print_msg(msg_level: str, msg: str, verbosity: str):
@@ -233,6 +287,7 @@ def print_msg(msg_level: str, msg: str, verbosity: str):
233
287
  print("Invalid verbosity level - exiting\n")
234
288
  sys.exit(1)
235
289
 
290
+
236
291
  def process_simple_attribute(txt: str, labels: [str], if_missing: str = INFO) -> str | None:
237
292
  """Process a simple attribute based on the provided labels and if_missing value.
238
293
  Extract the attribute value from the text and return it if it exists.
@@ -254,11 +309,15 @@ def process_simple_attribute(txt: str, labels: [str], if_missing: str = INFO) ->
254
309
  attribute = extract_attribute(txt, labels)
255
310
 
256
311
  if attribute is None:
257
- msg = f"Missing {labels[0]} attribute"
312
+ if if_missing == INFO:
313
+ msg = f"Optional attribute {labels[0]} missing"
314
+ else:
315
+ msg = f"Missing {labels[0]} attribute"
258
316
  print_msg(if_missing, msg, debug_level)
259
317
  return None
260
318
  return attribute
261
319
 
320
+
262
321
  def update_a_command(txt: str, command: str, obj_type: str, q_name: str, u_guid: str) -> str:
263
322
  """
264
323
  Updates a command by modifying the input text with corresponding actions, GUID, and qualified name.
@@ -289,7 +348,6 @@ def update_a_command(txt: str, command: str, obj_type: str, q_name: str, u_guid:
289
348
  if "GUID" not in txt:
290
349
  txt += f"\n## GUID\n{u_guid}\n"
291
350
 
292
-
293
351
  status = extract_attribute(txt, ["Status"])
294
352
  if command in ["Create Term", "Update Term"] and status is None:
295
353
  pattern = r"(## Status\s*\n)(.*?)(#)"
@@ -317,8 +375,8 @@ def process_provenance_command(file_path: str, txt: [str]) -> str:
317
375
  return f"\n# Provenance:\n{existing_prov}\n{output}\n"
318
376
 
319
377
 
320
- def process_element_identifiers(egeria_client: EgeriaTech, element_type: str, element_labels: [str], txt: str, action: str,
321
- version: str = None) -> tuple[str, str, bool, bool]:
378
+ def process_element_identifiers(egeria_client: EgeriaTech, element_type: str, element_labels: [str], txt: str,
379
+ action: str, version: str = None) -> tuple[str, str, bool, bool]:
322
380
  """
323
381
  Processes element identifiers by extracting display name and qualified name from the input text,
324
382
  checking if the element exists in Egeria, and validating the information.
@@ -349,10 +407,10 @@ def process_element_identifiers(egeria_client: EgeriaTech, element_type: str, el
349
407
  element_name = extract_attribute(txt, element_labels)
350
408
  qualified_name = extract_attribute(txt, ["Qualified Name"])
351
409
 
352
-
353
410
  if qualified_name:
354
411
  q_name, guid, unique, exists = get_element_by_name(egeria_client, element_type,
355
- qualified_name) # Qualified name could be different if it is being updated
412
+ qualified_name) # Qualified name could be different if it
413
+ # is being updated
356
414
  else:
357
415
  q_name, guid, unique, exists = get_element_by_name(egeria_client, element_type, element_name)
358
416
  if unique is False:
@@ -470,12 +528,12 @@ def get_element_by_name(egeria_client, element_type: str, element_name: str) ->
470
528
  unique = True
471
529
  return el_qname, el_guid, unique, exists
472
530
 
473
- # Convert element_type to plural form for method name construction # if element_type.endswith('y'): #
474
- # plural_type = f"{element_type[:-1]}ies" # elif element_type.endswith('s'): # plural_type = f"{
531
+ # Convert element_type to plural form for method name construction # if element_type.endswith('y'): # #
532
+ # plural_type = f"{element_type[:-1]}ies" # elif element_type.endswith('s'): # plural_type = f"{ #
475
533
  # element_type}es" # else: # plural_type = f"{element_type}s" # # # Construct method name # method_name
476
534
  # = f"get_{plural_type}_by_name" # # # Check if the method exists on the client # if hasattr(egeria_client,
477
- # method_name): # # Call the method # method = getattr(egeria_client, method_name) # result =
478
- # method(element_name) # return result # else: # # Method doesn't exist # return f"Method {
535
+ # method_name): # # Call the method # method = getattr(egeria_client, method_name) # result = #
536
+ # method(element_name) # return result # else: # # Method doesn't exist # return f"Method { #
479
537
  # method_name} not found on client"
480
538
 
481
539
 
@@ -566,21 +624,21 @@ def process_blueprint_upsert_command(egeria_client: EgeriaTech, element_dictiona
566
624
  """
567
625
  command, object_type, object_action = extract_command_plus(txt)
568
626
  set_debug_level(directive)
569
- display_name = process_simple_attribute(txt, ['Display Name', 'Blueprint Name'],ERROR)
627
+ display_name = process_simple_attribute(txt, ['Display Name', 'Blueprint Name'], ERROR)
570
628
  description = process_simple_attribute(txt, ['Description'])
571
629
  version = process_simple_attribute(txt, ['Version', "Version Identifier", "Published Version"])
572
630
 
573
- print(Markdown(
574
- f"{pre_command} {object_action} `{object_type}` for Blueprint: `\'{display_name}\'` with directive: `"
575
- f"{directive}`\n"))
631
+ print(
632
+ Markdown(f"{pre_command} {object_action} `{object_type}` for Blueprint: `\'{display_name}\'` with directive: `"
633
+ f"{directive}`\n"))
576
634
  if display_name is None:
577
635
  valid = False
578
636
  q_name, known_guid, exists = None
579
637
  else:
580
638
  element_labels = BLUEPRINT_NAME_LABELS
581
639
  element_labels.append('Display Name')
582
- q_name, known_guid, valid, exists = process_element_identifiers(egeria_client, object_type, element_labels,
583
- txt, object_action, version)
640
+ q_name, known_guid, valid, exists = process_element_identifiers(egeria_client, object_type, element_labels, txt,
641
+ object_action, version)
584
642
 
585
643
  element_display = (f"\n* Command: {object_action} {object_type}\n\t* Blueprint: {display_name}\n\t"
586
644
  f"* Description: {description}\n\t"
@@ -618,11 +676,11 @@ def process_blueprint_upsert_command(egeria_client: EgeriaTech, element_dictiona
618
676
  print_msg("ALWAYS", msg, debug_level)
619
677
 
620
678
  # update with get blueprint by guid
621
- return 'Would return get blueprint by guid and return md' # egeria_client.get_terms_by_guid(
679
+ return 'Would return get blueprint by guid and return md' # egeria_client.get_terms_by_guid( #
622
680
  # known_guid, 'md')
623
681
 
624
682
  elif object_action == "Update" and directive == "validate":
625
- return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_terms_by_guid(
683
+ return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_terms_by_guid( #
626
684
  # known_guid, 'md')
627
685
 
628
686
  elif object_action == "Create":
@@ -641,7 +699,7 @@ def process_blueprint_upsert_command(egeria_client: EgeriaTech, element_dictiona
641
699
  print_msg("ALWAYS", msg, debug_level)
642
700
 
643
701
  update_element_dictionary(q_name, {'guid': new_guid, 'display_name': display_name})
644
- return 'Would return get blueprint by guid results as md' # egeria_client.get_terms_by_guid(
702
+ return 'Would return get blueprint by guid results as md' # egeria_client.get_terms_by_guid( #
645
703
  # term_guid, 'MD')
646
704
 
647
705
  except Exception as e:
@@ -673,7 +731,7 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, element
673
731
  bp_qname_list = []
674
732
  command, object_type, object_action = extract_command_plus(txt)
675
733
 
676
- display_name = process_simple_attribute(txt,['Display Name', 'Solution Component Name'] , ERROR)
734
+ display_name = process_simple_attribute(txt, ['Display Name', 'Solution Component Name'], ERROR)
677
735
  description = process_simple_attribute(txt, ['Description'])
678
736
  version = process_simple_attribute(txt, ['Version', "Version Identifier", "Published Version"])
679
737
  solution_component_type = process_simple_attribute(txt, ['Solution Component Type'])
@@ -691,14 +749,16 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, element
691
749
  else:
692
750
  element_labels = COMPONENT_NAME_LABELS
693
751
  element_labels.append('Display Name')
694
- known_q_name, known_guid, valid, exists = process_element_identifiers(egeria_client, object_type, element_labels, txt,
695
- object_action, version)
752
+ known_q_name, known_guid, valid, exists = process_element_identifiers(egeria_client, object_type,
753
+ element_labels, txt, object_action,
754
+ version)
696
755
 
697
756
  if solution_blueprints: # Find information about blueprints that include this component
698
757
  msg = "Checking for blueprints that include this solution component"
699
758
  print_msg("DEBUG-INFO", msg, debug_level)
700
759
  solution_blueprints, bp_qname_list, bp_valid, bp_exist = process_q_name_list(egeria_client,
701
- 'Solution Blueprints', txt, BLUEPRINT_NAME_LABELS)
760
+ 'Solution Blueprints', txt,
761
+ BLUEPRINT_NAME_LABELS)
702
762
  if bp_exist and bp_valid:
703
763
  msg = f"Found valid blueprints that include this solution component:\n\t{solution_blueprints}"
704
764
  print_msg("INFO", msg, debug_level)
@@ -783,11 +843,11 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, element
783
843
  msg = f"\nUpdated Solution Component `{display_name}` with GUID {known_guid}"
784
844
  print_msg("ALWAYS", msg, debug_level)
785
845
  # update with get solution component by guid
786
- return 'Would return get Solution Component by guid and return md' #
846
+ return 'Would return get Solution Component by guid and return md' # #
787
847
  # egeria_client.get_terms_by_guid(known_guid, 'md')
788
848
 
789
849
  elif object_action == "Update" and directive == "validate":
790
- return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_terms_by_guid(
850
+ return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_terms_by_guid( #
791
851
  # known_guid, 'md')
792
852
 
793
853
  elif object_action == "Create":
@@ -805,7 +865,7 @@ def process_solution_component_upsert_command(egeria_client: EgeriaTech, element
805
865
  msg = f"\nCreated Solution Component `{display_name}` with GUID {known_guid}"
806
866
  print_msg("ALWAYS", msg, debug_level)
807
867
  update_element_dictionary(known_q_name, {'guid': known_guid, 'display_name': display_name})
808
- return 'Would return get solution component by guid results as md' #
868
+ return 'Would return get solution component by guid results as md' # #
809
869
  # egeria_client.get_terms_by_guid(term_guid, 'MD')
810
870
 
811
871
  except Exception as e:
@@ -833,7 +893,9 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, element_dictionar
833
893
  set_debug_level(directive)
834
894
 
835
895
  glossary_name = process_simple_attribute(txt, ['Glossary Name', 'Display Name'])
836
- print(Markdown(f"{pre_command} `{object_action}` `{object_type}` for glossary: `\'{glossary_name}\'` with directive: `{directive}` "))
896
+ print(Markdown(
897
+ f"{pre_command} `{object_action}` `{object_type}` for glossary: `\'{glossary_name}\'` with directive: `"
898
+ f"{directive}` "))
837
899
  language = process_simple_attribute(txt, ['Language'])
838
900
  description = process_simple_attribute(txt, ['Description'])
839
901
  usage = process_simple_attribute(txt, ['Usage'])
@@ -843,14 +905,14 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, element_dictionar
843
905
  valid = False
844
906
  known_q_name, known_guid, glossary_exists = None
845
907
  else:
846
- element_labels =GLOSSARY_NAME_LABELS
908
+ element_labels = GLOSSARY_NAME_LABELS
847
909
  element_labels.append('Display Name')
848
- known_q_name, known_guid, valid, glossary_exists = process_element_identifiers(egeria_client, object_type, element_labels,
849
- txt, object_action, None)
910
+ known_q_name, known_guid, valid, glossary_exists = process_element_identifiers(egeria_client, object_type,
911
+ element_labels, txt,
912
+ object_action, None)
850
913
  glossary_display = (f"\n* Command: `{command}`\n\t* Glossary Name: {glossary_name}\n\t"
851
914
  f"* Language: {language}\n\t* Description:\n{description}\n"
852
- f"* Usage: {usage}\n"
853
- )
915
+ f"* Usage: {usage}\n")
854
916
 
855
917
  if object_action == 'Update':
856
918
  guid = process_simple_attribute(txt, ['GUID', 'guid', 'Guid'])
@@ -873,7 +935,6 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, element_dictionar
873
935
  msg = f"It is valid to create Glossary `{glossary_name}` with:\n"
874
936
  print_msg("ALWAYS", msg, debug_level)
875
937
 
876
-
877
938
  if directive == "display":
878
939
  print(Markdown(glossary_display))
879
940
  return None
@@ -900,7 +961,8 @@ def process_glossary_upsert_command(egeria_client: EgeriaTech, element_dictionar
900
961
  if object_action == "Update":
901
962
  if not glossary_exists:
902
963
  print(
903
- f"\n{ERROR}Glossary `{glossary_name}` does not exist! Updating result document with Create command\n")
964
+ f"\n{ERROR}Glossary `{glossary_name}` does not exist! Updating result document with Create "
965
+ f"command\n")
904
966
  return update_a_command(txt, command, object_type, known_q_name, known_guid)
905
967
 
906
968
  body = {
@@ -970,25 +1032,22 @@ def process_categories_upsert_command(egeria_client: EgeriaTech, element_diction
970
1032
  else:
971
1033
  element_labels = CATEGORY_NAME_LABELS
972
1034
  element_labels.append('Display Name')
973
- known_q_name, known_guid, valid, category_exists = process_element_identifiers(egeria_client, object_type, element_labels,
974
- txt, object_action, None)
975
-
1035
+ known_q_name, known_guid, valid, category_exists = process_element_identifiers(egeria_client, object_type,
1036
+ element_labels, txt,
1037
+ object_action, None)
976
1038
 
977
1039
  # Check if owning glossary exists (and get qname)
978
1040
  if owning_glossary_name is None:
979
1041
  valid = False
980
1042
  known_glossary_q_name, known_glossary__guid, glossary_exists = None
981
1043
  else:
982
- known_glossary_q_name, known_glossary_guid, valid, owning_glossary_exists = process_element_identifiers(egeria_client,
983
- "Glossary",
984
- GLOSSARY_NAME_LABELS, txt,
985
- "Exists Required", None)
1044
+ known_glossary_q_name, known_glossary_guid, valid, owning_glossary_exists = process_element_identifiers(
1045
+ egeria_client, "Glossary", GLOSSARY_NAME_LABELS, txt, "Exists Required", None)
986
1046
 
987
1047
  category_display = (
988
1048
  f"\n* Command: {command}\n\t* Category: {category_name}\n\t* In Glossary: {owning_glossary_name}\n\t"
989
1049
  f"* Description:\n{description}\n\t* Qualified Name: {q_name}\n\t")
990
1050
 
991
-
992
1051
  if object_action == 'Update':
993
1052
  guid = process_simple_attribute(txt, ['GUID', 'guid', 'Guid'])
994
1053
  # update_description = process_simple_attribute(txt, 'Update Description')
@@ -1051,7 +1110,8 @@ def process_categories_upsert_command(egeria_client: EgeriaTech, element_diction
1051
1110
  is_root = True
1052
1111
 
1053
1112
  if category_exists:
1054
- msg = f"Cannot create`{category_name}` because it already exists; result document written for category update\n"
1113
+ msg = (f"Cannot create`{category_name}` because it already exists; result document written for "
1114
+ f"category update\n")
1055
1115
  print_msg(WARNING, msg, debug_level)
1056
1116
  return update_a_command(txt, command, object_type, known_q_name, known_guid)
1057
1117
  else:
@@ -1068,7 +1128,315 @@ def process_categories_upsert_command(egeria_client: EgeriaTech, element_diction
1068
1128
  'guid': category_guid, 'display_name': category_name
1069
1129
  })
1070
1130
  print_msg(ALWAYS, f"Created Category `{category_name}` with GUID {category_guid}", debug_level)
1071
- return egeria_client.get_categories_by_guid(category_guid, output_format='MD')
1131
+ return egeria_client.get_categories_by_guid(category_guid, output_format='DR')
1132
+
1133
+
1134
+ def process_set_categories_parent_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
1135
+ directive: str = "display") -> Optional[str]:
1136
+ """
1137
+ Processes a set_parent_category command by extracting key attributes such as
1138
+ parent and child category names from the given text.
1139
+
1140
+ :param txt: A string representing the input cell to be processed for
1141
+ extracting category-related attributes.
1142
+ :param directive: an optional string indicating the directive to be used - display, validate or execute
1143
+ :return: A string summarizing the outcome of the processing.
1144
+ """
1145
+ valid = True
1146
+ set_debug_level(directive)
1147
+
1148
+ command, object_type, object_action = extract_command_plus(txt)
1149
+
1150
+ parent_category_name = process_simple_attribute(txt, PARENT_CATEGORY_LABELS, "ERROR")
1151
+ child_category_name = process_simple_attribute(txt, CHILD_CATEGORY_LABELS, "ERROR")
1152
+ print(Markdown(f"{pre_command} `{command}` for parent category: `\'{parent_category_name}\'` \n\t"
1153
+ f"and child category: `\'{child_category_name}\'` \nwith directive: `{directive}` "))
1154
+
1155
+ if parent_category_name is None or child_category_name is None:
1156
+ valid = False
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))
1162
+
1163
+ # Check if category exists (and get qname and guid)
1164
+
1165
+ if parent_cat_exists and child_cat_exists:
1166
+ valid = True
1167
+ msg = f" Both categories {parent_category_name} and {child_category_name} exist\n"
1168
+ print_msg(INFO, msg, debug_level)
1169
+ if parent_cat_guid and child_cat_guid:
1170
+ msg = f" Both categories {parent_category_name} and {child_category_name} have GUIDs\n"
1171
+ print_msg(INFO, msg, debug_level)
1172
+ else:
1173
+ msg = f" Both categories {parent_category_name} and {child_category_name} do not have GUIDs\n"
1174
+ print_msg(ERROR, msg, debug_level)
1175
+ valid = False
1176
+
1177
+
1178
+ else:
1179
+ valid = False
1180
+ msg = f"Both categories {parent_category_name} and {child_category_name} do NOT exist\n"
1181
+ print_msg(ERROR, msg, debug_level)
1182
+
1183
+ category_display = (f"\n* Command: {command}\n\t* Parent Category: {parent_category_name}\n\t\t"
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)
1208
+
1209
+ if directive == "display":
1210
+ print(Markdown(category_display))
1211
+ return None
1212
+
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
+
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
+
1231
+ if object_action in ["Set", "Set Parent"]:
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]:
1246
+ """ List terms as a markdown table. Filter based on optional search string. """
1247
+ set_debug_level(directive)
1248
+ valid = True
1249
+ command = extract_command(txt)
1250
+ object_type = command.split(' ')[1].strip()
1251
+ object_action = command.split(' ')[0].strip()
1252
+ known_glossary_q = ""
1253
+ known_glossary_guid = ""
1254
+ glossary_exists = False
1255
+ glossary_valid = False
1256
+
1257
+
1258
+ search_string = process_simple_attribute(txt, ['Search String', 'Filter'])
1259
+ if search_string is None:
1260
+ search_string = '*'
1261
+ print(Markdown(f"{pre_command} `{command}` with search string:`{search_string}` with directive: `{directive}`"))
1262
+
1263
+ glossary = process_simple_attribute(txt, ['Glossary', 'In Glossary'])
1264
+ if glossary is not None:
1265
+ _, glossary_guid, _, glossary_exists = get_element_by_name(
1266
+ egeria_client, "Glossary", glossary)
1267
+ msg = f"Found glossary `{glossary}` with GUID {glossary_guid}"
1268
+ print_msg(INFO, msg, debug_level)
1269
+ else:
1270
+ glossary_guid= None
1271
+ msg = f"No glossary found"
1272
+ print_msg(INFO, msg, debug_level)
1273
+
1274
+
1275
+ request_display = f"\n* Search String: {search_string}\n* Glossary: {glossary}\n"
1276
+
1277
+ if directive == "display":
1278
+ print(Markdown(request_display))
1279
+ return None
1280
+ elif directive == "validate":
1281
+ print(Markdown(request_display))
1282
+ return valid
1283
+ elif directive == "process":
1284
+ try:
1285
+ print(Markdown(request_display))
1286
+ if not valid: # First validate the term before we process it
1287
+ return None
1288
+
1289
+ md_table = egeria_client.find_glossary_terms(search_string,glossary_guid, output_format = "LIST")
1290
+
1291
+ return md_table
1292
+
1293
+ except Exception as e:
1294
+ print(f"{ERROR}Error creating Glossary Term list: {e}")
1295
+ console.print_exception(show_locals=True)
1296
+ return None
1297
+
1298
+ def process_category_list_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
1299
+ directive: str = "display") -> Optional[str]:
1300
+ """ List terms as a markdown table. Filter based on optional search string. """
1301
+ set_debug_level(directive)
1302
+ valid = True
1303
+ command = extract_command(txt)
1304
+ object_type = command.split(' ')[1].strip()
1305
+ object_action = command.split(' ')[0].strip()
1306
+ known_glossary_q = ""
1307
+ known_glossary_guid = ""
1308
+ glossary_exists = False
1309
+ glossary_valid = False
1310
+
1311
+
1312
+ search_string = process_simple_attribute(txt, ['Search String', 'Filter'])
1313
+ if search_string is None:
1314
+ search_string = '*'
1315
+ print(Markdown(f"{pre_command} `{command}` with search string:`{search_string}` with directive: `{directive}`"))
1316
+
1317
+ # glossary = process_simple_attribute(txt, ['Glossary', 'In Glossary'])
1318
+ # if glossary is not None:
1319
+ # _, glossary_guid, _, glossary_exists = get_element_by_name(
1320
+ # egeria_client, "Glossary", glossary)
1321
+ # msg = f"Found glossary `{glossary}` with GUID {glossary_guid}"
1322
+ # print_msg(INFO, msg, debug_level)
1323
+ # else:
1324
+ # glossary_guid= None
1325
+ # msg = f"No glossary found"
1326
+ # print_msg(INFO, msg, debug_level)
1327
+
1328
+
1329
+ request_display = f"\n* Search String: {search_string}\n"
1330
+
1331
+ if directive == "display":
1332
+ print(Markdown(request_display))
1333
+ return None
1334
+ elif directive == "validate":
1335
+ print(Markdown(request_display))
1336
+ return valid
1337
+ elif directive == "process":
1338
+ try:
1339
+ print(Markdown(request_display))
1340
+ if not valid: # First validate the term before we process it
1341
+ return None
1342
+ md_table = egeria_client.find_glossary_categories(search_string, output_format = "LIST")
1343
+
1344
+ return md_table
1345
+
1346
+ except Exception as e:
1347
+ print(f"{ERROR}Error creating Glossary Category list: {e}")
1348
+ console.print_exception(show_locals=True)
1349
+ return None
1350
+
1351
+ def process_glossary_list_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
1352
+ directive: str = "display") -> Optional[str]:
1353
+ """ List terms as a markdown table. Filter based on optional search string. """
1354
+ set_debug_level(directive)
1355
+ valid = True
1356
+ command = extract_command(txt)
1357
+ object_type = command.split(' ')[1].strip()
1358
+ object_action = command.split(' ')[0].strip()
1359
+ known_glossary_q = ""
1360
+ known_glossary_guid = ""
1361
+ glossary_exists = False
1362
+ glossary_valid = False
1363
+
1364
+
1365
+ search_string = process_simple_attribute(txt, ['Search String', 'Filter'])
1366
+ if search_string is None:
1367
+ search_string = '*'
1368
+ print(Markdown(f"{pre_command} `{command}` with search string:`{search_string}` with directive: `{directive}`"))
1369
+
1370
+
1371
+ request_display = f"\n* Search String: {search_string}\n"
1372
+
1373
+ if directive == "display":
1374
+ print(request_display)
1375
+ return None
1376
+ elif directive == "validate":
1377
+ print(request_display)
1378
+ return valid
1379
+ elif directive == "process":
1380
+ try:
1381
+ print(request_display)
1382
+ if not valid: # First validate the term before we process it
1383
+ return None
1384
+
1385
+ md_table = egeria_client.find_glossaries(search_string, output_format = "LIST")
1386
+
1387
+ return md_table
1388
+
1389
+ except Exception as e:
1390
+ print(f"{ERROR}Error creating Glossary list: {e}")
1391
+ console.print_exception(show_locals=True)
1392
+ return None
1393
+
1394
+ def process_term_history_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
1395
+ directive: str = "display") -> Optional[str]:
1396
+ """ List terms as a markdown table. Filter based on optional search string. """
1397
+ set_debug_level(directive)
1398
+ valid = True
1399
+ command = extract_command(txt)
1400
+ object_type = command.split(' ')[1].strip()
1401
+ object_action = command.split(' ')[0].strip()
1402
+
1403
+ element_labels = TERM_NAME_LABELS
1404
+ element_labels.append('Display Name')
1405
+
1406
+ term_name = process_simple_attribute(txt, element_labels, "ERROR")
1407
+ print(Markdown(f"{pre_command} `{command}` for term: `\'{term_name}\'` with directive: `{directive}` "))
1408
+
1409
+ known_q_name, known_guid, valid, term_exists = process_element_identifiers(egeria_client, object_type,
1410
+ element_labels, txt, object_action,
1411
+ )
1412
+
1413
+ print(Markdown(f"{pre_command} `{command}` for term:`{term_name}` with directive: `{directive}`"))
1414
+
1415
+
1416
+ request_display = f"\n\t* Term Name: {term_name}\n\t* Qualified Name: {known_q_name}\n\t* GUID: {known_guid}\n"
1417
+
1418
+ if directive == "display":
1419
+ print(request_display)
1420
+ return None
1421
+ elif directive == "validate":
1422
+ print(request_display)
1423
+ return valid
1424
+ elif directive == "process":
1425
+ try:
1426
+ print(request_display)
1427
+ if not valid: # First validate the term before we process it
1428
+ return None
1429
+ term_history_md = f"\n# Term History for `{term_name}`\n\n"
1430
+ term_history_md += egeria_client.list_full_term_history(known_guid, 'LIST')
1431
+
1432
+ return term_history_md
1433
+
1434
+ except Exception as e:
1435
+ print(f"{ERROR}Error creating Glossary list: {e}")
1436
+ console.print_exception(show_locals=True)
1437
+ return None
1438
+
1439
+
1072
1440
 
1073
1441
 
1074
1442
  def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
@@ -1110,9 +1478,9 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
1110
1478
  else:
1111
1479
  element_labels = TERM_NAME_LABELS
1112
1480
  element_labels.append('Display Name')
1113
- known_q_name, known_guid, valid, term_exists = process_element_identifiers(egeria_client, object_type, element_labels,
1114
- txt, object_action, version)
1115
-
1481
+ known_q_name, known_guid, valid, term_exists = process_element_identifiers(egeria_client, object_type,
1482
+ element_labels, txt, object_action,
1483
+ version)
1116
1484
 
1117
1485
  # get the glossary qualified name this term is in
1118
1486
  glossary_name = process_simple_attribute(txt, GLOSSARY_NAME_LABELS, ERROR)
@@ -1132,7 +1500,8 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
1132
1500
  msg = "Checking for categories that classify this term"
1133
1501
  print_msg("DEBUG-INFO", msg, debug_level)
1134
1502
  categories_list, cat_q_name_list, cat_valid, cat_exist = process_q_name_list(egeria_client,
1135
- 'Glossary Categories', txt, CATEGORY_NAME_LABELS)
1503
+ 'Glossary Categories', txt,
1504
+ CATEGORY_NAME_LABELS)
1136
1505
  if cat_exist and cat_valid:
1137
1506
  msg = f"Found valid glossary categories to classify the term:\n\t{term_name}"
1138
1507
  print_msg("INFO", msg, debug_level)
@@ -1143,8 +1512,6 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
1143
1512
  cat_exist = cat_valid = False
1144
1513
  cat_q_name_list = None
1145
1514
 
1146
-
1147
-
1148
1515
  if object_action == "Update": # check to see if provided information exists and is consistent with existing info
1149
1516
  term_guid = process_simple_attribute(txt, GUID_LABELS)
1150
1517
  update_description = process_simple_attribute(txt, ['Update Description'])
@@ -1156,7 +1523,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
1156
1523
  f"\n\t* Update Description: {update_description}\n")
1157
1524
  if not term_exists:
1158
1525
  msg = f"Update request invalid, Term {term_name} does not exist\n"
1159
- print_msg(ERROR,msg, debug_level)
1526
+ print_msg(ERROR, msg, debug_level)
1160
1527
  valid = False
1161
1528
 
1162
1529
  elif object_action == 'Create': # if the command is create, check that it doesn't already exist
@@ -1170,8 +1537,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
1170
1537
  print_msg(ERROR, msg, debug_level)
1171
1538
  else:
1172
1539
  msg = f"It is valid to create Term `{term_name}`"
1173
- print_msg(ALWAYS,msg, debug_level)
1174
-
1540
+ print_msg(ALWAYS, msg, debug_level)
1175
1541
 
1176
1542
  if directive == "display":
1177
1543
  print(Markdown(term_display))
@@ -1183,7 +1549,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
1183
1549
  try:
1184
1550
  if not valid: # First validate the term before we process it
1185
1551
  return None
1186
-
1552
+ print(Markdown(term_display))
1187
1553
  if object_action == "Update" and directive == "process":
1188
1554
  if not term_exists:
1189
1555
  return None
@@ -1195,13 +1561,15 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
1195
1561
  }, "updateDescription": update_description
1196
1562
  }
1197
1563
  egeria_client.update_term(known_guid, body_slimmer(body))
1198
- if cat_exist and cat_valid:
1199
- add_term_to_categories(egeria_client, known_guid, cats_exist, cat_q_name_list)
1200
- print_msg(ALWAYS, f"\tUpdated Term `{term_name}` with GUID {known_guid}\n\tand categories `{categories}`", debug_level)
1564
+ # if cat_exist and cat_valid:
1565
+ update_term_categories(egeria_client, known_guid, cats_exist, cat_q_name_list)
1566
+ print_msg(ALWAYS,
1567
+ f"\tUpdated Term `{term_name}` with GUID {known_guid}\n\tand categories `{categories}`",
1568
+ debug_level)
1201
1569
  return egeria_client.get_terms_by_guid(known_guid,
1202
1570
  'md') # return update_a_command(txt, command, object_type,
1203
1571
  # known_q_name, known_guid)
1204
- elif object_action == "Update" and directive == "validate": # is sthis reachable?
1572
+ elif object_action == "Update" and directive == "validate": # is sthis reachable?
1205
1573
  return egeria_client.get_terms_by_guid(known_guid, 'md')
1206
1574
 
1207
1575
  elif object_action == "Create":
@@ -1217,7 +1585,7 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
1217
1585
  glossary_guid = cached.get('guid', None)
1218
1586
  if glossary_guid is None:
1219
1587
  msg = f"Glossary GUID for {known_glossary_q_name} not found in cache"
1220
- print_msg(WARNING, msg, debug_level) # should this ever occur?
1588
+ print_msg(WARNING, msg, debug_level) # should this ever occur?
1221
1589
  return None
1222
1590
  else:
1223
1591
  glossary_guid = egeria_client.__get_guid__(qualified_name=known_glossary_q_name)
@@ -1242,10 +1610,10 @@ def process_term_upsert_command(egeria_client: EgeriaTech, element_dictionary: d
1242
1610
  print(f"{ERROR}Term {term_name} not created")
1243
1611
  return None
1244
1612
  if cats_exist and categories is not None:
1245
- add_term_to_categories(egeria_client, term_guid, cats_exist, cat_q_name_list)
1613
+ update_term_categories(egeria_client, term_guid, cats_exist, cat_q_name_list)
1246
1614
  update_element_dictionary(known_q_name, {'guid': term_guid, 'display_name': term_name})
1247
1615
  print_msg(ALWAYS, f"Created term `{term_name}` with GUID {term_guid}", debug_level)
1248
- return egeria_client.get_terms_by_guid(term_guid,
1616
+ return egeria_client.get_term_by_guid(term_guid,
1249
1617
  'MD') # return update_a_command(txt, command,
1250
1618
  # object_type, q_name, term_guid)
1251
1619
  except Exception as e: