pyegeria 5.3.8.9__py3-none-any.whl → 5.3.9.1__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.
@@ -12,6 +12,7 @@ from datetime import datetime
12
12
 
13
13
  from pyegeria import NO_GLOSSARIES_FOUND, max_paging_size
14
14
  from pyegeria._client import Client
15
+ from pyegeria._exceptions import InvalidParameterException, PropertyServerException, UserNotAuthorizedException
15
16
  from pyegeria._globals import NO_CATEGORIES_FOUND, NO_TERMS_FOUND
16
17
  from pyegeria._validators import validate_guid, validate_name, validate_search_string
17
18
  from pyegeria.utils import body_slimmer
@@ -133,8 +134,8 @@ class GlossaryBrowser(Client):
133
134
  cat_md_qn = ''
134
135
  if type(categories) is list:
135
136
  for category in categories:
136
- cat_md_display += f"* {category['glossaryCategoryProperties'][('displayName')]}\n"
137
- cat_md_qn += f"* {category['glossaryCategoryProperties'][('qualifiedName')]}\n"
137
+ cat_md_display += f" {category['glossaryCategoryProperties'][('displayName')]},\n"
138
+ cat_md_qn += f" {category['glossaryCategoryProperties'][('qualifiedName')]},\n"
138
139
  cat_md = cat_md_display.strip()
139
140
  cat_md_qn = cat_md_qn.strip()
140
141
 
@@ -222,7 +223,8 @@ class GlossaryBrowser(Client):
222
223
  str: Markdown representation
223
224
  """
224
225
  return self._generate_entity_md(elements=elements, elements_action=elements_action, output_format=output_format,
225
- entity_type="Glossary", extract_properties_func=self._extract_glossary_properties)
226
+ entity_type="Glossary",
227
+ extract_properties_func=self._extract_glossary_properties)
226
228
 
227
229
  def _generate_entity_md_table(self, elements: list, search_string: str, entity_type: str, extract_properties_func,
228
230
  columns: list, get_additional_props_func=None, output_format: str = 'LIST') -> str:
@@ -302,14 +304,15 @@ class GlossaryBrowser(Client):
302
304
  str: Markdown table
303
305
  """
304
306
  columns = [{'name': 'Glossary Name', 'key': 'display_name'},
305
- {'name': 'Qualified Name', 'key': 'qualified_name'},
306
- {'name': 'Language', 'key': 'language', 'format': True},
307
- {'name': 'Description', 'key': 'description', 'format': True},
308
- {'name': 'Usage', 'key': 'usage', 'format': True},
309
- {'name': 'Categories', 'key': 'categories_dn_md', 'format': True}, ]
307
+ {'name': 'Qualified Name', 'key': 'qualified_name'},
308
+ {'name': 'Language', 'key': 'language', 'format': True},
309
+ {'name': 'Description', 'key': 'description', 'format': True},
310
+ {'name': 'Usage', 'key': 'usage', 'format': True},
311
+ {'name': 'Categories', 'key': 'categories_dn_md', 'format': True}, ]
310
312
 
311
313
  return self._generate_entity_md_table(elements=elements, search_string=search_string, entity_type="Glossary",
312
- extract_properties_func=self._extract_glossary_properties, columns=columns)
314
+ extract_properties_func=self._extract_glossary_properties,
315
+ columns=columns)
313
316
 
314
317
  def _generate_entity_dict(self, elements: list, extract_properties_func, get_additional_props_func=None,
315
318
  include_keys=None, exclude_keys=None, output_format: str = 'DICT') -> list:
@@ -368,7 +371,7 @@ class GlossaryBrowser(Client):
368
371
  list: List of glossary dictionaries
369
372
  """
370
373
  return self._generate_entity_dict(elements=elements, extract_properties_func=self._extract_glossary_properties,
371
- exclude_keys=['properties', 'categories_qn_md'], output_format=output_format)
374
+ exclude_keys=['properties', 'categories_qn_md'], output_format=output_format)
372
375
 
373
376
  def generate_glossaries_md(self, elements: list | dict, search_string: str,
374
377
  output_format: str = 'MD') -> str | list:
@@ -423,11 +426,12 @@ class GlossaryBrowser(Client):
423
426
  pub_version = properties.get("publishVersionIdentifier", "") or ""
424
427
  qualified_name = properties.get("qualifiedName", "") or ""
425
428
  status = element['elementHeader'].get('status', "") or ""
429
+ aliases = ", ".join(properties.get("aliases", "")) or ""
426
430
 
427
431
  return {
428
- 'guid': guid, 'properties': properties, 'display_name': display_name, 'summary': summary,
429
- 'description': description, 'examples': examples, 'usage': usage, 'version identifier': pub_version,
430
- 'qualified_name': qualified_name, 'status': status
432
+ 'guid': guid, 'properties': properties, 'display_name': display_name, 'aliases': aliases,
433
+ 'summary': summary, 'description': description, 'examples': examples, 'usage': usage,
434
+ 'version identifier': pub_version, 'qualified_name': qualified_name, 'status': status
431
435
  }
432
436
 
433
437
  def _get_categories_for_term(self, term_guid: str, output_format: str = None) -> tuple[list, str]:
@@ -448,7 +452,7 @@ class GlossaryBrowser(Client):
448
452
 
449
453
  category_list = self.get_categories_for_term(term_guid)
450
454
  if type(category_list) is str and category_list == NO_CATEGORIES_FOUND:
451
- category_list_md = '---'
455
+ category_list_md = ''
452
456
  elif isinstance(category_list, list) and len(category_list) > 0:
453
457
  first_cat = True
454
458
  for category in category_list:
@@ -506,16 +510,17 @@ class GlossaryBrowser(Client):
506
510
  str: Markdown table
507
511
  """
508
512
  columns = [{'name': 'Term Name', 'key': 'display_name'}, {'name': 'Qualified Name', 'key': 'qualified_name'},
509
- {'name': 'Summary', 'key': 'summary', 'format': True}, {'name': 'Glossary', 'key': 'glossary'},
510
- {'name': 'Categories', 'key': 'categories_str', 'format': True}]
513
+ {'name': 'Aliases', 'key': 'aliases', 'format': True},
514
+ {'name': 'Summary', 'key': 'summary', 'format': True}, {'name': 'Glossary', 'key': 'glossary'},
515
+ {'name': 'Categories', 'key': 'categories_str', 'format': True}]
511
516
 
512
517
  # Create a wrapper function to pass output_format to _get_term_table_properties
513
518
  def get_table_props_with_format(element, term_guid, output_format_param=None):
514
519
  return self._get_term_table_properties(element, term_guid, output_format)
515
520
 
516
521
  return self._generate_entity_md_table(elements=elements, search_string=search_string, entity_type="Term",
517
- extract_properties_func=self._extract_term_properties, columns=columns,
518
- get_additional_props_func=get_table_props_with_format)
522
+ extract_properties_func=self._extract_term_properties, columns=columns,
523
+ get_additional_props_func=get_table_props_with_format)
519
524
 
