pyegeria 5.3.7.1__py3-none-any.whl → 5.3.7.7__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.
@@ -19,7 +19,7 @@ from rich.markdown import Markdown
19
19
 
20
20
  from pyegeria import body_slimmer
21
21
  from pyegeria._globals import NO_TERMS_FOUND, NO_GLOSSARIES_FOUND, NO_TERMS_FOUND, NO_ELEMENTS_FOUND, NO_PROJECTS_FOUND, NO_CATEGORIES_FOUND
22
-
22
+ from pyegeria.egeria_tech_client import EgeriaTech
23
23
  from pyegeria.project_manager_omvs import ProjectManager
24
24
  from pyegeria.glossary_manager_omvs import GlossaryManager
25
25
 
@@ -27,8 +27,13 @@ from datetime import datetime
27
27
  EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
28
28
  console = Console(width=EGERIA_WIDTH)
29
29
 
30
- command_list = ["Provenance", "Create Glossary", "Update Glossary", "Create Term", "Update Term", "Create Personal Project",
31
- "Update Personal Project", "Create Category", "Update Category"]
30
+ command_list = ["Provenance",
31
+ "Create Glossary", "Update Glossary",
32
+ "Create Term", "Update Term",
33
+ "Create Personal Project", "Update Personal Project",
34
+ "Create Category", "Update Category",
35
+ "Create Solution Blueprint", "Update Solution Blueprint"]
36
+
32
37
  ERROR = "ERROR-> "
33
38
  INFO = "INFO- "
34
39
  WARNING = "WARNING-> "