520
525
  def _get_term_dict_properties(self, element: dict, term_guid: str, output_format: str = None) -> dict:
521
526
  """
@@ -557,9 +562,10 @@ class GlossaryBrowser(Client):
557
562
  return self._get_term_dict_properties(element, term_guid, output_format)
558
563
 
559
564
  return self._generate_entity_dict(elements=elements, extract_properties_func=self._extract_term_properties,
560
- get_additional_props_func=get_dict_props_with_format, exclude_keys=['properties', 'pub_version']
561
- # Exclude raw properties and pub_version (renamed to version)
562
- )
565
+ get_additional_props_func=get_dict_props_with_format,
566
+ exclude_keys=['properties', 'pub_version']
567
+ # Exclude raw properties and pub_version (renamed to version)
568
+ )
563
569
 
564
570
  def _get_term_additional_properties(self, element: dict, term_guid: str, output_format: str = None) -> dict:
565
571
  """
@@ -596,8 +602,8 @@ class GlossaryBrowser(Client):
596
602
  str: Markdown representation
597
603
  """
598
604
  return self._generate_entity_md(elements=elements, elements_action=elements_action, output_format=output_format,
599
- entity_type="Term", extract_properties_func=self._extract_term_properties,
600
- get_additional_props_func=self._get_term_additional_properties)
605
+ entity_type="Term", extract_properties_func=self._extract_term_properties,
606
+ get_additional_props_func=self._get_term_additional_properties)
601
607
 
602
608
  def generate_terms_md(self, elements: list | dict, search_string: str, output_format: str = 'MD') -> str | list:
603
609
  """
@@ -775,17 +781,18 @@ class GlossaryBrowser(Client):
775
781
  str: Markdown table
776
782
  """
777
783
  columns = [{'name': 'Display Name', 'key': 'display_name'},
778
- {'name': 'Description', 'key': 'description', 'format': True},
779
- {'name': 'Qualified Name', 'key': 'qualified_name'}, {'name': 'Parent Category', 'key': 'parent_category'},
780
- {'name': 'Subcategories', 'key': 'subcategories', 'format': True}]
784
+ {'name': 'Description', 'key': 'description', 'format': True},
785
+ {'name': 'Qualified Name', 'key': 'qualified_name'},
786
+ {'name': 'Parent Category', 'key': 'parent_category'},
787
+ {'name': 'Subcategories', 'key': 'subcategories', 'format': True}]
781
788
 
782
789
  # Create a wrapper function to pass output_format to _get_category_table_properties
783
790
  def get_table_props_with_format(element, category_guid, output_format_param=None):
784
791
  return self._get_category_table_properties(element, category_guid, output_format)
785
792
 
786
793
  return self._generate_entity_md_table(elements=elements, search_string=search_string, entity_type="Category",
787
- extract_properties_func=self._extract_category_properties, columns=columns,
788
- get_additional_props_func=get_table_props_with_format)
794
+ extract_properties_func=self._extract_category_properties,
795
+ columns=columns, get_additional_props_func=get_table_props_with_format)
789
796
 
790
797
  def _get_category_dict_properties(self, element: dict, category_guid: str, output_format: str = None) -> dict:
791
798
  """
@@ -829,8 +836,9 @@ class GlossaryBrowser(Client):
829
836
  return self._get_category_dict_properties(element, category_guid, output_format)
830
837
 
831
838
  return self._generate_entity_dict(elements=elements, extract_properties_func=self._extract_category_properties,
832
- get_additional_props_func=get_dict_props_with_format, exclude_keys=['properties'], # Exclude raw properties
833
- output_format=output_format)
839
+ get_additional_props_func=get_dict_props_with_format,
840
+ exclude_keys=['properties'], # Exclude raw properties
841
+ output_format=output_format)
834
842
 
835
843
  def _get_category_additional_properties(self, element: dict, category_guid: str, output_format: str = None) -> dict:
836
844
  """
@@ -881,8 +889,9 @@ class GlossaryBrowser(Client):
881
889
  return self._get_category_additional_properties(element, category_guid, output_format)
882
890
 
883
891
  return self._generate_entity_md(elements=elements, elements_action=elements_action, output_format=output_format,
884
- entity_type="Category", extract_properties_func=self._extract_category_properties,
885
- get_additional_props_func=get_additional_props_with_format)
892
+ entity_type="Category",
893
+ extract_properties_func=self._extract_category_properties,
894
+ get_additional_props_func=get_additional_props_with_format)
886
895
 
887
896
  def generate_categories_md(self, elements: list | dict, search_string: str,
888
897
  output_format: str = 'MD') -> str | list:
@@ -1036,14 +1045,51 @@ class GlossaryBrowser(Client):
1036
1045
  response = loop.run_until_complete(self._async_get_glossary_term_statuses())
1037
1046
  return response
1038
1047
 
1048
+ async def _async_get_term_relationship_types(self) -> [str]:
1049
+ """Return the list of term relationship types enum values. Async version.
1050
+
1051
+ Parameters
1052
+ ----------
1053
+
1054
+
1055
+ Returns
1056
+ -------
1057
+ List[str]
1058
+ A list of glossary term relationships retrieved from the server.
1059
+
1060
+ """
1061
+
1062
+ url = (f"{self.platform_url}/servers/{self.view_server}"
1063
+ f"/api/open-metadata/glossary-manager/glossaries/terms/relationships/type-names")
1064
+
1065
+ response = await self._async_make_request("GET", url)
1066
+ return response.json().get("names", [])
1067
+
1068
+ def get_term_relationship_types(self) -> [str]:
1069
+ """Return the list of term relationship type enum values.
1070
+
1071
+ Parameters
1072
+ ----------
1073
+
1074
+
1075
+ Returns
1076
+ -------
1077
+ list of str
1078
+ A list of term relationship types. Each status is represented as a string.
1079
+
1080
+ """
1081
+ loop = asyncio.get_event_loop()
1082
+ response = loop.run_until_complete(self._async_get_term_relationship_types())
1083
+ return response
1084
+
1039
1085
  #
1040
1086
  # Glossaries
1041
1087
  #
1042
1088
 
1043
1089
  async def _async_find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
1044
- ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
1045
- for_duplicate_processing: bool = False, type_name: str = None, start_from: int = 0, page_size: int = None,
1046
- output_format: str = 'JSON') -> list | str:
1090
+ ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
1091
+ for_duplicate_processing: bool = False, type_name: str = None, start_from: int = 0,
1092
+ page_size: int = None, output_format: str = 'JSON') -> list | str:
1047
1093
  """Retrieve the list of glossary metadata elements that contain the search string. Async version.
1048
1094
  The search string is located in the request body and is interpreted as a plain string.
1049
1095
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
@@ -1139,9 +1185,9 @@ class GlossaryBrowser(Client):
1139
1185
  return response.json().get("elementList", NO_GLOSSARIES_FOUND)
1140
1186
 
1141
1187
  def find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