@@ -70,12 +75,22 @@ def add_term_to_categories(egeria_client: GlossaryManager, term_guid: str, categ
70
75
  egeria_client.add_term_to_category(term_guid, cat_guid)
71
76
 
72
77
 
73
- def extract_command(block: str) -> Optional[str]:
78
+ def extract_command_plus(block: str) -> tuple[str, str] | None:
74
79
  match = re.search(r"#(.*?)(?:##|\n|$)", block) # Using a non capturing group
75
80
  if match:
76
- return match.group(1).strip()
81
+ clean_match = match.group(1).strip()
82
+ parts = clean_match.split(' ')
83
+ object_action = parts[0].strip()
84
+ # Join the rest of the parts to allow object_type to be one or two words
85
+ object_type = ' '.join(parts[1:]).strip()
86
+ return object_type, object_action
77
87
  return None
78
88
 
89
+ def extract_command(block: str) -> str | None:
90
+ match = re.search(r"#(.*?)(?:##|\n|$)", block) # Using a non capturing group
91
+ if match:
92
+ return match.group(1).strip()
93
+ return None
79
94
 
80
95
  def extract_attribute(text: str, labels: List[str]) -> Optional[str]:
81
96
  """
@@ -145,6 +160,378 @@ def process_provenance_command(file_path: str, txt: [str]) -> str:
145
160
  existing_prov = existing_prov if existing_prov else " "
146
161
  return f"\n# Provenance:\n{existing_prov}\n{output}\n"
147
162
 
163
+ def process_element_identifiers(egeria_client: EgeriaTech, element_type:str, txt: str) -> tuple[str, str, str, bool, bool]:
164
+ """
165
+ Processes element identifiers by extracting display name and qualified name from the input text,
166
+ checking if the element exists in Egeria, and validating the information.
167
+
168
+ Parameters:
169
+ egeria_client: EgeriaTech
170
+ Client object for interacting with Egeria.
171
+ element_type: str
172
+ type of element to process (e.g., 'blueprint', 'category', 'term')
173
+ txt: str
174
+ A string representing the input text to be processed for extracting element identifiers.
175
+
176
+ Returns: tuple[str, str, str, bool, bool]
177
+ A tuple containing:
178
+ - qualified_name: Empty string or element identifier
179
+ - guid: Empty string or additional element information
180
+ - msg: Information or error messages about the processing
181
+ - Valid: Boolean indicating if the element information is valid
182
+ - Exists: Boolean indicating if the element exists in Egeria
183
+ """
184
+
185
+ msg = ""
186
+ known_guid = None
187
+ valid = True
188
+ exists = False
189
+ display_name = extract_attribute(txt, ["Display Name"])
190
+ if display_name is None:
191
+ msg = f"* {ERROR}Display name is missing\n"
192
+ valid = False
193
+ return "","", msg, valid, exists
194
+ qualified_name = extract_attribute(txt, ["Qualified Name"])
195
+ if qualified_name:
196
+ element_details = get_element_by_name(egeria_client,element_type,qualified_name)
197
+ else:
198
+ element_details = get_element_by_name(egeria_client,element_type,display_name)
199
+
200
+ if type(element_details) is str:
201
+ exists = False
202
+ else:
203
+ exists = True
204
+
205
+ if len(element_details) > 1 and exists:
206
+ msg += (f"* {ERROR}More than one element with name {display_name} found, please specify a "
207
+ f"**Qualified Name**\n")
208
+ valid = False
209
+ elif len(element_details) == 1:
210
+ known_guid = element_details[0]['elementHeader'].get('guid', None)
211
+ known_q_name = element_details[0]['glossaryTermProperties'].get('qualifiedName', None)
212
+ if qualified_name != known_q_name:
213
+ msg += (f"* {ERROR}Element {display_name} qualifiedName mismatch between {qualified_name} and {known_q_name}\n")
214
+ valid = False
215
+ else:
216
+ msg += f"\n--> * Element {display_name} exists and can be updated\n"
217
+ # msg += term_display
218
+ # element_dictionary[known_q_name] = {'display_name': display_name, 'guid': known_guid}
219
+ return qualified_name, known_guid, msg, valid, exists
220
+
221
+ def get_element_by_name(egeria_client, element_type: str, element_name: str):
222
+ """
223
+ Generalized function to retrieve an element by name based on its type.
224
+
225
+ Parameters:
226
+ egeria_client: Client
227
+ Client object for interacting with Egeria.
228
+ element_type: str
229
+ The type of element to retrieve (e.g., 'blueprint', 'category', 'term').
230
+ element_name: str
231
+ The name of the element to retrieve.
232
+
233
+ Returns:
234
+ The element if found, or a string indicating no elements were found.
235
+ """
236
+ # Convert element_type to plural form for method name construction
237
+ if element_type.endswith('y'):
238
+ plural_type = f"{element_type[:-1]}ies"
239
+ elif element_type.endswith('s'):
240
+ plural_type = f"{element_type}es"
241
+ else:
242
+ plural_type = f"{element_type}s"
243
+
244
+ # Construct method name
245
+ method_name = f"get_{plural_type}_by_name"
246
+
247
+ # Check if the method exists on the client
248
+ if hasattr(egeria_client, method_name):
249
+ # Call the method
250
+ method = getattr(egeria_client, method_name)
251
+ result = method(element_name)
252
+ return result
253
+ else:
254
+ # Method doesn't exist
255
+ return f"Method {method_name} not found on client"
256
+
257
+
258
+
259
+ def process_blueprint_upsert_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
260
+ directive: str = "display") -> Optional[str]:
261
+ """
262
+ Processes a blueprint create or update command by extracting key attributes such as
263
+ blueprint name, description, and version from the given cell.
264
+
265
+ Parameters:
266
+ egeria_client: SolutionArchitect
267
+ Client object for interacting with Egeria.
268
+ txt: str
269
+ A string representing the input cell to be processed for
270
+ extracting element attributes.
271
+ directive: str, optional, default "display"
272
+ An optional string indicating the directive to be used - display, validate or execute
273
+
274
+ Returns: str
275
+ A string summarizing the outcome of the processing.
276
+ """
277
+
278
+ object_type, object_action = extract_command_plus(txt)
279
+ element_display = ""
280
+ display_name = extract_attribute(txt, ['Display Name','Blueprint Name'])
281
+ description = extract_attribute(txt, ['Description'])
282
+ version = extract_attribute(txt, ['Version', "Version Identifier", "Published Version"])
283
+
284
+ print(Markdown(f"{pre_command} `{object_type}{object_action}` for Blueprint: `\'{display_name}\'` with directive: `{directive}`"))
285
+
286
+ known_q_name, known_guid, msg, valid, exists = process_element_identifiers(egeria_client, object_type,txt)
287
+
288
+ if description is None:
289
+ msg += f"* {INFO}Description is missing\n"
290
+
291
+ if version is None:
292
+ msg += f"* {INFO}Term version is missing\n"
293
+
294
+ update_description = extract_attribute(txt, ['Update Description'])
295
+ if update_description is None:
296
+ msg += f"* {INFO}Update Description is missing\n"
297
+ update_description = "---"
298
+
299
+ element_display = (f"\n* Command: {object_action} {object_type}\n\t* Blueprint: {display_name}\n\t"
300
+ f"* Description: {description}\n\t"
301
+ f"* Version: {version}\n\t* Qualified Name:{known_q_name}\n\t* GUID: {known_guid} "
302
+ f"\n\t* Update Description: {update_description}\n")
303
+
304
+ if object_action == "Update": # check to see if provided information exists and is consistent with existing info
305
+ if not exists:
306
+ msg += f"* {ERROR}Element {display_name} does not exist\n"
307
+ valid = False
308
+ element_dictionary[known_q_name] = {'display_name': display_name, 'guid': known_guid}
309
+
310
+ elif object_action == 'Create': # if the command is create, check that it doesn't already exist
311
+ if exists:
312
+ msg += f"\n{WARNING}Element \'{display_name}\' already exists.\n"
313
+ elif not valid:
314
+ msg += f"\n-->Validation checks failed in creating element \'{display_name}\' with: {element_display}\n"
315
+ else: # valid to create - update element_dictionary
316
+ msg += f"\n-->It is valid to create element \'{display_name}\' with: {element_display}\n"
317
+ if known_q_name is None:
318
+ known_q_name = egeria_client.__create_qualified_name__(object_type, display_name)
319
+ element_dictionary[known_q_name] = {'display_name': display_name}
320
+
321
+
322
+ if directive == "display":
323
+ print(Markdown(element_display))
324
+ return None
325
+ elif directive == "validate":
326
+ print(Markdown(msg))
327
+ return valid
328
+
329
+ elif directive == "process":
330
+ print(Markdown(msg))
331
+ try:
332
+ if not valid: # First validate the term before we process it
333
+ return None
334
+
335
+ if object_action == "Update" and directive == "process":
336
+ if not exists:
337
+ print(f"\n-->Blueprint {display_name} does not exist")
338
+ return None
339
+
340
+ # call update blueprint here
341
+
342
+ print(f"\n-->Updated Blueprint {display_name} with GUID {known_guid}")
343
+ # update with get blueprint by guid
344
+ return 'Would return get blueprint by guid and return md' #egeria_client.get_terms_by_guid(known_guid, 'md')
345
+
346
+ elif object_action == "Update" and directive == "validate":
347
+ return 'Would call get_blueprint_by_guid and return md' #egeria_client.get_terms_by_guid(known_guid, 'md')
348
+
349
+ elif object_action == "Create":
350
+ if exists:
351
+ print(f"\n{WARNING}Blueprint {display_name} exists and result document updated")
352
+ return update_a_command(txt, f"{object_type}{object_action}",
353
+ object_type, known_q_name, known_guid)
354
+ else:
355
+ # create the blueprint
356
+ #term_guid = egeria_client.create_controlled_glossary_term(glossary_guid, term_body)
357
+ # if term_guid == NO_ELEMENTS_FOUND:
358
+ # print(f"{ERROR}Term {term_name} not created")
359
+ # return None
360
+
361
+ print(f"\n-->Created Blueprint {display_name} with GUID {known_guid}")
362
+ element_dictionary[known_q_name] = {'guid': known_guid, 'display_name': display_name}
363
+ return 'Would return get blueprint by guid results as md' #egeria_client.get_terms_by_guid(term_guid, 'MD')
364
+
365
+ except Exception as e:
366
+ print(f"{ERROR}Error creating term {display_name}: {e}")
367
+ console.print_exception(show_locals=True)
368
+ return None
369
+
370
+
371
+
372
+ def process_solution_component_upsert_command(egeria_client: EgeriaTech, element_dictionary: dict, txt: str,
373
+ directive: str = "display") -> Optional[str]:
374
+ """
375
+ Processes a solution componentt create or update command by extracting key attributes such as
376
+ solution component name, description, version, solution component type etc from the given cell.
377
+
378
+ Parameters:
379
+ egeria_client: SolutionArchitect
380
+ Client object for interacting with Egeria.
381
+ txt: str
382
+ A string representing the input cell to be processed for
383
+ extracting element attributes.
384
+ directive: str, optional, default "display"
385
+ An optional string indicating the directive to be used - display, validate or execute
386
+
387
+ Returns: str
388
+ A string summarizing the outcome of the processing.
389
+ """
390
+
391
+ object_type, object_action = extract_command_plus(txt)
392
+ element_display = ""
393
+ bp_exist = True
394
+ display_name = extract_attribute(txt, ['Display Name', 'Solution Component Name'])
395
+ description = extract_attribute(txt, ['Description'])
396
+ version = extract_attribute(txt, ['Version', "Version Identifier", "Published Version"])
397
+ solution_component_type = extract_attribute(txt, ['Solution Component Type'])
398
+ planned_deployed_implementation_type = extract_attribute(txt, ['Planned Deployment Implementation Type'])
399
+ solution_blueprints = extract_attribute(txt, ['Solution Blueprints'])
400
+ parent_components = extract_attribute(txt, ['Parent Components'])
401
+
402
+ print(Markdown(
403
+ f"{pre_command} `{object_type}{object_action}` for Solution Component: `\'{display_name}\'` with directive: `{directive}`"))
404
+
405
+ known_q_name, known_guid, msg, valid, exists = process_element_identifiers(egeria_client, object_type,txt)
406
+
407
+ if description is None:
408
+ msg += f"* {INFO}Description is missing\n"
409
+
410
+ if version is None:
411
+ msg += f"* {INFO}Term version is missing\n"
412
+
413
+ update_description = extract_attribute(txt, ['Update Description'])
414
+ if update_description is None:
415
+ msg += f"* {INFO}Update Description is missing\n"
416
+ update_description = "---"
417
+
418
+ if solution_component_type is None:
419
+ msg += f"* {INFO}Solution Component Type is missing\n"
420
+
421
+ if planned_deployed_implementation_type is None:
422
+ msg += f"* {INFO}Planned Deployed Implementation Type is missing\n"
423
+
424
+ if solution_blueprints is None:
425
+ msg += f"* {INFO}No Solution Blueprints found\n"
426
+
427
+ else:
428
+ blueprint_list = re.split(r'[,\n]+', solution_blueprints)
429
+ blueprints = ""
430
+ new_blueprint_list = []
431
+ for blueprint in blueprint_list:
432
+ blueprint_el = blueprint.strip()
433
+ if blueprint_el not in element_dictionary:
434
+ # Get the blueprint using the generalized function
435
+ element_type = 'blueprint'
436
+ bp = get_element_by_name(egeria_client, element_type, blueprint_el)
437
+ if isinstance(bp, str):
438
+ msg += (f"* {WARNING}Blueprint `{blueprint_el}` not found -> "
439
+ f"Blueprints for this Solution Component won't be processed!\n")
440
+ bp_exist = False
441
+ break
442
+
443
+ # Extract properties using the element type name to construct property access
444
+ properties_key = f"{element_type}Properties"
445
+ bp_qname = bp[0][properties_key].get('qualifiedName', None)
446
+
447
+ if bp_qname not in element_dictionary:
448
+ bp_guid = bp[0]['elementHeader']['guid']
449
+ bp_display_name = bp[0][properties_key].get('displayName', None)
450
+ element_dictionary[bp_qname] = {
451
+ 'guid': bp_guid,
452
+ 'displayName': bp_display_name
453
+ }
454
+ blueprints = f"{bp_qname}, {blueprints}"
455
+ new_blueprint_list.append(bp_qname)
456
+ if bp_exist:
457
+ blueprints += '\n'
458
+ blueprint_list = new_blueprint_list
459
+ else:
460
+ blueprints = None
461
+
462
+ if parent_components is None:
463
+ msg += f"* {INFO}Parent Components are missing\n"
464
+
465
+ element_display = (f"\n* Command: {object_action} {object_type}\n\t* Blueprint: {display_name}\n\t"
466
+ f"* Description: {description}\n\t"
467
+ f"* Version: {version}\n\t* Qualified Name:{known_q_name}\n\t* GUID: {known_guid} "
468
+ f"\n\t* Update Description: {update_description}\n")
469
+
470
+ if object_action == "Update": # check to see if provided information exists and is consistent with existing info
471
+ if not exists:
472
+ msg += f"* {ERROR}Element {display_name} does not exist\n"
473
+ valid = False
474
+ element_dictionary[known_q_name] = {'display_name': display_name, 'guid': known_guid}
475
+
476
+ elif object_action == 'Create': # if the command is create, check that it doesn't already exist
477
+ if exists:
478
+ msg += f"\n{WARNING}Element \'{display_name}\' already exists.\n"
479
+ elif not valid:
480
+ msg += f"\n-->Validation checks failed in creating element \'{display_name}\' with: {element_display}\n"
481
+ else: # valid to create - update element_dictionary
482
+ msg += f"\n-->It is valid to create element \'{display_name}\' with: {element_display}\n"
483
+ if known_q_name is None:
484
+ known_q_name = egeria_client.__create_qualified_name__(object_type, display_name)
485
+ element_dictionary[known_q_name] = {'display_name': display_name}
486
+
487
+ if directive == "display":
488
+ print(Markdown(element_display))
489
+ return None
490
+ elif directive == "validate":
491
+ print(Markdown(msg))
492
+ return valid
493
+
494
+ elif directive == "process":
495
+ print(Markdown(msg))
496
+ try:
497
+ if not valid: # First validate the term before we process it
498
+ return None
499
+
500
+ if object_action == "Update" and directive == "process":
501
+ if not exists:
502
+ print(f"\n-->Blueprint {display_name} does not exist")
503
+ return None
504
+
505
+ # call update blueprint here
506
+
507
+ print(f"\n-->Updated Blueprint {display_name} with GUID {known_guid}")
508
+ # update with get blueprint by guid
509
+ return 'Would return get blueprint by guid and return md' # egeria_client.get_terms_by_guid(known_guid, 'md')
510
+
511
+ elif object_action == "Update" and directive == "validate":
512
+ return 'Would call get_blueprint_by_guid and return md' # egeria_client.get_terms_by_guid(known_guid, 'md')
513
+
514
+ elif object_action == "Create":
515
+ if exists:
516
+ print(f"\n{WARNING}Blueprint {display_name} exists and result document updated")
517
+ return update_a_command(txt, f"{object_type}{object_action}",
518
+ object_type, known_q_name, known_guid)
519
+ else:
520
+ # create the blueprint
521
+ # term_guid = egeria_client.create_controlled_glossary_term(glossary_guid, term_body)
522
+ # if term_guid == NO_ELEMENTS_FOUND:
523
+ # print(f"{ERROR}Term {term_name} not created")
524
+ # return None
525
+
526
+ print(f"\n-->Created Blueprint {display_name} with GUID {known_guid}")
527
+ element_dictionary[known_q_name] = {'guid': known_guid, 'display_name': display_name}
528
+ return 'Would return get blueprint by guid results as md' # egeria_client.get_terms_by_guid(term_guid, 'MD')
529
+
530
+ except Exception as e:
531
+ print(f"{ERROR}Error creating term {display_name}: {e}")
532
+ console.print_exception(show_locals=True)
533
+ return None
534
+
148
535
 
149
536
  def process_glossary_upsert_command(egeria_client: GlossaryManager, element_dictionary: dict, txt: str,
150
537
  directive: str = "display") -> Optional[str]:
@@ -161,7 +548,7 @@ def process_glossary_upsert_command(egeria_client: GlossaryManager, element_dict
161
548
  object_type = command.split(' ')[1].strip()
162
549
  object_action = command.split(' ')[0].strip()
163
550
 
164
- glossary_name = extract_attribute(txt, ['Glossary Name'])
551
+ glossary_name = extract_attribute(txt, ['Glossary Name','Display Name'])
165
552
  print(Markdown(f"{pre_command} `{command}` for glossary: `\'{glossary_name}\'` with directive: `{directive}` "))
166
553
  language = extract_attribute(txt, ['Language'])
167
554
  description = extract_attribute(txt, ['Description'])
@@ -177,16 +564,11 @@ def process_glossary_upsert_command(egeria_client: GlossaryManager, element_dict
177
564
  glossary_display += f"* Qualified Name: {q_name}\n\t* GUID: {guid}\n\n"
178
565
 
179
566
  def validate_glossary(obj_action: str) -> tuple[bool, bool, Optional[str], Optional[str]]:
567
+
180
568
  valid = True
181
569
  msg = ""
182
- known_glossary_guid = None
183
- known_q_name = None
184
570
 
185
- glossary_details = egeria_client.get_glossaries_by_name(glossary_name)
186
- if glossary_details == NO_GLOSSARIES_FOUND:
187
- glossary_exists = False
188
- else:
189
- glossary_exists = True
571
+ known_q_name, known_guid, msg, valid, glossary_exists = process_element_identifiers(egeria_client, object_type,txt)
190
572
 
191
573
  if glossary_name is None:
192
574
  msg = f"* {ERROR}Glossary name is missing\n"
@@ -197,13 +579,6 @@ def process_glossary_upsert_command(egeria_client: GlossaryManager, element_dict
197
579
  if description is None:
198
580
  msg += f"* {INFO}Description is missing\n"
199
581
 
200
- if len(glossary_details) > 1 and glossary_exists:
201
- msg += f"* {ERROR}More than one glossary with name {glossary_name} found\n"
202
- valid = False
203
- if len(glossary_details) == 1:
204
- known_glossary_guid = glossary_details[0]['elementHeader'].get('guid', None)
205
- known_q_name = glossary_details[0]['glossaryProperties'].get('qualifiedName', None).strip()
206
-
207
582
  if obj_action == "Update":
208
583
 
209
584
  if not glossary_exists:
@@ -220,12 +595,12 @@ def process_glossary_upsert_command(egeria_client: GlossaryManager, element_dict
220
595
  if valid:
221
596
  msg += glossary_display
222
597
  msg += f"* -->Glossary `{glossary_name}` exists and can be updated\n"
223
- element_dictionary[known_q_name] = {'display_name': glossary_name, 'guid': known_glossary_guid}
598
+ element_dictionary[known_q_name] = {'display_name': glossary_name, 'guid': known_guid}
224
599
  else:
225
600
  msg += f"* --> validation failed\n"
226
601
 
227
602
  print(Markdown(msg))
228
- return valid, glossary_exists, known_glossary_guid, known_q_name
603
+ return valid, glossary_exists, known_guid, known_q_name
229
604
 
230
605
  elif obj_action == "Create":
231
606
  if glossary_exists:
@@ -238,7 +613,7 @@ def process_glossary_upsert_command(egeria_client: GlossaryManager, element_dict
238
613
  element_dictionary[expected_q_name] = {'display_name': glossary_name}
239
614
 
240
615
  print(Markdown(msg))
241
- return valid, glossary_exists, known_glossary_guid, known_q_name
616
+ return valid, glossary_exists, known_guid, known_q_name
242
617
 
243
618
  if directive == "display":
244
619
  print(Markdown(glossary_display))
@@ -479,7 +854,7 @@ def process_term_upsert_command(egeria_client: GlossaryManager, element_dictiona
479
854
  object_type = command.split(' ')[1].strip()
480
855
  object_action = command.split(' ')[0].strip()
481
856
 
482
- term_name = extract_attribute(txt, ['Term Name'])
857
+ term_name = extract_attribute(txt, ['Term Name','Display Name'])
483
858
  summary = extract_attribute(txt, ['Summary'])
484
859
  description = extract_attribute(txt, ['Description'])
485
860
  abbreviation = extract_attribute(txt, ['Abbreviation'])
@@ -630,9 +1005,11 @@ def process_term_upsert_command(egeria_client: GlossaryManager, element_dictiona
630
1005
  msg += f"\n-->Validation checks failed in creating Term \'{term_name}\' with: {term_display}\n"
631
1006
  else:
632
1007
  msg += f"\n-->It is valid to create Term \'{term_name}\' with: {term_display}\n"
633
- expected_q_name = egeria_client.__create_qualified_name__('Term', term_name)
634
- element_dictionary[expected_q_name] = {'display_name': term_name}
635
-
1008
+ if q_name is None:
1009
+ expected_q_name = egeria_client.__create_qualified_name__('Term', term_name)
1010
+ element_dictionary[expected_q_name] = {'display_name': term_name}
1011
+ else:
1012
+ element_dictionary[q_name] = {'display_name': term_name}
636
1013
  print(Markdown(msg))
637
1014
  return valid, term_exists, known_term_guid, known_q_name
638
1015
 
@@ -645,8 +1022,8 @@ def process_term_upsert_command(egeria_client: GlossaryManager, element_dictiona
645
1022
  update_description = extract_attribute(txt, 'Update Description')
646
1023
  update_description = update_description if update_description else " "
647
1024
  term_display = (f"\n* Command: {command}\n\t* Glossary: {glossary_qn}\n\t"
648
- f"* Term Name: {term_name}\n\t* Categories: {categories}\n\t* Summary: {summary}"
649
- f"\n\t* Description: {description}\n\t"
1025
+ f"* Term Name: {term_name}\n\t* Qualified Name: {q_name}\n\t* Categories: {categories}\n\t"
1026
+ f"* Summary: {summary}\n\t* Description: {description}\n\t"
650
1027
  f"* Abbreviation: {abbreviation}\n\t* Examples: {examples}\n\t* Usage: {usage}\n\t"
651
1028
  f"* Version: {version}\n\t* Status: {status}\n\t* GUID: {term_guid}\n\t* Qualified Name: "
652
1029
  f"{q_name}"
@@ -654,7 +1031,7 @@ def process_term_upsert_command(egeria_client: GlossaryManager, element_dictiona
654
1031
  else:
655
1032
  term_display = (f"\n* Command: {command}\n\t* Glossary: {glossary_qn}\n\t"
656
1033
  f"* Term Name: {term_name}\n\t* Categories: {categories}\n\t* Summary: {summary}\n\t"
657
- f"* Description: {description}\n\t"
1034
+ f"* Qualified Name: {q_name}\n\t* Description: {description}\n\t"
658
1035
  f"* Abbreviation: {abbreviation}\n\t* Examples: {examples}\n\t* Usage: {usage}\n\t"
659
1036
  f"* Version: {version}\n\t* Status: {status}\n")
660
1037
 
@@ -708,8 +1085,8 @@ def process_term_upsert_command(egeria_client: GlossaryManager, element_dictiona
708
1085
 
709
1086
  elif object_action == "Create":
710
1087
  guid = None
711
-
712
- q_name = egeria_client.__create_qualified_name__("Term",term_name)
1088
+ if q_name is None:
1089
+ q_name = egeria_client.__create_qualified_name__("Term",term_name)
713
1090
  if exists:
714
1091
  print(f"\n{WARNING}Term {term_name} exists and result document updated")
715
1092
  return update_a_command(txt, command, object_type, q_name, known_guid)