1142
- ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
1143
- for_duplicate_processing: bool = False, type_name: str = None, start_from: int = 0, page_size: int = None,
1144
- output_format: str = "JSON") -> list | str:
1188
+ ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
1189
+ for_duplicate_processing: bool = False, type_name: str = None, start_from: int = 0,
1190
+ page_size: int = None, output_format: str = "JSON") -> list | str:
1145
1191
  """Retrieve the list of glossary metadata elements that contain the search string.
1146
1192
  The search string is located in the request body and is interpreted as a plain string.
1147
1193
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
@@ -1203,12 +1249,12 @@ class GlossaryBrowser(Client):
1203
1249
  loop = asyncio.get_event_loop()
1204
1250
  response = loop.run_until_complete(
1205
1251
  self._async_find_glossaries(search_string, effective_time, starts_with, ends_with, ignore_case, for_lineage,
1206
- for_duplicate_processing, type_name, start_from, page_size, output_format))
1252
+ for_duplicate_processing, type_name, start_from, page_size, output_format))
1207
1253
 
1208
1254
  return response
1209
1255
 
1210
1256
  async def _async_get_glossary_by_guid(self, glossary_guid: str, effective_time: str = None,
1211
- output_format: str = "JSON") -> dict | str:
1257
+ output_format: str = "JSON") -> dict | str:
1212
1258
  """Retrieves information about a glossary
1213
1259
  Parameters
1214
1260
  ----------
@@ -1300,7 +1346,7 @@ class GlossaryBrowser(Client):
1300
1346
  return response
1301
1347
 
1302
1348
  async def _async_get_glossaries_by_name(self, glossary_name: str, effective_time: str = None, start_from: int = 0,
1303
- page_size: int = None, ) -> dict | str:
1349
+ page_size: int = None, ) -> dict | str:
1304
1350
  """Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
1305
1351
  There are no wildcards supported on this request.
1306
1352
 
@@ -1353,7 +1399,7 @@ class GlossaryBrowser(Client):
1353
1399
  return response.json().get("elementList", "No glossaries found")
1354
1400
 
1355
1401
  def get_glossaries_by_name(self, glossary_name: str, effective_time: str = None, start_from: int = 0,
1356
- page_size: int = None, ) -> dict | str:
1402
+ page_size: int = None, ) -> dict | str:
1357
1403
  """Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
1358
1404
  There are no wildcards supported on this request.
1359
1405
 
@@ -1397,7 +1443,7 @@ class GlossaryBrowser(Client):
1397
1443
  #
1398
1444
 
1399
1445
  async def _async_get_glossary_for_category(self, glossary_category_guid: str,
1400
- effective_time: str = None, ) -> dict | str:
1446
+ effective_time: str = None, ) -> dict | str:
1401
1447
  """Retrieve the glossary metadata element for the requested category. The optional request body allows you to
1402
1448
  specify that the glossary element should only be returned if it was effective at a particular time.
1403
1449
 
@@ -1476,8 +1522,9 @@ class GlossaryBrowser(Client):
1476
1522
  return response
1477
1523
 
1478
1524
  async def _async_get_glossary_subcategories(self, glossary_category_guid: str, effective_time: str = None,
1479
- start_from: int = 0, page_size: int = max_paging_size, for_lineage: bool = False,
1480
- for_duplicate_processing: bool = False, ) -> dict | str:
1525
+ start_from: int = 0, page_size: int = max_paging_size,
1526
+ for_lineage: bool = False,
1527
+ for_duplicate_processing: bool = False, ) -> dict | str:
1481
1528
  """Glossary categories can be organized in a hierarchy. Retrieve the subcategories for the glossary category
1482
1529
  metadata element with the supplied unique identifier. If the requested category does not have any subcategories,
1483
1530
  null is returned. The optional request body contain an effective time for the query.
@@ -1533,10 +1580,9 @@ class GlossaryBrowser(Client):
1533
1580
 
1534
1581
  return response.json().get("elementList", "No categories found")
1535
1582
 
1536
-
1537
1583
  def get_glossary_subcategories(self, glossary_category_guid: str, effective_time: str = None, start_from: int = 0,
1538
- page_size: int = max_paging_size, for_lineage: bool = False,
1539
- for_duplicate_processing: bool = False, ) -> dict | str:
1584
+ page_size: int = max_paging_size, for_lineage: bool = False,
1585
+ for_duplicate_processing: bool = False, ) -> dict | str:
1540
1586
  """Glossary categories can be organized in a hierarchy. Retrieve the subcategories for the glossary category
1541
1587
  metadata element with the supplied unique identifier. If the requested category does not have any subcategories,
1542
1588
  null is returned. The optional request body contain an effective time for the query.
@@ -1577,12 +1623,13 @@ class GlossaryBrowser(Client):
1577
1623
  loop = asyncio.get_event_loop()
1578
1624
  response = loop.run_until_complete(
1579
1625
  self._async_get_glossary_subcategories(glossary_category_guid, effective_time, start_from, page_size,
1580
- for_lineage, for_duplicate_processing))
1626
+ for_lineage, for_duplicate_processing))
1581
1627
  return response
1582
1628
 
1583
1629
  async def _async_find_glossary_categories(self, search_string: str, effective_time: str = None,
1584
- starts_with: bool = False, ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
1585
- page_size: int = None, output_format: str = "JSON") -> list | str:
1630
+ starts_with: bool = False, ends_with: bool = False,
1631
+ ignore_case: bool = False, start_from: int = 0, page_size: int = None,
1632
+ output_format: str = "JSON") -> list | str:
1586
1633
  """Retrieve the list of glossary category metadata elements that contain the search string.
1587
1634
  The search string is located in the request body and is interpreted as a plain string.
1588
1635
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
@@ -1666,8 +1713,8 @@ class GlossaryBrowser(Client):
1666
1713
  return response.json().get("elementList", NO_CATEGORIES_FOUND)
1667
1714
 
1668
1715
  def find_glossary_categories(self, search_string: str, effective_time: str = None, starts_with: bool = False,
1669
- ends_with: bool = False, ignore_case: bool = False, start_from: int = 0, page_size: int = None,
1670
- output_format: str = "JSON") -> list | str:
1716
+ ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
1717
+ page_size: int = None, output_format: str = "JSON") -> list | str:
1671
1718
  """Retrieve the list of glossary category metadata elements that contain the search string.
1672
1719
  The search string is located in the request body and is interpreted as a plain string.
1673
1720
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
@@ -1721,12 +1768,12 @@ class GlossaryBrowser(Client):
1721
1768
  loop = asyncio.get_event_loop()
1722
1769
  response = loop.run_until_complete(
1723
1770
  self._async_find_glossary_categories(search_string, effective_time, starts_with, ends_with, ignore_case,
1724
- start_from, page_size, output_format))
1771
+ start_from, page_size, output_format))
1725
1772
 
1726
1773
  return response
1727
1774
 
1728
1775
  async def _async_get_categories_for_glossary(self, glossary_guid: str, start_from: int = 0,
1729
- page_size: int = None, ) -> list | str:
1776
+ page_size: int = None, ) -> list | str:
1730
1777
  """Return the list of categories associated with a glossary.
1731
1778
  Async version.
1732
1779
 
@@ -1769,7 +1816,7 @@ class GlossaryBrowser(Client):
1769
1816
  return response.json().get("elementList", "No Categories found")
1770
1817
 
1771
1818
  def get_categories_for_glossary(self, glossary_guid: str, start_from: int = 0,
1772
- page_size: int = None, ) -> list | str:
1819
+ page_size: int = None, ) -> list | str:
1773
1820
  """Return the list of categories associated with a glossary.
1774
1821
 
1775
1822
  Parameters
@@ -1806,7 +1853,7 @@ class GlossaryBrowser(Client):
1806
1853
  return response
1807
1854
 
1808
1855
  async def _async_get_categories_for_term(self, glossary_term_guid: str, start_from: int = 0,
1809
- page_size: int = None, ) -> list | str:
1856
+ page_size: int = None, ) -> list | str:
1810
1857
  """Return the list of categories associated with a glossary term.
1811
1858
  Async version.
1812
1859
 
@@ -1845,10 +1892,10 @@ class GlossaryBrowser(Client):
1845
1892
  f"{glossary_term_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}")
1846
1893
 
1847
1894
  response = await self._async_make_request("POST", url)
1848
- return response.json().get("elementList", "No Categories found")
1895
+ return response.json().get("elementList", NO_CATEGORIES_FOUND)
1849
1896
 
1850
1897
  def get_categories_for_term(self, glossary_term_guid: str, start_from: int = 0,
1851
- page_size: int = None, ) -> list | str:
1898
+ page_size: int = None, ) -> list | str:
1852
1899
  """Return the list of categories associated with a glossary term.
1853
1900
 
1854
1901
  Parameters
@@ -1884,7 +1931,7 @@ class GlossaryBrowser(Client):
1884
1931
  return response
1885
1932
 
1886
1933
  async def _async_get_categories_by_name(self, name: str, glossary_guid: str = None, status: [str] = ["ACTIVE"],
1887
- start_from: int = 0, page_size: int = None, ) -> list | str:
1934
+ start_from: int = 0, page_size: int = None, ) -> list | str:
1888
1935
  """Retrieve the list of glossary category metadata elements that either have the requested qualified name or
1889
1936
  display name. The name to search for is located in the request body and is interpreted as a plain string.
1890
1937
  The request body also supports the specification of a glossaryGUID to restrict the search to within a single
@@ -1898,12 +1945,8 @@ class GlossaryBrowser(Client):
1898
1945
  category name to search for.
1899
1946
  glossary_guid: str, optional
1900
1947
  The identity of the glossary to search. If not specified, all glossaries will be searched.
1901
- status: [str], optional
1902
- A list of statuses to optionally restrict results. Default is Active
1903
-
1904
- If not provided, the server name associated with the instance is used.
1905
1948
  start_from: int, [default=0], optional
1906
- When multiple pages of results are available, the page number to start from.
1949
+ When multiple pages of results are available, the page number to start from.
1907
1950
  page_size: int, [default=None]
1908
1951
  The number of items to return in a single page. If not specified, the default will be taken from
1909
1952
  the class instance.
@@ -1942,7 +1985,7 @@ class GlossaryBrowser(Client):
1942
1985
  return response.json().get("elementList", NO_CATEGORIES_FOUND)
1943
1986
 
1944
1987
  def get_categories_by_name(self, name: str, glossary_guid: str = None, status: [str] = ["ACTIVE"],
1945
- start_from: int = 0, page_size: int = None, ) -> list | str:
1988
+ start_from: int = 0, page_size: int = None) -> list | str:
1946
1989
  """Retrieve the list of glossary category metadata elements that either have the requested qualified name or
1947
1990
  display name. The name to search for is located in the request body and is interpreted as a plain string.
1948
1991
  The request body also supports the specification of a glossaryGUID to restrict the search to within a
@@ -1954,10 +1997,6 @@ class GlossaryBrowser(Client):
1954
1997
  category name to search for.
1955
1998
  glossary_guid: str, optional
1956
1999
  The identity of the glossary to search. If not specified, all glossaries will be searched.
1957
- status: [str], optional
1958
- A list of statuses to optionally restrict results. Default is Active
1959
-
1960
- If not provided, the server name associated with the instance is used.
1961
2000
  start_from: int, [default=0], optional
1962
2001
  When multiple pages of results are available, the page number to start from.
1963
2002
  page_size: int, [default=None]
@@ -2249,18 +2288,13 @@ class GlossaryBrowser(Client):
2249
2288
  parent_guid = parent['elementHeader']['guid']
2250
2289
  parent_name = parent['glossaryCategoryProperties'].get('displayName', '---')
2251
2290
  parent_info = {
2252
- 'guid': parent_guid,
2253
- 'name': parent_name
2254
- }
2291
+ 'guid': parent_guid, 'name': parent_name
2292
+ }
2255
2293
 
2256
2294
  return {
2257
- 'guid': category_guid,
2258
- 'name': display_name,
2259
- 'qualifiedName': qualified_name,
2260
- 'description': description,
2261
- 'parent': parent_info,
2262
- 'children': children
2263
- }
2295
+ 'guid': category_guid, 'name': display_name, 'qualifiedName': qualified_name,
2296
+ 'description': description, 'parent': parent_info, 'children': children
2297
+ }
2264
2298
 
2265
2299
  # Build tree for each root category
2266
2300
  for root_guid in root_guids:
@@ -2271,9 +2305,8 @@ class GlossaryBrowser(Client):
2271
2305
  # Format the output according to the specified output_format
2272
2306
  if output_format == "DICT":
2273
2307
  return {
2274
- 'glossary_guid': glossary_guid,
2275
- 'categories': category_tree
2276
- }
2308
+ 'glossary_guid': glossary_guid, 'categories': category_tree
2309
+ }
2277
2310
  elif output_format == "LIST":
2278
2311
  # Generate markdown table
2279
2312
  md_table = "| Category | Path | Description | Parent Category | Child Categories |\n"
@@ -2295,7 +2328,9 @@ class GlossaryBrowser(Client):
2295
2328
  child_names.append(child['name'])
2296
2329
  child_categories = ", ".join(child_names) if child_names else "None"
2297
2330
 
2298
- md_table += f"| {category['name']} | {category_path} | {self._format_for_markdown_table(category['description'])} | {parent_name} | {child_categories} |\n"
2331
+ md_table += (f"| {category['name']} | {category_path} | "
2332
+ f"{self._format_for_markdown_table(category['description'])} | "
2333
+ f"{parent_name} | {child_categories} |\n")
2299
2334
  if category['children']:
2300
2335
  add_categories_to_table(category['children'], category_path)
2301
2336
 
@@ -2327,14 +2362,12 @@ class GlossaryBrowser(Client):
2327
2362
  else:
2328
2363
  return f"Unsupported output format: {output_format}. Use 'DICT', 'LIST', or 'MD'."
2329
2364
 
2330
-
2331
-
2332
2365
  #
2333
2366
  # Terms
2334
2367
  #
2335
2368
 
2336
2369
  async def _async_get_terms_for_category(self, glossary_category_guid: str, effective_time: str = None,
2337
- start_from: int = 0, page_size: int = None, ) -> list | str:
2370
+ start_from: int = 0, page_size: int = None, ) -> list | str:
2338
2371
  """Retrieve ALL the glossary terms in a category.
2339
2372
  The request body also supports the specification of an effective time for the query.
2340
2373
 
@@ -2385,7 +2418,7 @@ class GlossaryBrowser(Client):
2385
2418
  return response.json().get("elementList", "No terms found")
2386
2419
 
2387
2420
  def get_terms_for_category(self, glossary_category_guid: str, effective_time: str = None, start_from: int = 0,
2388
- page_size: int = None, ) -> list | str:
2421
+ page_size: int = None, ) -> list | str:
2389
2422
  """Retrieve ALL the glossary terms in a category.
2390
2423
  The request body also supports the specification of an effective time for the query.
2391
2424
 
@@ -2426,7 +2459,7 @@ class GlossaryBrowser(Client):
2426
2459
  return response
2427
2460
 
2428
2461
  async def _async_get_terms_for_glossary(self, glossary_guid: str, effective_time: str = None, start_from: int = 0,
2429
- page_size: int = None, ) -> list | str:
2462
+ page_size: int = None, ) -> list | str:
2430
2463
  """Retrieve the list of glossary terms associated with a glossary.
2431
2464
  The request body also supports the specification of an effective time for the query.
2432
2465
  Parameters
@@ -2475,7 +2508,7 @@ class GlossaryBrowser(Client):
2475
2508
  return response.json().get("elementList", "No terms found")
2476
2509
 
2477
2510
  def get_terms_for_glossary(self, glossary_guid: str, effective_time: str = None, start_from: int = 0,
2478
- page_size: int = None, ) -> list | str:
2511
+ page_size: int = None, ) -> list | str:
2479
2512
  """Retrieve the list of glossary terms associated with a glossary.
2480
2513
  The request body also supports the specification of an effective time for the query.
2481
2514
  Parameters
@@ -2512,10 +2545,10 @@ class GlossaryBrowser(Client):
2512
2545
 
2513
2546
  return response
2514
2547
 
2515
- async def _async_get_term_relationships(self, term_guid: str, effective_time: str = None, start_from: int = 0,
2516
- page_size: int = None, ) -> list | str:
2548
+ async def _async_get_related_terms(self, term_guid: str, effective_time: str = None, start_from: int = 0,
2549
+ page_size: int = None, output_format: str = "JSON") -> list | str:
2517
2550
  """This call retrieves details of the glossary terms linked to this glossary term.
2518
- Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
2551
+ Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship.
2519
2552
  Parameters
2520
2553
  ----------
2521
2554
  term_guid : str
@@ -2559,10 +2592,20 @@ class GlossaryBrowser(Client):
2559
2592
  else:
2560
2593
  response = await self._async_make_request("POST", url)
2561
2594
 
2562
- return response.json().get("elementList", "No terms found")
2595
+ term_elements = response.json().get("elementList", NO_TERMS_FOUND)
2596
+ if term_elements == NO_TERMS_FOUND:
2597
+ if output_format == 'JSON':
2598
+ return NO_TERMS_FOUND
2599
+ elif output_format in ['MD', 'FORM', 'REPORT', 'LIST']:
2600
+ return "\n# No Terms found.\n"
2601
+ elif output_format == 'DICT':
2602
+ return None
2603
+ if output_format != "JSON": # return a simplified markdown representation
2604
+ return self.generate_related_terms_md(term_elements, term_guid, output_format)
2605
+ return response.json().get("elementList", NO_TERMS_FOUND)
2563
2606
 
2564
- def get_term_relationships(self, term_guid: str, effective_time: str = None, start_from: int = 0,
2565
- page_size: int = None, ) -> list | str:
2607
+ def get_related_terms(self, term_guid: str, effective_time: str = None, start_from: int = 0, page_size: int = None,
2608
+ output_format="JSON") -> list | str:
2566
2609
  """This call retrieves details of the glossary terms linked to this glossary term.
2567
2610
  Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
2568
2611
  Parameters
@@ -2595,10 +2638,206 @@ class GlossaryBrowser(Client):
2595
2638
  """
2596
2639
  loop = asyncio.get_event_loop()
2597
2640
  response = loop.run_until_complete(
2598
- self._async_get_term_relationships(term_guid, effective_time, start_from, page_size))
2641
+ self._async_get_related_terms(term_guid, effective_time, start_from, page_size, output_format))
2599
2642
 
2600
2643
  return response
2601
2644
 
2645
+ def generate_related_terms_md(self, term_elements: list, term_guid: str, output_format: str = 'MD') -> str | list:
2646
+ """
2647
+ Generate a simplified representation of related terms.
2648
+
2649
+ Args:
2650
+ term_elements (list): List of term elements with relationship information
2651
+ term_guid (str): GUID of the term for which to generate related terms
2652
+ output_format (str): Output format (MD, LIST, DICT, etc.)
2653
+
2654
+ Returns:
2655
+ str | list: Markdown string or list of dictionaries depending on output_format
2656
+ """
2657
+ # Get the first term's display name and qualified name
2658
+ term_name = "Term"
2659
+ try:
2660
+ term_info = self.get_term_by_guid(term_guid, output_format="DICT")
2661
+ # Handle case where term_info is a list of dictionaries
2662
+ if isinstance(term_info, list) and len(term_info) > 0:
2663
+ term_info = term_info[0] # Get the first term
2664
+ if isinstance(term_info, dict) and 'display_name' in term_info:
2665
+ term_name = term_info['display_name']
2666
+ except:
2667
+ # If we can't get the term info, just use the default name
2668
+ pass
2669
+
2670
+ # Create a list to store the simplified related terms
2671
+ related_terms = []
2672
+
2673
+ # Process each term element
2674
+ for element in term_elements:
2675
+ # Extract relationship type from the relationship header
2676
+ relationship_type = element['relatedElement']['relationshipHeader']['type']['typeName']
2677
+
2678
+ # Extract related term information
2679
+ related_term = {
2680
+ 'first_term_display_name': term_name, 'first_term_qualified_name': term_info.get('qualified_name', ''),
2681
+ 'related_term_display_name': element['glossaryTermProperties'].get('displayName', ''),
2682
+ 'related_term_qualified_name': element['glossaryTermProperties'].get('qualifiedName', ''),
2683
+ 'relationship_type': relationship_type
2684
+ }
2685
+
2686
+ related_terms.append(related_term)
2687
+
2688
+ # Return based on output format
2689
+ if output_format == 'DICT':
2690
+ return related_terms
2691
+
2692
+ # For MD, LIST, FORM, REPORT formats, create a markdown representation
2693
+ md_output = f"# Related Terms for {term_name}\n\n"
2694
+
2695
+ if output_format == 'LIST':
2696
+ # Create a table
2697
+ md_output += ("| First Term | First Term Qualified Name | Related Term | Related Term Qualified Name | "
2698
+ "Relationship Type |\n")
2699
+ md_output += \
2700
+ "|------------|---------------------------|--------------|------------------------------|-------------------|\n"
2701
+
2702
+ for term in related_terms:
2703
+ md_output += f"| {term['first_term_display_name']} | {term['first_term_qualified_name']} | "
2704
+ md_output += f"{term['related_term_display_name']} | {term['related_term_qualified_name']} | "
2705
+ md_output += f"{term['relationship_type']} |\n"
2706
+ else:
2707
+ # For other formats, create a more detailed representation
2708
+ for term in related_terms:
2709
+ md_output += f"## {term['relationship_type']} Relationship\n\n"
2710
+ md_output += (f"**First Term:** {term['first_term_display_name']} ("
2711
+ f"{term['first_term_qualified_name']})\n\n")
2712
+ md_output += f"**Related Term:** {term[('related_term_dis'
2713
+ 'play_name')]} ({term['related_term_qualified_name']})\n\n"
2714
+ md_output += "---\n\n"
2715
+
2716
+ return md_output
2717
+
2718
+ def get_term_details(self, term_name: str, effective_time: str = None, output_format: str = 'DICT') -> dict | str:
2719
+ """Retrieve detailed information about a term, combining basic term details and related terms.
2720
+
2721
+ This method combines the term details retrieved from get_term_by_guid and the related terms
2722
+ information from generate_related_terms_md.
2723
+
2724
+ Parameters
2725
+ ----------
2726
+ term_name : str
2727
+ Either the display name or the qualified name of the term to retrieve.
2728
+ effective_time : str, optional
2729
+ Time at which the term is active. If not specified, the current time is used.
2730
+ output_format : str, default = 'DICT'
2731
+ Type of output to produce:
2732
+ DICT - output a dictionary with combined term details and related terms
2733
+ REPORT - output a markdown report with combined term details and related terms
2734
+
2735
+ Returns
2736
+ -------
2737
+ dict | str
2738
+ A dictionary or markdown string containing the combined term details and related terms.
2739
+
2740
+ Raises
2741
+ ------
2742
+ InvalidParameterException
2743
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2744
+ PropertyServerException
2745
+ Raised by the server when an issue arises in processing a valid request.
2746
+ NotAuthorizedException
2747
+ The principle specified by the user_id does not have authorization for the requested action.
2748
+ """
2749
+ # Check if the output format is supported
2750
+ if output_format not in ["DICT", "REPORT"]:
2751
+ return f"Unsupported output format: {output_format}. Supported formats are DICT and REPORT."
2752
+
2753
+ # Search for the term using the qualified name
2754
+ terms = self.get_terms_by_name(term_name, effective_time=effective_time, output_format="DICT")
2755
+
2756
+ # Check if we found any terms
2757
+ if not terms or (isinstance(terms, str) and terms == NO_TERMS_FOUND):
2758
+ return f"No term found with name: {term_name}"
2759
+
2760
+ # Make sure we only have one term
2761
+ if isinstance(terms, list) and len(terms) > 1:
2762
+ return f"Multiple terms found with name: {term_name} - please specify the qualified name."
2763
+
2764
+ term_details = terms[0]
2765
+
2766
+ # Get related terms
2767
+ try:
2768
+ related_terms_response = self.get_related_terms(term_details.get('guid', ''), output_format="DICT")
2769
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException):
2770
+ # If we can't get related terms, set to empty list
2771
+ related_terms_response = []
2772
+
2773
+ # If no related terms were found, set to empty list
2774
+ if isinstance(related_terms_response, str) and related_terms_response == NO_TERMS_FOUND:
2775
+ related_terms = []
2776
+ elif related_terms_response is None:
2777
+ related_terms = []
2778
+ else:
2779
+ related_terms = related_terms_response
2780
+
2781
+ # Combine the data
2782
+ if output_format == "DICT":
2783
+ # Create a combined dictionary
2784
+ combined_data = {
2785
+ "term_details": term_details, "related_terms": related_terms
2786
+ }
2787
+ return combined_data
2788
+ elif output_format == "REPORT":
2789
+ # Create a markdown report
2790
+ md_output = f"# Term Details Report for `{term_name}` \n\n"
2791
+
2792
+ # Add term details
2793
+ md_output += "## Basic Term Information\n\n"
2794
+ md_output += f"**Display Name:** {term_details.get('display_name', '')}\n\n"
2795
+ md_output += f"**Qualified Name:** {term_details.get('qualified_name', '')}\n\n"
2796
+ md_output += f"**GUID:** {term_details.get('guid', '')}\n\n"
2797
+
2798
+ if 'summary' in term_details and term_details['summary']:
2799
+ md_output += f"**Summary:** {term_details.get('summary', '')}\n\n"
2800
+
2801
+ if 'description' in term_details and term_details['description']:
2802
+ md_output += f"**Description:** {term_details.get('description', '')}\n\n"
2803
+
2804
+ if 'examples' in term_details and term_details['examples']:
2805
+ md_output += f"**Examples:** {term_details.get('examples', '')}\n\n"
2806
+
2807
+ if 'usage' in term_details and term_details['usage']:
2808
+ md_output += f"**Usage:** {term_details.get('usage', '')}\n\n"
2809
+
2810
+ if 'aliases' in term_details and term_details['aliases']:
2811
+ md_output += f"**Aliases:** {term_details.get('aliases', '')}\n\n"
2812
+
2813
+ if 'status' in term_details and term_details['status']:
2814
+ md_output += f"**Status:** {term_details.get('status', '')}\n\n"
2815
+
2816
+ if 'in_glossary' in term_details and term_details['in_glossary']:
2817
+ md_output += f"**Glossary:** {term_details.get('in_glossary', '')}\n\n"
2818
+
2819
+ if 'categories' in term_details and term_details['categories']:
2820
+ md_output += f"**Categories:** {', '.join(term_details.get('categories', []))}\n\n"
2821
+
2822
+ # Add related terms
2823
+ md_output += "## Related Terms\n\n"
2824
+
2825
+ if not related_terms:
2826
+ md_output += "No related terms found.\n\n"
2827
+ else:
2828
+ # Create a table for related terms
2829
+ md_output += "| Related Term | Qualified Name | Relationship Type |\n"
2830
+ md_output += "|--------------|---------------|-------------------|\n"
2831
+
2832
+ for term in related_terms:
2833
+ md_output += f"| {term.get('related_term_display_name', '')} | "
2834
+ md_output += f"{term.get('related_term_qualified_name', '')} | "
2835
+ md_output += f"{term.get('relationship_type', '')} |\n"
2836
+
2837
+ return md_output
2838
+ else:
2839
+ return f"Unsupported output format: {output_format}. Supported formats are DICT and REPORT."
2840
+
2602
2841
  async def _async_get_glossary_for_term(self, term_guid: str, effective_time: str = None) -> dict | str:
2603
2842
  """Retrieve the glossary metadata element for the requested term. The optional request body allows you to
2604
2843
  specify that the glossary element should only be returned if it was effective at a particular time.
@@ -2638,8 +2877,8 @@ class GlossaryBrowser(Client):
2638
2877
  url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
2639
2878
  f"for-term/{term_guid}/retrieve")
2640
2879
 
2641
- response = await self._async_make_request("POST", url, body)
2642
- return response.json().get("element", "No glossary found")
2880
+ response = await self._async_make_request("POST", url, body_slimmer(body))
2881
+ return response.json().get("element", NO_GLOSSARIES_FOUND)
2643
2882
 
2644
2883
  def get_glossary_for_term(self, term_guid: str, effective_time: str = None) -> dict | str:
2645
2884
  """Retrieve the glossary metadata element for the requested term. The optional request body allows you to
@@ -2676,8 +2915,9 @@ class GlossaryBrowser(Client):
2676
2915
  return response
2677
2916
 
2678
2917
  async def _async_get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [],
2679
- effective_time: str = None, for_lineage: bool = False, for_duplicate_processing: bool = False,
2680
- start_from: int = 0, page_size: int = None, ) -> list:
2918
+ effective_time: str = None, for_lineage: bool = False,
2919
+ for_duplicate_processing: bool = False, start_from: int = 0,
2920
+ page_size: int = None, output_format="JSON") -> list:
2681
2921
  """Retrieve glossary terms by display name or qualified name. Async Version.
2682
2922
 
2683
2923
  Parameters
@@ -2700,6 +2940,13 @@ class GlossaryBrowser(Client):
2700
2940
  The index of the first term to retrieve. Default is 0.
2701
2941
  page_size : int, optional
2702
2942
  The number of terms to retrieve per page. If not provided, it will use the default page size.
2943
+ output_format: str, default = 'JSON'
2944
+ Type of output to produce:
2945
+ JSON - output standard json
2946
+ MD - output standard markdown with no preamble
2947
+ FORM - output markdown with a preamble for a form
2948
+ REPORT - output markdown with a preamble for a report
2949
+ DICT - output a simplified DICT structure
2703
2950
 
2704
2951
  Returns
2705
2952
  -------
@@ -2735,13 +2982,22 @@ class GlossaryBrowser(Client):
2735
2982
  f"&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}")
2736
2983
 
2737
2984
  # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2738
-
2739
- response = await self._async_make_request("POST", url, body)
2740
- return response.json().get("elementList", "No terms found")
2985
+ response = await self._async_make_request("POST", url, body_slimmer(body))
2986
+ term_elements = response.json().get("elementList", NO_TERMS_FOUND)
2987
+ if term_elements == NO_TERMS_FOUND:
2988
+ if output_format == 'JSON':
2989
+ return NO_TERMS_FOUND
2990
+ elif output_format in ['MD', 'FORM', 'REPORT', 'LIST']:
2991
+ return "\n# No Terms found.\n"
2992
+ elif output_format == 'DICT':
2993
+ return None
2994
+ if output_format != "JSON": # return a simplified markdown representation
2995
+ return self.generate_terms_md(term_elements, term, output_format)
2996
+ return response.json().get("elementList", NO_TERMS_FOUND)
2741
2997
 
2742
2998
  def get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [],
2743
- effective_time: str = None, for_lineage: bool = False, for_duplicate_processing: bool = False,
2744
- start_from: int = 0, page_size: int = None, ) -> list:
2999
+ effective_time: str = None, for_lineage: bool = False, for_duplicate_processing: bool = False,
3000
+ start_from: int = 0, page_size: int = None, output_format="JSON") -> list:
2745
3001
  """Retrieve glossary terms by display name or qualified name.
2746
3002
 
2747
3003
  Parameters
@@ -2764,6 +3020,13 @@ class GlossaryBrowser(Client):
2764
3020
  The index of the first term to retrieve. Default is 0.
2765
3021
  page_size : int, optional
2766
3022
  The number of terms to retrieve per page. If not provided, it will use the default page size.
3023
+ output_format: str, default = 'JSON'
3024
+ Type of output to produce:
3025
+ JSON - output standard json
3026
+ MD - output standard markdown with no preamble
3027
+ FORM - output markdown with a preamble for a form
3028
+ REPORT - output markdown with a preamble for a report
3029
+ DICT - output a simplified DICT structure
2767
3030
 
2768
3031
  Returns
2769
3032
  -------
@@ -2783,7 +3046,7 @@ class GlossaryBrowser(Client):
2783
3046
  loop = asyncio.get_event_loop()
2784
3047
  response = loop.run_until_complete(
2785
3048
  self._async_get_terms_by_name(term, glossary_guid, status_filter, effective_time, for_lineage,
2786
- for_duplicate_processing, start_from, page_size, ))
3049
+ for_duplicate_processing, start_from, page_size, output_format))
2787
3050
  return response
2788
3051
 
2789
3052
  async def _async_get_term_by_guid(self, term_guid: str, output_format: str = 'JSON') -> dict | str:
@@ -2860,10 +3123,11 @@ class GlossaryBrowser(Client):
2860
3123
  return response
2861
3124
 
2862
3125
  async def _async_get_term_versions(self, term_guid: str, effective_time: str = None, from_time: str = None,
2863
- to_time: str = None, oldest_first: bool = False, for_lineage: bool = False,
2864
- for_duplicate_processing: bool = False, start_from: int = 0, page_size=max_paging_size,
3126
+ to_time: str = None, oldest_first: bool = False, for_lineage: bool = False,
3127
+ for_duplicate_processing: bool = False, start_from: int = 0,
3128
+ page_size=max_paging_size,
2865
3129
 
2866
- ) -> list | str:
3130
+ ) -> list | str:
2867
3131
  """Retrieve the versions of a glossary term. Async version.
2868
3132
  Parameters
2869
3133
  ----------
@@ -2917,8 +3181,8 @@ class GlossaryBrowser(Client):
2917
3181
  return response.json().get("elementList", "No term found")
2918
3182
 
2919
3183
  def get_term_versions(self, term_guid: str, effective_time: str = None, from_time: str = None, to_time: str = None,
2920
- oldest_first: bool = False, for_lineage: bool = False, for_duplicate_processing: bool = False,
2921
- start_from: int = 0, page_size=max_paging_size, ) -> dict | str:
3184
+ oldest_first: bool = False, for_lineage: bool = False, for_duplicate_processing: bool = False,
3185
+ start_from: int = 0, page_size=max_paging_size, ) -> dict | str:
2922
3186
  """Retrieve the versions of a glossary term.
2923
3187
  Parameters
2924
3188
  ----------
@@ -3023,7 +3287,7 @@ class GlossaryBrowser(Client):
3023
3287
  return response
3024
3288
 
3025
3289
  async def _async_get_term_revision_history(self, term_revision_log_guid: str, start_from: int = 0,
3026
- page_size=None, ) -> dict | str:
3290
+ page_size=None, ) -> dict | str:
3027
3291
  """Retrieve the revision history for a glossary term. Async version.
3028
3292
 
3029
3293
  Parameters
@@ -3068,7 +3332,7 @@ class GlossaryBrowser(Client):
3068
3332
  return response.json().get("elementList", "No logs found")
3069
3333
 
3070
3334
  def get_term_revision_history(self, term_revision_log_guid: str, start_from: int = 0,
3071
- page_size=None, ) -> dict | str:
3335
+ page_size=None, ) -> dict | str:
3072
3336
  """Retrieve the revision history for a glossary term.
3073
3337
 
3074
3338
  Parameters
@@ -3130,7 +3394,6 @@ class GlossaryBrowser(Client):
3130
3394
  If output_format is "LIST", returns a markdown table of the revision history.
3131
3395
  If no revision logs are found, returns a string message "No revision logs found".
3132
3396
  """
3133
- import re
3134
3397
  validate_guid(term_guid)
3135
3398
 
3136
3399
  # Get revision logs for the term
@@ -3158,15 +3421,15 @@ class GlossaryBrowser(Client):
3158
3421
  update_time = title[keyword_index + 2:].strip()
3159
3422
 
3160
3423
  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
- }
3424
+ 'qualifiedName': qualified_name, 'title': title,
3425
+ 'text': entry.get('properties', {}).get('text', '---'), 'updateTime': update_time
3426
+ # Use extracted date/time or fall back to title
3427
+ }
3166
3428
  all_entries.append(entry_data)
3167
3429
 
3168
3430
  # Sort entries by update time
3169
- sorted_entries = sorted(all_entries, key=lambda x: x['updateTime'] if x['updateTime'] != '---' else '', reverse=True)
3431
+ sorted_entries = sorted(all_entries, key=lambda x: x['updateTime'] if x['updateTime'] != '---' else '',
3432
+ reverse=True)
3170
3433
 
3171
3434
  # Return in the specified format
3172
3435
  if output_format == "DICT":
@@ -3210,7 +3473,6 @@ class GlossaryBrowser(Client):
3210
3473
  # Default to DICT format
3211
3474
  return sorted_entries
3212
3475
 
3213
-
3214
3476
  def list_full_term_history(self, term_guid: str, output_type: str = "DICT") -> list | str:
3215
3477
  """
3216
3478
  Retrieves and formats the entire version history of a specific term in the repository.
@@ -3285,9 +3547,10 @@ class GlossaryBrowser(Client):
3285
3547
  return None
3286
3548
 
3287
3549
  async def _async_find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
3288
- effective_time: str = None, starts_with: bool = False, ends_with: bool = False, ignore_case: bool = False,
3289
- for_lineage: bool = False, for_duplicate_processing: bool = False, start_from: int = 0,
3290
- page_size: int = None, output_format: str = "JSON", ) -> list | str:
3550
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
3551
+ ignore_case: bool = False, for_lineage: bool = False,
3552
+ for_duplicate_processing: bool = False, start_from: int = 0,
3553
+ page_size: int = None, output_format: str = "JSON", ) -> list | str:
3291
3554
  """Retrieve the list of glossary term metadata elements that contain the search string.
3292
3555
 
3293
3556
  Parameters
@@ -3386,9 +3649,10 @@ class GlossaryBrowser(Client):
3386
3649
  return response.json().get("elementList", NO_TERMS_FOUND)
3387
3650
 
3388
3651
  def find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
3389
- effective_time: str = None, starts_with: bool = False, ends_with: bool = False, ignore_case: bool = False,
3390
- for_lineage: bool = False, for_duplicate_processing: bool = False, start_from: int = 0,
3391
- page_size: int = None, output_format: str = "JSON", ) -> list | str:
3652
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
3653
+ ignore_case: bool = False, for_lineage: bool = False,
3654
+ for_duplicate_processing: bool = False, start_from: int = 0, page_size: int = None,
3655
+ output_format: str = "JSON", ) -> list | str:
3392
3656
  """Retrieve the list of glossary term metadata elements that contain the search string.
3393
3657
 
3394
3658
  Parameters
@@ -3453,7 +3717,8 @@ class GlossaryBrowser(Client):
3453
3717
  loop = asyncio.get_event_loop()
3454
3718
  response = loop.run_until_complete(
3455
3719
  self._async_find_glossary_terms(search_string, glossary_guid, status_filter, effective_time, starts_with,
3456
- ends_with, ignore_case, for_lineage, for_duplicate_processing, start_from, page_size, output_format))
3720
+ ends_with, ignore_case, for_lineage, for_duplicate_processing, start_from,
3721
+ page_size, output_format))
3457
3722
 
3458
3723
  return response
3459
3724
 
@@ -3461,7 +3726,7 @@ class GlossaryBrowser(Client):
3461
3726
  # Feedback
3462
3727
  #
3463
3728
  async def _async_get_comment(self, commemt_guid: str, effective_time: str, for_lineage: bool = False,
3464
- for_duplicate_processing: bool = False, ) -> dict | list:
3729
+ for_duplicate_processing: bool = False, ) -> dict | list:
3465
3730
  """Retrieve the comment specified by the comment GUID"""
3466
3731
 
3467
3732
  validate_guid(commemt_guid)
@@ -3484,7 +3749,7 @@ class GlossaryBrowser(Client):
3484
3749
  return response.json()
3485
3750
 
3486
3751
  async def _async_add_comment_reply(self, comment_guid: str, is_public: bool, comment_type: str, comment_text: str,
3487
- for_lineage: bool = False, for_duplicate_processing: bool = False, ) -> str:
3752
+ for_lineage: bool = False, for_duplicate_processing: bool = False, ) -> str:
3488
3753
  """Reply to a comment"""
3489
3754
 
3490
3755
  validate_guid(comment_guid)
@@ -3509,7 +3774,8 @@ class GlossaryBrowser(Client):
3509
3774
  return response
3510
3775
 
3511
3776
  async def _async_update_comment(self, comment_guid: str, is_public: bool, comment_type: str, comment_text: str,
3512
- is_merge_update: bool = False, for_lineage: bool = False, for_duplicate_processing: bool = False, ) -> str:
3777
+ is_merge_update: bool = False, for_lineage: bool = False,
3778
+ for_duplicate_processing: bool = False, ) -> str:
3513
3779
  """Update the specified comment"""
3514
3780
 
3515
3781
  validate_guid(comment_guid)
@@ -3534,9 +3800,9 @@ class GlossaryBrowser(Client):
3534
3800
  return response
3535
3801
 
3536
3802
  async def _async_find_comment(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
3537
- effective_time: str = None, starts_with: bool = False, ends_with: bool = False, ignore_case: bool = False,
3538
- for_lineage: bool = False, for_duplicate_processing: bool = False, start_from: int = 0,
3539
- page_size: int = None, ):
3803
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
3804
+ ignore_case: bool = False, for_lineage: bool = False,
3805
+ for_duplicate_processing: bool = False, start_from: int = 0, page_size: int = None, ):
3540
3806
  """Find comments by search string"""
3541
3807
 
3542
3808
  if page_size is None: