pyegeria 5.3.8.3__py3-none-any.whl → 5.3.8.5__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.
@@ -10,14 +10,15 @@ added in subsequent versions of the glossary_omvs module.
10
10
  import asyncio
11
11
  from datetime import datetime
12
12
 
13
- from pyegeria import NO_GLOSSARIES_FOUND, NO_CATEGORIES_FOUND, NO_TERMS_FOUND, max_paging_size
14
- import json
13
+ from pyegeria import NO_GLOSSARIES_FOUND, max_paging_size
15
14
  from pyegeria._client import Client
15
+ from pyegeria._globals import NO_CATEGORIES_FOUND, NO_TERMS_FOUND
16
16
  from pyegeria._validators import validate_guid, validate_name, validate_search_string
17
17
  from pyegeria.utils import body_slimmer
18
- from pyegeria._globals import NO_ELEMENTS_FOUND, NO_CATALOGS_FOUND, NO_CATEGORIES_FOUND, NO_TERMS_FOUND
18
+
19
19
  MD_SEPERATOR = "\n---\n\n"
20
20
 
21
+
21
22
  class GlossaryBrowser(Client):
22
23
  """
23
24
  GlossaryBrowser is a class that extends the Client class. It provides methods to search and retrieve glossaries,
@@ -37,14 +38,7 @@ class GlossaryBrowser(Client):
37
38
 
38
39
  """
39
40
 
40
- def __init__(
41
- self,
42
- view_server: str,
43
- platform_url: str,
44
- user_id: str,
45
- user_pwd: str = None,
46
- token: str = None,
47
- ):
41
+ def __init__(self, view_server: str, platform_url: str, user_id: str, user_pwd: str = None, token: str = None, ):
48
42
  self.view_server = view_server
49
43
  self.platform_url = platform_url
50
44
  self.user_pwd = user_pwd
@@ -53,8 +47,7 @@ class GlossaryBrowser(Client):
53
47
 
54
48
  Client.__init__(self, view_server, platform_url, user_id, user_pwd, token)
55
49
 
56
-
57
- def make_preamble(self, obj_type, search_string, output_format: str = 'MD')-> tuple[str, str | None]:
50
+ def make_preamble(self, obj_type, search_string, output_format: str = 'MD') -> tuple[str, str | None]:
58
51
  """
59
52
  Creates a preamble string and an elements action based on the given object type, search string,
60
53
  and output format. The preamble provides a descriptive header based on the intent: To make a form,
@@ -117,7 +110,6 @@ class GlossaryBrowser(Client):
117
110
  # Replace newlines with spaces and escape pipe characters
118
111
  return text.replace("\n", " ").replace("|", "\\|")
119
112
 
120
-
121
113
  def _extract_glossary_properties(self, element: dict) -> dict:
122
114
  """
123
115
  Extract common properties from a glossary element.
@@ -136,18 +128,24 @@ class GlossaryBrowser(Client):
136
128
  usage = properties.get("usage", "") or ""
137
129
  qualified_name = properties.get("qualifiedName", "") or ""
138
130
 
131
+ categories = self.get_categories_for_glossary(guid)
132
+ cat_md_display = ''
133
+ cat_md_qn = ''
134
+ if type(categories) is list:
135
+ for category in categories:
136
+ cat_md_display += f"* {category['glossaryCategoryProperties'][('displayName')]}\n"
137
+ cat_md_qn += f"* {category['glossaryCategoryProperties'][('qualifiedName')]}\n"
138
+ cat_md = cat_md_display.strip()
139
+ cat_md_qn = cat_md_qn.strip()
140
+
139
141
  return {
140
- 'guid': guid,
141
- 'properties': properties,
142
- 'display_name': display_name,
143
- 'description': description,
144
- 'language': language,
145
- 'usage': usage,
146
- 'qualified_name': qualified_name
147
- }
142
+ 'guid': guid, 'properties': properties, 'display_name': display_name, 'description': description,
143
+ 'language': language, 'usage': usage, 'qualified_name': qualified_name, 'categories_dn_md': cat_md_display,
144
+ 'categories_qn_md': cat_md_qn
145
+ }
148
146
 
149
- def _generate_entity_md(self, elements: list, elements_action: str, output_format: str,
150
- entity_type: str, extract_properties_func, get_additional_props_func=None) -> str:
147
+ def _generate_entity_md(self, elements: list, elements_action: str, output_format: str, entity_type: str,
148
+ extract_properties_func, get_additional_props_func=None) -> str:
151
149
  """
152
150
  Generic method to generate markdown for entities (glossaries, terms, categories).
153
151
 
@@ -170,7 +168,7 @@ class GlossaryBrowser(Client):
170
168
  # Get additional properties if function is provided
171
169
  additional_props = {}
172
170
  if get_additional_props_func:
173
- additional_props = get_additional_props_func(element, props['guid'])
171
+ additional_props = get_additional_props_func(element, props['guid'], output_format)
174
172
 
175
173
  # Format header based on output format
176
174
  if output_format in ['FORM', 'MD']:
@@ -183,15 +181,26 @@ class GlossaryBrowser(Client):
183
181
 
184
182
  # Add common attributes
185
183
  for key, value in props.items():
184
+ # Skip categories_dn_md for FORM output and categories_qn_md for REPORT output
185
+ if key == 'categories_dn_md' and output_format == 'FORM':
186
+ continue
187
+ if key == 'categories_qn_md' and output_format == 'REPORT':
188
+ continue
186
189
  if key not in ['guid', 'properties', 'display_name']:
187
- elements_md += self.make_md_attribute(key.replace('_', ' '), value, output_format)
190
+ # Use "Categories" as the label for both categories_qn_md and categories_dn_md
191
+ if key == 'categories_qn_md' and output_format == 'FORM':
192
+ elements_md += self.make_md_attribute("Categories", value, output_format)
193
+ elif key == 'categories_dn_md' and output_format == 'REPORT':
194
+ elements_md += self.make_md_attribute("Categories", value, output_format)
195
+ else:
196
+ elements_md += self.make_md_attribute(key.replace('_', ' '), value, output_format)
188
197
 
189
198
  # Add additional properties
190
199
  for key, value in additional_props.items():
191
200
  elements_md += self.make_md_attribute(key.replace('_', ' '), value, output_format)
192
201
 
193
202
  # Add GUID
194
- elements_md += self.make_md_attribute("qualified name", props['qualified_name'], output_format)
203
+ # elements_md += self.make_md_attribute("qualified name", props['qualified_name'], output_format)
195
204
  elements_md += self.make_md_attribute("GUID", props['guid'], output_format)
196
205
 
197
206
  # Add separator if not the last element
@@ -212,16 +221,11 @@ class GlossaryBrowser(Client):
212
221
  Returns:
213
222
  str: Markdown representation
214
223
  """
215
- return self._generate_entity_md(
216
- elements=elements,
217
- elements_action=elements_action,
218
- output_format=output_format,
219
- entity_type="Glossary",
220
- extract_properties_func=self._extract_glossary_properties
221
- )
224
+ 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)
222
226
 
223
- def _generate_entity_md_table(self, elements: list, search_string: str, entity_type: str,
224
- extract_properties_func, columns: list, get_additional_props_func=None) -> str:
227
+ def _generate_entity_md_table(self, elements: list, search_string: str, entity_type: str, extract_properties_func,
228
+ columns: list, get_additional_props_func=None, output_format: str = 'LIST') -> str:
225
229
  """
226
230
  Generic method to generate a markdown table for entities (glossaries, terms, categories).
227
231
 
@@ -232,13 +236,18 @@ class GlossaryBrowser(Client):
232
236
  extract_properties_func: Function to extract properties from an element
233
237
  columns: List of column definitions, each containing 'name', 'key', and 'format' (optional)
234
238
  get_additional_props_func: Optional function to get additional properties
239
+ output_format (str): Output format (FORM, REPORT, LIST, etc.)
235
240
 
236
241
  Returns:
237
242
  str: Markdown table
238
243
  """
239
244
  # Create table header
240
- elements_md = f"# {entity_type}s Table\n\n"
241
- elements_md += f"{entity_type}s found from the search string: `{search_string}`\n\n"
245
+
246
+ # Handle pluralization - if entity_type ends with 'y', use 'ies' instead of 's'
247
+ entity_type_plural = f"{entity_type[:-1]}ies" if entity_type.endswith('y') else f"{entity_type}s"
248
+
249
+ elements_md = f"# {entity_type_plural} Table\n\n"
250
+ elements_md += f"{entity_type_plural} found from the search string: `{search_string}`\n\n"
242
251
 
243
252
  # Add column headers
244
253
  header_row = "| "
@@ -257,7 +266,7 @@ class GlossaryBrowser(Client):
257
266
  # Get additional properties if function is provided
258
267
  additional_props = {}
259
268
  if get_additional_props_func:
260
- additional_props = get_additional_props_func(element, props['guid'])
269
+ additional_props = get_additional_props_func(element, props['guid'], output_format)
261
270
 
262
271
  # Build row
263
272
  row = "| "
@@ -292,24 +301,18 @@ class GlossaryBrowser(Client):
292
301
  Returns:
293
302
  str: Markdown table
294
303
  """
295
- columns = [
296
- {'name': 'Glossary Name', 'key': 'display_name'},
304
+ columns = [{'name': 'Glossary Name', 'key': 'display_name'},
297
305
  {'name': 'Qualified Name', 'key': 'qualified_name'},
298
306
  {'name': 'Language', 'key': 'language', 'format': True},
299
307
  {'name': 'Description', 'key': 'description', 'format': True},
300
- {'name': 'Usage', 'key': 'usage', 'format': True}
301
- ]
308
+ {'name': 'Usage', 'key': 'usage', 'format': True},
309
+ {'name': 'Categories', 'key': 'categories_dn_md', 'format': True}, ]
302
310
 
303
- return self._generate_entity_md_table(
304
- elements=elements,
305
- search_string=search_string,
306
- entity_type="Glossary",
307
- extract_properties_func=self._extract_glossary_properties,
308
- columns=columns
309
- )
311
+ 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)
310
313
 
311
- def _generate_entity_dict(self, elements: list, extract_properties_func, get_additional_props_func=None,
312
- include_keys=None, exclude_keys=None) -> list:
314
+ def _generate_entity_dict(self, elements: list, extract_properties_func, get_additional_props_func=None,
315
+ include_keys=None, exclude_keys=None, output_format: str = 'DICT') -> list:
313
316
  """
314
317
  Generic method to generate a dictionary representation of entities (glossaries, terms, categories).
315
318
 
@@ -319,6 +322,7 @@ class GlossaryBrowser(Client):
319
322
  get_additional_props_func: Optional function to get additional properties
320
323
  include_keys: Optional list of keys to include in the result (if None, include all)
321
324
  exclude_keys: Optional list of keys to exclude from the result (if None, exclude none)
325
+ output_format (str): Output format (FORM, REPORT, DICT, etc.)
322
326
 
323
327
  Returns:
324
328
  list: List of entity dictionaries
@@ -331,7 +335,7 @@ class GlossaryBrowser(Client):
331
335
  # Get additional properties if function is provided
332
336
  additional_props = {}
333
337
  if get_additional_props_func:
334
- additional_props = get_additional_props_func(element, props['guid'])
338
+ additional_props = get_additional_props_func(element, props['guid'], output_format)
335
339
 
336
340
  # Create entity dictionary
337
341
  entity_dict = {}
@@ -339,7 +343,8 @@ class GlossaryBrowser(Client):
339
343
  # Add properties based on include/exclude lists
340
344
  for key, value in props.items():
341
345
  if key != 'properties': # Skip the raw properties object
342
- if (include_keys is None or key in include_keys) and (exclude_keys is None or key not in exclude_keys):
346
+ if (include_keys is None or key in include_keys) and (
347
+ exclude_keys is None or key not in exclude_keys):
343
348
  entity_dict[key] = value
344
349
 
345
350
  # Add additional properties
@@ -351,23 +356,22 @@ class GlossaryBrowser(Client):
351
356
 
352
357
  return result
353
358
 
354
- def _generate_glossary_dict(self, elements: list) -> list:
359
+ def _generate_glossary_dict(self, elements: list, output_format: str = 'DICT') -> list:
355
360
  """
356
361
  Generate a dictionary representation of glossaries.
357
362
 
358
363
  Args:
359
364
  elements (list): List of glossary elements
365
+ output_format (str): Output format (FORM, REPORT, DICT, etc.)
360
366
 
361
367
  Returns:
362
368
  list: List of glossary dictionaries
363
369
  """
364
- return self._generate_entity_dict(
365
- elements=elements,
366
- extract_properties_func=self._extract_glossary_properties,
367
- exclude_keys=['properties']
368
- )
370
+ 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)
369
372
 
370
- def generate_glossaries_md(self, elements: list | dict, search_string: str, output_format: str = 'MD')-> str | list:
373
+ def generate_glossaries_md(self, elements: list | dict, search_string: str,
374
+ output_format: str = 'MD') -> str | list:
371
375
  """
372
376
  Generate markdown or dictionary representation of glossaries.
373
377
 
@@ -384,13 +388,16 @@ class GlossaryBrowser(Client):
384
388
  if isinstance(elements, dict):
385
389
  elements = [elements]
386
390
 
391
+ if search_string is None or search_string == '':
392
+ search_string = "All"
393
+
387
394
  # If output format is LIST, create a markdown table
388
395
  if output_format == 'LIST':
389
396
  return self._generate_glossary_md_table(elements, search_string)
390
397
 
391
398
  # If output format is DICT, return a dictionary structure
392
399
  elif output_format == 'DICT':
393
- return self._generate_glossary_dict(elements)
400
+ return self._generate_glossary_dict(elements, output_format)
394
401
 
395
402
  # Original implementation for other formats (MD, FORM, REPORT)
396
403
  elements_md += self._generate_glossary_md(elements, elements_action, output_format)
@@ -413,29 +420,23 @@ class GlossaryBrowser(Client):
413
420
  description = properties.get("description", "") or ""
414
421
  examples = properties.get("examples", "") or ""
415
422
  usage = properties.get("usage", "") or ""
416
- pub_version = properties.get("publishfinVersionIdentifier", "") or ""
423
+ pub_version = properties.get("publishVersionIdentifier", "") or ""
417
424
  qualified_name = properties.get("qualifiedName", "") or ""
418
425
  status = element['elementHeader'].get('status', "") or ""
419
426
 
420
427
  return {
421
- 'guid': guid,
422
- 'properties': properties,
423
- 'display_name': display_name,
424
- 'summary': summary,
425
- 'description': description,
426
- 'examples': examples,
427
- 'usage': usage,
428
- 'pub_version': pub_version,
429
- 'qualified_name': qualified_name,
430
- 'status': status
431
- }
432
-
433
- def _get_categories_for_term(self, term_guid: str) -> tuple[list, str]:
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
431
+ }
432
+
433
+ def _get_categories_for_term(self, term_guid: str, output_format: str = None) -> tuple[list, str]:
434
434
  """
435
435
  Get a list of categories for a given term.
436
436
 
437
437
  Args:
438
438
  term_guid (str): The GUID of the term
439
+ output_format (str): Output format (FORM, REPORT, LIST, etc.)
439
440
 
440
441
  Returns:
441
442
  tuple: A tuple containing:
@@ -451,7 +452,12 @@ class GlossaryBrowser(Client):
451
452
  elif isinstance(category_list, list) and len(category_list) > 0:
452
453
  first_cat = True
453
454
  for category in category_list:
454
- category_name = category["glossaryCategoryProperties"].get("qualifiedName", '---')
455
+ # Use qualified name for FORM output, display name for REPORT and LIST output
456
+ if output_format in ['REPORT', 'LIST']:
457
+ category_name = category["glossaryCategoryProperties"].get("displayName", '---')
458
+ else:
459
+ category_name = category["glossaryCategoryProperties"].get("qualifiedName", '---')
460
+
455
461
  if category_name:
456
462
  category_names.append(category_name)
457
463
  if first_cat:
@@ -464,118 +470,118 @@ class GlossaryBrowser(Client):
464
470
 
465
471
  return category_names, category_list_md
466
472
 
467
- def _get_term_table_properties(self, element: dict, term_guid: str) -> dict:
473
+ def _get_term_table_properties(self, element: dict, term_guid: str, output_format: str = None) -> dict:
468
474
  """
469
475
  Get properties for a term table row.
470
476
 
471
477
  Args:
472
478
  element (dict): The term element
473
479
  term_guid (str): The GUID of the term
480
+ output_format (str): Output format (FORM, REPORT, etc.)
474
481
 
475
482
  Returns:
476
483
  dict: Dictionary of properties for the table row
477
484
  """
478
485
  # Get glossary information
479
- glossary_qualified_name = self._get_glossary_name_for_element(element)
486
+ glossary_qualified_name = self._get_glossary_name_for_element(element, output_format)
480
487
 
481
488
  # Get categories
482
- category_names, _ = self._get_categories_for_term(term_guid)
489
+ category_names, _ = self._get_categories_for_term(term_guid, output_format)
483
490
  categories_str = ", ".join(category_names) if category_names else "---"
484
491
 
485
492
  return {
486
- 'glossary': glossary_qualified_name,
487
- 'categories_str': categories_str
488
- }
493
+ 'glossary': glossary_qualified_name, 'categories_str': categories_str
494
+ }
489
495
 
490
- def _generate_term_md_table(self, elements: list, search_string: str) -> str:
496
+ def _generate_term_md_table(self, elements: list, search_string: str, output_format: str = 'LIST') -> str:
491
497
  """
492
498
  Generate a markdown table for terms.
493
499
 
494
500
  Args:
495
501
  elements (list): List of term elements
496
502
  search_string (str): The search string used
503
+ output_format (str): Output format (FORM, REPORT, LIST, etc.)
497
504
 
498
505
  Returns:
499
506
  str: Markdown table
500
507
  """
501
- columns = [
502
- {'name': 'Term Name', 'key': 'display_name'},
503
- {'name': 'Qualified Name', 'key': 'qualified_name'},
504
- {'name': 'Summary', 'key': 'summary', 'format': True},
505
- {'name': 'Glossary', 'key': 'glossary'},
506
- {'name': 'Categories', 'key': 'categories_str', 'format': True}
507
- ]
508
-
509
- return self._generate_entity_md_table(
510
- elements=elements,
511
- search_string=search_string,
512
- entity_type="Term",
513
- extract_properties_func=self._extract_term_properties,
514
- columns=columns,
515
- get_additional_props_func=self._get_term_table_properties
516
- )
517
-
518
- def _get_term_dict_properties(self, element: dict, term_guid: str) -> dict:
508
+ 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}]
511
+
512
+ # Create a wrapper function to pass output_format to _get_term_table_properties
513
+ def get_table_props_with_format(element, term_guid, output_format_param=None):
514
+ return self._get_term_table_properties(element, term_guid, output_format)
515
+
516
+ 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)
519
+
520
+ def _get_term_dict_properties(self, element: dict, term_guid: str, output_format: str = None) -> dict:
519
521
  """
520
522
  Get additional properties for a term dictionary.
521
523
 
522
524
  Args:
523
525
  element (dict): The term element
524
526
  term_guid (str): The GUID of the term
527
+ output_format (str): Output format (FORM, REPORT, etc.)
525
528
 
526
529
  Returns:
527
530
  dict: Dictionary of additional properties
528
531
  """
529
532
  # Get glossary information
530
- glossary_qualified_name = self._get_glossary_name_for_element(element)
533
+ glossary_qualified_name = self._get_glossary_name_for_element(element, output_format)
531
534
 
532
535
  # Get categories
533
- category_names, _ = self._get_categories_for_term(term_guid)
536
+ category_names, _ = self._get_categories_for_term(term_guid, output_format)
534
537
 
535
538
  return {
536
- 'in_glossary': glossary_qualified_name,
537
- 'categories': category_names,
539
+ 'in_glossary': glossary_qualified_name, 'categories': category_names,
538
540
  'version': element['glossaryTermProperties'].get('publishfinVersionIdentifier', '')
539
- }
541
+ }
540
542
 
541
- def _generate_term_dict(self, elements: list) -> list:
543
+ def _generate_term_dict(self, elements: list, output_format: str = 'DICT') -> list:
542
544
  """
543
545
  Generate a dictionary representation of terms.
544
546
 
545
547
  Args:
546
548
  elements (list): List of term elements
549
+ output_format (str): Output format (FORM, REPORT, DICT, etc.)
547
550
 
548
551
  Returns:
549
552
  list: List of term dictionaries
550
553
  """
551
- return self._generate_entity_dict(
552
- elements=elements,
553
- extract_properties_func=self._extract_term_properties,
554
- get_additional_props_func=self._get_term_dict_properties,
555
- exclude_keys=['properties', 'pub_version'] # Exclude raw properties and pub_version (renamed to version)
556
- )
557
554
 
558
- def _get_term_additional_properties(self, element: dict, term_guid: str) -> dict:
555
+ # Create a wrapper function to pass output_format to _get_term_dict_properties
556
+ def get_dict_props_with_format(element, term_guid, output_format_param=None):
557
+ return self._get_term_dict_properties(element, term_guid, output_format)
558
+
559
+ 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
+ )
563
+
564
+ def _get_term_additional_properties(self, element: dict, term_guid: str, output_format: str = None) -> dict:
559
565
  """
560
566
  Get additional properties for a term.
561
567
 
562
568
  Args:
563
569
  element (dict): The term element
564
570
  term_guid (str): The GUID of the term
571
+ output_format (str): Output format (FORM, REPORT, etc.)
565
572
 
566
573
  Returns:
567
574
  dict: Dictionary of additional properties
568
575
  """
569
576
  # Get glossary information
570
- glossary_qualified_name = self._get_glossary_name_for_element(element)
577
+ glossary_qualified_name = self._get_glossary_name_for_element(element, output_format)
571
578
 
572
579
  # Get categories
573
- _, category_list_md = self._get_categories_for_term(term_guid)
580
+ _, category_list_md = self._get_categories_for_term(term_guid, output_format)
574
581
 
575
582
  return {
576
- 'in_glossary': glossary_qualified_name,
577
- 'categories': category_list_md
578
- }
583
+ 'in_glossary': glossary_qualified_name, 'categories': category_list_md
584
+ }
579
585
 
580
586
  def _generate_term_md(self, elements: list, elements_action: str, output_format: str) -> str:
581
587
  """
@@ -589,14 +595,9 @@ class GlossaryBrowser(Client):
589
595
  Returns:
590
596
  str: Markdown representation
591
597
  """
592
- return self._generate_entity_md(
593
- elements=elements,
594
- elements_action=elements_action,
595
- output_format=output_format,
596
- entity_type="Term",
597
- extract_properties_func=self._extract_term_properties,
598
- get_additional_props_func=self._get_term_additional_properties
599
- )
598
+ 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)
600
601
 
601
602
  def generate_terms_md(self, elements: list | dict, search_string: str, output_format: str = 'MD') -> str | list:
602
603
  """
@@ -610,28 +611,33 @@ class GlossaryBrowser(Client):
610
611
  Returns:
611
612
  str | list: Markdown string or list of dictionaries depending on output_format
612
613
  """
613
- elements_md, elements_action = self.make_preamble(obj_type="Term", search_string=search_string, output_format=output_format)
614
+ elements_md, elements_action = self.make_preamble(obj_type="Term", search_string=search_string,
615
+ output_format=output_format)
614
616
  if isinstance(elements, dict):
615
617
  elements = [elements]
616
618
 
617
- # If output format is MD-TABLE, create a markdown table
619
+ if search_string is None or search_string == '':
620
+ search_string = "All"
621
+
622
+ # If output format is LIST, create a markdown table
618
623
  if output_format == 'LIST':
619
- return self._generate_term_md_table(elements, search_string)
624
+ return self._generate_term_md_table(elements, search_string, output_format)
620
625
 
621
626
  # If output format is DICT, return a dictionary structure
622
627
  elif output_format == 'DICT':
623
- return self._generate_term_dict(elements)
628
+ return self._generate_term_dict(elements, output_format)
624
629
 
625
630
  # Original implementation for other formats (MD, FORM, REPORT)
626
631
  elements_md += self._generate_term_md(elements, elements_action, output_format)
627
632
  return elements_md
628
633
 
629
- def _get_parent_category_name(self, category_guid: str) -> str:
634
+ def _get_parent_category_name(self, category_guid: str, output_format: str = None) -> str:
630
635
  """
631
636
  Get the parent category name for a given category.
632
637
 
633
638
  Args:
634
639
  category_guid (str): The GUID of the category
640
+ output_format (str): Output format (FORM, REPORT, LIST, etc.)
635
641
 
636
642
  Returns:
637
643
  str: The parent category name or '---' if no parent
@@ -639,14 +645,23 @@ class GlossaryBrowser(Client):
639
645
  parent_cat = self.get_category_parent(category_guid)
640
646
  if isinstance(parent_cat, str):
641
647
  return '---'
642
- return parent_cat['glossaryCategoryProperties']['qualifiedName']
643
648
 
644
- def _get_subcategories_list(self, category_guid: str) -> tuple[list, str]:
649
+ # Return qualified name for FORM output, display name for REPORT and LIST output
650
+ if output_format == 'FORM':
651
+ return parent_cat['glossaryCategoryProperties']['qualifiedName']
652
+ elif output_format in ['REPORT', 'LIST']:
653
+ return parent_cat['glossaryCategoryProperties']['displayName']
654
+ else:
655
+ # Default to qualified name for backward compatibility
656
+ return parent_cat['glossaryCategoryProperties']['qualifiedName']
657
+
658
+ def _get_subcategories_list(self, category_guid: str, output_format: str = None) -> tuple[list, str]:
645
659
  """
646
660
  Get a list of subcategories for a given category.
647
661
 
648
662
  Args:
649
663
  category_guid (str): The GUID of the category
664
+ output_format (str): Output format (FORM, REPORT, LIST, etc.)
650
665
 
651
666
  Returns:
652
667
  tuple: A tuple containing:
@@ -660,7 +675,15 @@ class GlossaryBrowser(Client):
660
675
  subcategory_list_md = '---'
661
676
  elif isinstance(subcategories, list) and len(subcategories) > 0:
662
677
  for subcat in subcategories:
663
- subcat_name = subcat["glossaryCategoryProperties"].get("qualifiedName", '')
678
+ # Use qualified name for FORM output, display name for REPORT and LIST output
679
+ if output_format == 'FORM':
680
+ subcat_name = subcat["glossaryCategoryProperties"].get("qualifiedName", '')
681
+ elif output_format in ['REPORT', 'LIST']:
682
+ subcat_name = subcat["glossaryCategoryProperties"].get("displayName", '')
683
+ else:
684
+ # Default to qualified name for backward compatibility
685
+ subcat_name = subcat["glossaryCategoryProperties"].get("qualifiedName", '')
686
+
664
687
  if subcat_name:
665
688
  subcategory_list.append(subcat_name)
666
689
  subcategory_list_md = ", ".join(subcategory_list)
@@ -669,12 +692,13 @@ class GlossaryBrowser(Client):
669
692
 
670
693
  return subcategory_list, subcategory_list_md
671
694
 
672
- def _get_glossary_name_for_element(self, element: dict) -> str:
695
+ def _get_glossary_name_for_element(self, element: dict, output_format: str = None) -> str:
673
696
  """
674
697
  Get the glossary name for a given element.
675
698
 
676
699
  Args:
677
700
  element (dict): The element dictionary
701
+ output_format (str): Output format (FORM, REPORT, etc.)
678
702
 
679
703
  Returns:
680
704
  str: The glossary name or '---' if not found
@@ -683,12 +707,17 @@ class GlossaryBrowser(Client):
683
707
  if classification_props is None:
684
708
  return '---'
685
709
 
686
- glossary_guid = classification_props.get('anchorGUID', '---')
710
+ glossary_guid = classification_props.get('anchorScopeGUID', '---')
687
711
  if glossary_guid == '---':
688
712
  return '---'
689
713
 
690
714
  glossary = self.get_glossary_by_guid(glossary_guid)
691
- return glossary['glossaryProperties']['qualifiedName']
715
+
716
+ # Return display name for REPORT output, qualified name otherwise
717
+ if output_format == 'REPORT':
718
+ return glossary['glossaryProperties']['displayName']
719
+ else:
720
+ return glossary['glossaryProperties']['qualifiedName']
692
721
 
693
722
  def _extract_category_properties(self, element: dict) -> dict:
694
723
  """
@@ -707,131 +736,127 @@ class GlossaryBrowser(Client):
707
736
  qualified_name = properties.get("qualifiedName", "") or ""
708
737
 
709
738
  return {
710
- 'guid': guid,
711
- 'properties': properties,
712
- 'display_name': display_name,
713
- 'description': description,
739
+ 'guid': guid, 'properties': properties, 'display_name': display_name, 'description': description,
714
740
  'qualified_name': qualified_name
715
- }
741
+ }
716
742
 
717
- def _get_category_table_properties(self, element: dict, category_guid: str) -> dict:
743
+ def _get_category_table_properties(self, element: dict, category_guid: str, output_format: str = None) -> dict:
718
744
  """
719
745
  Get properties for a category table row.
720
746
 
721
747
  Args:
722
748
  element (dict): The category element
723
749
  category_guid (str): The GUID of the category
750
+ output_format (str): Output format (FORM, REPORT, etc.)
724
751
 
725
752
  Returns:
726
753
  dict: Dictionary of properties for the table row
727
754
  """
728
755
  # Get parent category
729
- parent_cat_md = self._get_parent_category_name(category_guid)
756
+ parent_cat_md = self._get_parent_category_name(category_guid, output_format)
730
757
 
731
758
  # Get subcategories
732
- _, subcategory_list_md = self._get_subcategories_list(category_guid)
759
+ _, subcategory_list_md = self._get_subcategories_list(category_guid, output_format)
733
760
 
734
761
  return {
735
- 'parent_category': parent_cat_md,
736
- 'subcategories': subcategory_list_md
737
- }
762
+ 'parent_category': parent_cat_md, 'subcategories': subcategory_list_md
763
+ }
738
764
 
739
- def _generate_category_md_table(self, elements: list, search_string: str) -> str:
765
+ def _generate_category_md_table(self, elements: list, search_string: str, output_format: str = 'LIST') -> str:
740
766
  """
741
767
  Generate a markdown table for categories.
742
768
 
743
769
  Args:
744
770
  elements (list): List of category elements
745
771
  search_string (str): The search string used
772
+ output_format (str): Output format (FORM, REPORT, etc.)
746
773
 
747
774
  Returns:
748
775
  str: Markdown table
749
776
  """
750
- columns = [
751
- {'name': 'Display Name', 'key': 'display_name'},
777
+ columns = [{'name': 'Display Name', 'key': 'display_name'},
752
778
  {'name': 'Description', 'key': 'description', 'format': True},
753
- {'name': 'Qualified Name', 'key': 'qualified_name'},
754
- {'name': 'Parent Category', 'key': 'parent_category'},
755
- {'name': 'Subcategories', 'key': 'subcategories', 'format': True}
756
- ]
779
+ {'name': 'Qualified Name', 'key': 'qualified_name'}, {'name': 'Parent Category', 'key': 'parent_category'},
780
+ {'name': 'Subcategories', 'key': 'subcategories', 'format': True}]
757
781
 
758
- return self._generate_entity_md_table(
759
- elements=elements,
760
- search_string=search_string,
761
- entity_type="Category",
762
- extract_properties_func=self._extract_category_properties,
763
- columns=columns,
764
- get_additional_props_func=self._get_category_table_properties
765
- )
782
+ # Create a wrapper function to pass output_format to _get_category_table_properties
783
+ def get_table_props_with_format(element, category_guid, output_format_param=None):
784
+ return self._get_category_table_properties(element, category_guid, output_format)
766
785
 
767
- def _get_category_dict_properties(self, element: dict, category_guid: str) -> dict:
786
+ 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)
789
+
790
+ def _get_category_dict_properties(self, element: dict, category_guid: str, output_format: str = None) -> dict:
768
791
  """
769
792
  Get additional properties for a category dictionary.
770
793
 
771
794
  Args:
772
795
  element (dict): The category element
773
796
  category_guid (str): The GUID of the category
797
+ output_format (str): Output format (FORM, REPORT, etc.)
774
798
 
775
799
  Returns:
776
800
  dict: Dictionary of additional properties
777
801
  """
778
802
  # Get parent category
779
- parent_cat_md = self._get_parent_category_name(category_guid)
803
+ parent_cat_md = self._get_parent_category_name(category_guid, output_format)
780
804
 
781
805
  # Get subcategories
782
- subcategory_list, _ = self._get_subcategories_list(category_guid)
806
+ subcategory_list, _ = self._get_subcategories_list(category_guid, output_format)
783
807
 
784
808
  # Get glossary information
785
- glossary_qualified_name = self._get_glossary_name_for_element(element)
809
+ glossary_qualified_name = self._get_glossary_name_for_element(element, output_format)
786
810
 
787
811
  return {
788
- 'parent_category': parent_cat_md,
789
- 'subcategories': subcategory_list,
790
- 'in_glossary': glossary_qualified_name
791
- }
812
+ 'parent_category': parent_cat_md, 'subcategories': subcategory_list, 'in_glossary': glossary_qualified_name
813
+ }
792
814
 
793
- def _generate_category_dict(self, elements: list) -> list:
815
+ def _generate_category_dict(self, elements: list, output_format: str = 'DICT') -> list:
794
816
  """
795
817
  Generate a dictionary representation of categories.
796
818
 
797
819
  Args:
798
820
  elements (list): List of category elements
821
+ output_format (str): Output format (FORM, REPORT, etc.)
799
822
 
800
823
  Returns:
801
824
  list: List of category dictionaries
802
825
  """
803
- return self._generate_entity_dict(
804
- elements=elements,
805
- extract_properties_func=self._extract_category_properties,
806
- get_additional_props_func=self._get_category_dict_properties,
807
- exclude_keys=['properties'] # Exclude raw properties
808
- )
809
826
 
810
- def _get_category_additional_properties(self, element: dict, category_guid: str) -> dict:
827
+ # Create a wrapper function to pass output_format to _get_category_dict_properties
828
+ def get_dict_props_with_format(element, category_guid, output_format_param=None):
829
+ return self._get_category_dict_properties(element, category_guid, output_format)
830
+
831
+ 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)
834
+
835
+ def _get_category_additional_properties(self, element: dict, category_guid: str, output_format: str = None) -> dict:
811
836
  """
812
837
  Get additional properties for a category.
813
838
 
814
839
  Args:
815
840
  element (dict): The category element
816
841
  category_guid (str): The GUID of the category
842
+ output_format (str): Output format (FORM, REPORT, etc.)
817
843
 
818
844
  Returns:
819
845
  dict: Dictionary of additional properties
820
846
  """
821
847
  # Get parent category
822
- parent_cat_md = self._get_parent_category_name(category_guid)
848
+ parent_cat_md = self._get_parent_category_name(category_guid, output_format)
823
849
 
824
850
  # Get subcategories
825
- _, subcategory_list_md = self._get_subcategories_list(category_guid)
851
+ _, subcategory_list_md = self._get_subcategories_list(category_guid, output_format)
826
852
 
827
853
  # Get glossary information
828
- glossary_qualified_name = self._get_glossary_name_for_element(element)
854
+ glossary_qualified_name = self._get_glossary_name_for_element(element, output_format)
829
855
 
830
856
  return {
831
- 'in_glossary': glossary_qualified_name,
832
- 'parent_category': parent_cat_md,
857
+ 'in_glossary': glossary_qualified_name, 'parent_category': parent_cat_md,
833
858
  'subcategories': subcategory_list_md
834
- }
859
+ }
835
860
 
836
861
  def _generate_category_md(self, elements: list, elements_action: str, output_format: str) -> str:
837
862
  """
@@ -845,16 +870,17 @@ class GlossaryBrowser(Client):
845
870
  Returns:
846
871
  str: Markdown representation
847
872
  """
848
- return self._generate_entity_md(
849
- elements=elements,
850
- elements_action=elements_action,
851
- output_format=output_format,
852
- entity_type="Category",
853
- extract_properties_func=self._extract_category_properties,
854
- get_additional_props_func=self._get_category_additional_properties
855
- )
856
873
 
857
- def generate_categories_md(self, elements: list | dict, search_string: str, output_format: str = 'MD')-> str | list:
874
+ # Create a wrapper function to pass output_format to _get_category_additional_properties
875
+ def get_additional_props_with_format(element, category_guid, output_format_param=None):
876
+ return self._get_category_additional_properties(element, category_guid, output_format)
877
+
878
+ return self._generate_entity_md(elements=elements, elements_action=elements_action, output_format=output_format,
879
+ entity_type="Category", extract_properties_func=self._extract_category_properties,
880
+ get_additional_props_func=get_additional_props_with_format)
881
+
882
+ def generate_categories_md(self, elements: list | dict, search_string: str,
883
+ output_format: str = 'MD') -> str | list:
858
884
  """
859
885
  Generate markdown or dictionary representation of categories.
860
886
 
@@ -871,13 +897,16 @@ class GlossaryBrowser(Client):
871
897
  if isinstance(elements, dict):
872
898
  elements = [elements]
873
899
 
900
+ if search_string is None or search_string == '':
901
+ search_string = "All"
902
+
874
903
  # If output format is LIST, create a markdown table
875
904
  if output_format == 'LIST':
876
- return self._generate_category_md_table(elements, search_string)
905
+ return self._generate_category_md_table(elements, search_string, output_format)
877
906
 
878
907
  # If output format is DICT, return a dictionary structure
879
908
  elif output_format == 'DICT':
880
- return self._generate_category_dict(elements)
909
+ return self._generate_category_dict(elements, output_format)
881
910
 
882
911
  # Original implementation for other formats (MD, FORM, REPORT)
883
912
  elements_md += self._generate_category_md(elements, elements_action, output_format)
@@ -901,10 +930,8 @@ class GlossaryBrowser(Client):
901
930
 
902
931
  """
903
932
 
904
- url = (
905
- f"{self.platform_url}/servers/{self.view_server}"
906
- f"/api/open-metadata/glossary-browser/glossaries/terms/status-list"
907
- )
933
+ url = (f"{self.platform_url}/servers/{self.view_server}"
934
+ f"/api/open-metadata/glossary-browser/glossaries/terms/status-list")
908
935
 
909
936
  response = await self._async_make_request("GET", url)
910
937
  return response.json().get("statuses", [])
@@ -942,10 +969,8 @@ class GlossaryBrowser(Client):
942
969
 
943
970
  """
944
971
 
945
- url = (
946
- f"{self.platform_url}/servers/{self.view_server}"
947
- f"/api/open-metadata/glossary-browser/glossaries/terms/relationships/status-list"
948
- )
972
+ url = (f"{self.platform_url}/servers/{self.view_server}"
973
+ f"/api/open-metadata/glossary-browser/glossaries/terms/relationships/status-list")
949
974
 
950
975
  response = await self._async_make_request("GET", url)
951
976
  return response.json().get("statuses", [])
@@ -983,10 +1008,8 @@ class GlossaryBrowser(Client):
983
1008
 
984
1009
  """
985
1010
 
986
- url = (
987
- f"{self.platform_url}/servers/{self.view_server}"
988
- f"/api/open-metadata/glossary-browser/glossaries/terms/activity-types"
989
- )
1011
+ url = (f"{self.platform_url}/servers/{self.view_server}"
1012
+ f"/api/open-metadata/glossary-browser/glossaries/terms/activity-types")
990
1013
 
991
1014
  response = await self._async_make_request("GET", url)
992
1015
  return response.json().get("types", [])
@@ -1012,20 +1035,10 @@ class GlossaryBrowser(Client):
1012
1035
  # Glossaries
1013
1036
  #
1014
1037
 
1015
- async def _async_find_glossaries(
1016
- self,
1017
- search_string: str,
1018
- effective_time: str = None,
1019
- starts_with: bool = False,
1020
- ends_with: bool = False,
1021
- ignore_case: bool = False,
1022
- for_lineage: bool = False,
1023
- for_duplicate_processing: bool = False,
1024
- type_name: str = None,
1025
- start_from: int = 0,
1026
- page_size: int = None,
1027
- output_format: str = 'JSON'
1028
- ) -> list | str:
1038
+ async def _async_find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
1039
+ ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
1040
+ for_duplicate_processing: bool = False, type_name: str = None, start_from: int = 0, page_size: int = None,
1041
+ output_format: str = 'JSON') -> list | str:
1029
1042
  """Retrieve the list of glossary metadata elements that contain the search string. Async version.
1030
1043
  The search string is located in the request body and is interpreted as a plain string.
1031
1044
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
@@ -1096,43 +1109,34 @@ class GlossaryBrowser(Client):
1096
1109
  search_string = None
1097
1110
 
1098
1111
  body = {
1099
- "class": "SearchStringRequestBody",
1100
- "searchString": search_string,
1101
- "effectiveTime": effective_time,
1112
+ "class": "SearchStringRequestBody", "searchString": search_string, "effectiveTime": effective_time,
1102
1113
  "typeName": type_name,
1103
- }
1114
+ }
1104
1115
  body = body_slimmer(body)
1105
1116
 
1106
- url = (
1107
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1108
- f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
1109
- f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
1110
- f"forDuplicateProcessing={for_duplicate_processing_s}"
1111
- )
1117
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1118
+ f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
1119
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
1120
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
1112
1121
 
1113
1122
  response = await self._async_make_request("POST", url, body_slimmer(body))
1114
1123
  element = response.json().get("elementList", NO_GLOSSARIES_FOUND)
1115
1124
  if element == NO_GLOSSARIES_FOUND:
1116
- return NO_GLOSSARIES_FOUND
1125
+ if output_format == 'JSON':
1126
+ return NO_GLOSSARIES_FOUND
1127
+ elif output_format in ['MD', 'FORM', 'REPORT', 'LIST']:
1128
+ return "\n# No glossaries found.\n"
1129
+ elif output_format == 'DICT':
1130
+ return None
1131
+
1117
1132
  if output_format != 'JSON': # return a simplified markdown representation
1118
1133
  return self.generate_glossaries_md(element, search_string, output_format)
1119
1134
  return response.json().get("elementList", NO_GLOSSARIES_FOUND)
1120
1135
 
1121
-
1122
- def find_glossaries(
1123
- self,
1124
- search_string: str,
1125
- effective_time: str = None,
1126
- starts_with: bool = False,
1127
- ends_with: bool = False,
1128
- ignore_case: bool = False,
1129
- for_lineage: bool = False,
1130
- for_duplicate_processing: bool = False,
1131
- type_name: str = None,
1132
- start_from: int = 0,
1133
- page_size: int = None,
1134
- output_format: str = "JSON"
1135
- ) -> list | str:
1136
+ def find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
1137
+ ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
1138
+ for_duplicate_processing: bool = False, type_name: str = None, start_from: int = 0, page_size: int = None,
1139
+ output_format: str = "JSON") -> list | str:
1136
1140
  """Retrieve the list of glossary metadata elements that contain the search string.
1137
1141
  The search string is located in the request body and is interpreted as a plain string.
1138
1142
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
@@ -1171,7 +1175,8 @@ class GlossaryBrowser(Client):
1171
1175
  MD - output standard markdown with no preamble
1172
1176
  FORM - output markdown with a preamble for a form
1173
1177
  REPORT - output markdown with a preamble for a report
1174
- LIST - output a markdown table with columns for Glossary Name, Qualified Name, Language, Description, Usage
1178
+ LIST - output a markdown table with columns for Glossary Name, Qualified Name, Language, Description,
1179
+ Usage
1175
1180
  DICT - output a dictionary structure containing all attributes
1176
1181
  Returns
1177
1182
  -------
@@ -1192,26 +1197,13 @@ class GlossaryBrowser(Client):
1192
1197
  """
1193
1198
  loop = asyncio.get_event_loop()
1194
1199
  response = loop.run_until_complete(
1195
- self._async_find_glossaries(
1196
- search_string,
1197
- effective_time,
1198
- starts_with,
1199
- ends_with,
1200
- ignore_case,
1201
- for_lineage,
1202
- for_duplicate_processing,
1203
- type_name,
1204
- start_from,
1205
- page_size,
1206
- output_format
1207
- )
1208
- )
1200
+ self._async_find_glossaries(search_string, effective_time, starts_with, ends_with, ignore_case, for_lineage,
1201
+ for_duplicate_processing, type_name, start_from, page_size, output_format))
1209
1202
 
1210
1203
  return response
1211
1204
 
1212
- async def _async_get_glossary_by_guid(
1213
- self, glossary_guid: str, effective_time: str = None, output_format: str = "JSON"
1214
- ) -> dict|str:
1205
+ async def _async_get_glossary_by_guid(self, glossary_guid: str, effective_time: str = None,
1206
+ output_format: str = "JSON") -> dict | str:
1215
1207
  """Retrieves information about a glossary
1216
1208
  Parameters
1217
1209
  ----------
@@ -1226,7 +1218,8 @@ class GlossaryBrowser(Client):
1226
1218
  MD - output standard markdown with no preamble
1227
1219
  FORM - output markdown with a preamble for a form
1228
1220
  REPORT - output markdown with a preamble for a report
1229
- LIST - output a markdown table with columns for Glossary Name, Qualified Name, Language, Description, Usage
1221
+ LIST - output a markdown table with columns for Glossary Name, Qualified Name, Language, Description,
1222
+ Usage
1230
1223
  DICT - output a dictionary structure containing all attributes
1231
1224
 
1232
1225
  Returns
@@ -1249,13 +1242,10 @@ class GlossaryBrowser(Client):
1249
1242
  validate_guid(glossary_guid)
1250
1243
 
1251
1244
  body = {
1252
- "class": "EffectiveTimeQueryRequestBody",
1253
- "effectiveTime" : effective_time
1254
- }
1255
- url = (
1256
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1257
- f"{glossary_guid}/retrieve"
1258
- )
1245
+ "class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time
1246
+ }
1247
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1248
+ f"{glossary_guid}/retrieve")
1259
1249
  response = await self._async_make_request("POST", url, body_slimmer(body))
1260
1250
  element = response.json().get("element", NO_GLOSSARIES_FOUND)
1261
1251
  if element == NO_GLOSSARIES_FOUND:
@@ -1264,10 +1254,7 @@ class GlossaryBrowser(Client):
1264
1254
  return self.generate_glossaries_md(element, "GUID", output_format)
1265
1255
  return response.json().get("element", NO_GLOSSARIES_FOUND)
1266
1256
 
1267
-
1268
- def get_glossary_by_guid(
1269
- self, glossary_guid: str, effective_time: str = None, output_format: str = "JSON"
1270
- ) -> dict:
1257
+ def get_glossary_by_guid(self, glossary_guid: str, effective_time: str = None, output_format: str = "JSON") -> dict:
1271
1258
  """Retrieves information about a glossary
1272
1259
  Parameters
1273
1260
  ----------
@@ -1282,7 +1269,8 @@ class GlossaryBrowser(Client):
1282
1269
  MD - output standard markdown with no preamble
1283
1270
  FORM - output markdown with a preamble for a form
1284
1271
  REPORT - output markdown with a preamble for a report
1285
- LIST - output a markdown table with columns for Glossary Name, Qualified Name, Language, Description, Usage
1272
+ LIST - output a markdown table with columns for Glossary Name, Qualified Name, Language, Description,
1273
+ Usage
1286
1274
  DICT - output a dictionary structure containing all attributes
1287
1275
 
1288
1276
  Returns
@@ -1303,17 +1291,11 @@ class GlossaryBrowser(Client):
1303
1291
  """
1304
1292
  loop = asyncio.get_event_loop()
1305
1293
  response = loop.run_until_complete(
1306
- self._async_get_glossary_by_guid(glossary_guid, effective_time, output_format)
1307
- )
1294
+ self._async_get_glossary_by_guid(glossary_guid, effective_time, output_format))
1308
1295
  return response
1309
1296
 
1310
- async def _async_get_glossaries_by_name(
1311
- self,
1312
- glossary_name: str,
1313
- effective_time: str = None,
1314
- start_from: int = 0,
1315
- page_size: int = None,
1316
- ) -> dict | str:
1297
+ async def _async_get_glossaries_by_name(self, glossary_name: str, effective_time: str = None, start_from: int = 0,
1298
+ page_size: int = None, ) -> dict | str:
1317
1299
  """Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
1318
1300
  There are no wildcards supported on this request.
1319
1301
 
@@ -1359,21 +1341,14 @@ class GlossaryBrowser(Client):
1359
1341
  else:
1360
1342
  body = {"name": glossary_name, "effectiveTime": effective_time}
1361
1343
 
1362
- url = (
1363
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1364
- f"by-name?startFrom={start_from}&pageSize={page_size}"
1365
- )
1344
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1345
+ f"by-name?startFrom={start_from}&pageSize={page_size}")
1366
1346
 
1367
1347
  response = await self._async_make_request("POST", url, body)
1368
1348
  return response.json().get("elementList", "No glossaries found")
1369
1349
 
1370
- def get_glossaries_by_name(
1371
- self,
1372
- glossary_name: str,
1373
- effective_time: str = None,
1374
- start_from: int = 0,
1375
- page_size: int = None,
1376
- ) -> dict | str:
1350
+ def get_glossaries_by_name(self, glossary_name: str, effective_time: str = None, start_from: int = 0,
1351
+ page_size: int = None, ) -> dict | str:
1377
1352
  """Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
1378
1353
  There are no wildcards supported on this request.
1379
1354
 
@@ -1409,21 +1384,15 @@ class GlossaryBrowser(Client):
1409
1384
  """
1410
1385
  loop = asyncio.get_event_loop()
1411
1386
  response = loop.run_until_complete(
1412
- self._async_get_glossaries_by_name(
1413
- glossary_name, effective_time, start_from, page_size
1414
- )
1415
- )
1387
+ self._async_get_glossaries_by_name(glossary_name, effective_time, start_from, page_size))
1416
1388
  return response
1417
1389
 
1418
1390
  #
1419
1391
  # Glossary Categories
1420
1392
  #
1421
1393
 
1422
- async def _async_get_glossary_for_category(
1423
- self,
1424
- glossary_category_guid: str,
1425
- effective_time: str = None,
1426
- ) -> dict | str:
1394
+ async def _async_get_glossary_for_category(self, glossary_category_guid: str,
1395
+ effective_time: str = None, ) -> dict | str:
1427
1396
  """Retrieve the glossary metadata element for the requested category. The optional request body allows you to
1428
1397
  specify that the glossary element should only be returned if it was effective at a particular time.
1429
1398
 
@@ -1456,23 +1425,16 @@ class GlossaryBrowser(Client):
1456
1425
  """
1457
1426
 
1458
1427
  body = {
1459
- "class": "EffectiveTimeQueryRequestBody",
1460
- "effectiveTime": effective_time,
1461
- }
1428
+ "class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time,
1429
+ }
1462
1430
 
1463
- url = (
1464
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1465
- f"for-category/{glossary_category_guid}/retrieve"
1466
- )
1431
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1432
+ f"for-category/{glossary_category_guid}/retrieve")
1467
1433
 
1468
1434
  response = await self._async_make_request("POST", url, body)
1469
1435
  return response.json().get("elementList", "No categories found")
1470
1436
 
1471
- def get_glossary_for_category(
1472
- self,
1473
- glossary_category_guid: str,
1474
- effective_time: str = None,
1475
- ) -> dict | str:
1437
+ def get_glossary_for_category(self, glossary_category_guid: str, effective_time: str = None, ) -> dict | str:
1476
1438
  """Retrieve the glossary metadata element for the requested category. The optional request body allows you to
1477
1439
  specify that the glossary element should only be returned if it was effective at a particular time.
1478
1440
 
@@ -1505,21 +1467,12 @@ class GlossaryBrowser(Client):
1505
1467
  """
1506
1468
  loop = asyncio.get_event_loop()
1507
1469
  response = loop.run_until_complete(
1508
- self._async_get_glossary_for_category(
1509
- glossary_category_guid, effective_time
1510
- )
1511
- )
1470
+ self._async_get_glossary_for_category(glossary_category_guid, effective_time))
1512
1471
  return response
1513
1472
 
1514
- async def _async_get_glossary_subcategories(
1515
- self,
1516
- glossary_category_guid: str,
1517
- effective_time: str = None,
1518
- start_from: int = 0,
1519
- page_size: int = max_paging_size,
1520
- for_lineage: bool = False,
1521
- for_duplicate_processing: bool = False,
1522
- ) -> dict | str:
1473
+ async def _async_get_glossary_subcategories(self, glossary_category_guid: str, effective_time: str = None,
1474
+ start_from: int = 0, page_size: int = max_paging_size, for_lineage: bool = False,
1475
+ for_duplicate_processing: bool = False, ) -> dict | str:
1523
1476
  """Glossary categories can be organized in a hierarchy. Retrieve the subcategories for the glossary category
1524
1477
  metadata element with the supplied unique identifier. If the requested category does not have any subcategories,
1525
1478
  null is returned. The optional request body contain an effective time for the query.
@@ -1561,15 +1514,13 @@ class GlossaryBrowser(Client):
1561
1514
  for_duplicate_processing_s = str(for_duplicate_processing).lower()
1562
1515
 
1563
1516
  body = {
1564
- "class": "EffectiveTimeQueryRequestBody",
1565
- "effectiveTime": effective_time,
1566
- }
1517
+ "class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time,
1518
+ }
1567
1519
 
1568
- url = (
1569
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1570
- f"categories/{glossary_category_guid}/subcategories/retrieve?startFrom={start_from}&pageSize={page_size}&"
1571
- f"forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}"
1572
- )
1520
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1521
+ f"categories/{glossary_category_guid}/subcategories/retrieve?startFrom={start_from}&pageSize="
1522
+ f"{page_size}&"
1523
+ f"forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}")
1573
1524
  if effective_time:
1574
1525
  response = await self._async_make_request("POST", url, body_slimmer(body))
1575
1526
  else:
@@ -1577,15 +1528,9 @@ class GlossaryBrowser(Client):
1577
1528
 
1578
1529
  return response.json().get("elementList", "No categories found")
1579
1530
 
1580
- def get_glossary_subcategories(
1581
- self,
1582
- glossary_category_guid: str,
1583
- effective_time: str = None,
1584
- start_from: int = 0,
1585
- page_size: int = max_paging_size,
1586
- for_lineage: bool = False,
1587
- for_duplicate_processing: bool = False,
1588
- ) -> dict | str:
1531
+ def get_glossary_subcategories(self, glossary_category_guid: str, effective_time: str = None, start_from: int = 0,
1532
+ page_size: int = max_paging_size, for_lineage: bool = False,
1533
+ for_duplicate_processing: bool = False, ) -> dict | str:
1589
1534
  """Glossary categories can be organized in a hierarchy. Retrieve the subcategories for the glossary category
1590
1535
  metadata element with the supplied unique identifier. If the requested category does not have any subcategories,
1591
1536
  null is returned. The optional request body contain an effective time for the query.
@@ -1625,24 +1570,13 @@ class GlossaryBrowser(Client):
1625
1570
  """
1626
1571
  loop = asyncio.get_event_loop()
1627
1572
  response = loop.run_until_complete(
1628
- self._async_get_glossary_subcategories(
1629
- glossary_category_guid, effective_time, start_from,
1630
- page_size, for_lineage, for_duplicate_processing
1631
- )
1632
- )
1573
+ self._async_get_glossary_subcategories(glossary_category_guid, effective_time, start_from, page_size,
1574
+ for_lineage, for_duplicate_processing))
1633
1575
  return response
1634
1576
 
1635
- async def _async_find_glossary_categories(
1636
- self,
1637
- search_string: str,
1638
- effective_time: str = None,
1639
- starts_with: bool = False,
1640
- ends_with: bool = False,
1641
- ignore_case: bool = False,
1642
- start_from: int = 0,
1643
- page_size: int = None,
1644
- output_format: str = "JSON"
1645
- ) -> list | str:
1577
+ async def _async_find_glossary_categories(self, search_string: str, effective_time: str = None,
1578
+ starts_with: bool = False, ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
1579
+ page_size: int = None, output_format: str = "JSON") -> list | str:
1646
1580
  """Retrieve the list of glossary category metadata elements that contain the search string.
1647
1581
  The search string is located in the request body and is interpreted as a plain string.
1648
1582
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
@@ -1706,38 +1640,28 @@ class GlossaryBrowser(Client):
1706
1640
  search_string = None
1707
1641
 
1708
1642
  body = {
1709
- "class": "SearchStringRequestBody",
1710
- "searchString": search_string,
1711
- "effectiveTime": effective_time,
1712
- }
1643
+ "class": "SearchStringRequestBody", "searchString": search_string, "effectiveTime": effective_time,
1644
+ }
1713
1645
 
1714
- url = (
1715
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1716
- f"categories/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
1717
- f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}"
1718
- )
1646
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1647
+ f"categories/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
1648
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}")
1719
1649
  response = await self._async_make_request("POST", url, body_slimmer(body))
1720
1650
  element = response.json().get("elementList", NO_CATEGORIES_FOUND)
1721
1651
  if element == NO_CATEGORIES_FOUND:
1722
- return NO_CATEGORIES_FOUND
1652
+ if output_format == 'JSON':
1653
+ return NO_CATEGORIES_FOUND
1654
+ elif output_format in ['MD', 'FORM', 'REPORT', 'LIST']:
1655
+ return "\n# No categories found.\n"
1656
+ elif output_format == 'DICT':
1657
+ return None
1723
1658
  if output_format != 'JSON': # return a simplified markdown representation
1724
1659
  return self.generate_categories_md(element, search_string, output_format)
1725
1660
  return response.json().get("elementList", NO_CATEGORIES_FOUND)
1726
1661
 
1727
-
1728
-
1729
-
1730
- def find_glossary_categories(
1731
- self,
1732
- search_string: str,
1733
- effective_time: str = None,
1734
- starts_with: bool = False,
1735
- ends_with: bool = False,
1736
- ignore_case: bool = False,
1737
- start_from: int = 0,
1738
- page_size: int = None,
1739
- output_format: str = "JSON"
1740
- ) -> list | str:
1662
+ def find_glossary_categories(self, search_string: str, effective_time: str = None, starts_with: bool = False,
1663
+ ends_with: bool = False, ignore_case: bool = False, start_from: int = 0, page_size: int = None,
1664
+ output_format: str = "JSON") -> list | str:
1741
1665
  """Retrieve the list of glossary category metadata elements that contain the search string.
1742
1666
  The search string is located in the request body and is interpreted as a plain string.
1743
1667
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
@@ -1790,26 +1714,13 @@ class GlossaryBrowser(Client):
1790
1714
  """
1791
1715
  loop = asyncio.get_event_loop()
1792
1716
  response = loop.run_until_complete(
1793
- self._async_find_glossary_categories(
1794
- search_string,
1795
- effective_time,
1796
- starts_with,
1797
- ends_with,
1798
- ignore_case,
1799
- start_from,
1800
- page_size,
1801
- output_format
1802
- )
1803
- )
1717
+ self._async_find_glossary_categories(search_string, effective_time, starts_with, ends_with, ignore_case,
1718
+ start_from, page_size, output_format))
1804
1719
 
1805
1720
  return response
1806
1721
 
1807
- async def _async_get_categories_for_glossary(
1808
- self,
1809
- glossary_guid: str,
1810
- start_from: int = 0,
1811
- page_size: int = None,
1812
- ) -> list | str:
1722
+ async def _async_get_categories_for_glossary(self, glossary_guid: str, start_from: int = 0,
1723
+ page_size: int = None, ) -> list | str:
1813
1724
  """Return the list of categories associated with a glossary.
1814
1725
  Async version.
1815
1726
 
@@ -1845,20 +1756,14 @@ class GlossaryBrowser(Client):
1845
1756
  if page_size is None:
1846
1757
  page_size = self.page_size
1847
1758
 
1848
- url = (
1849
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1850
- f"{glossary_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}"
1851
- )
1759
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
1760
+ f"{glossary_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}")
1852
1761
 
1853
1762
  response = await self._async_make_request("POST", url)
1854
1763
  return response.json().get("elementList", "No Categories found")
1855
1764
 
1856
- def get_categories_for_glossary(
1857
- self,
1858
- glossary_guid: str,
1859
- start_from: int = 0,
1860
- page_size: int = None,
1861
- ) -> list | str:
1765
+ def get_categories_for_glossary(self, glossary_guid: str, start_from: int = 0,
1766
+ page_size: int = None, ) -> list | str:
1862
1767
  """Return the list of categories associated with a glossary.
1863
1768
 
1864
1769
  Parameters
@@ -1891,18 +1796,11 @@ class GlossaryBrowser(Client):
1891
1796
  """
1892
1797
  loop = asyncio.get_event_loop()
1893
1798
  response = loop.run_until_complete(
1894
- self._async_get_categories_for_glossary(
1895
- glossary_guid, start_from, page_size
1896
- )
1897
- )
1799
+ self._async_get_categories_for_glossary(glossary_guid, start_from, page_size))
1898
1800
  return response
1899
1801
 
1900
- async def _async_get_categories_for_term(
1901
- self,
1902
- glossary_term_guid: str,
1903
- start_from: int = 0,
1904
- page_size: int = None,
1905
- ) -> list | str:
1802
+ async def _async_get_categories_for_term(self, glossary_term_guid: str, start_from: int = 0,
1803
+ page_size: int = None, ) -> list | str:
1906
1804
  """Return the list of categories associated with a glossary term.
1907
1805
  Async version.
1908
1806
 
@@ -1937,20 +1835,14 @@ class GlossaryBrowser(Client):
1937
1835
  if page_size is None:
1938
1836
  page_size = self.page_size
1939
1837
 
1940
- url = (
1941
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
1942
- f"{glossary_term_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}"
1943
- )
1838
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
1839
+ f"{glossary_term_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}")
1944
1840
 
1945
1841
  response = await self._async_make_request("POST", url)
1946
1842
  return response.json().get("elementList", "No Categories found")
1947
1843
 
1948
- def get_categories_for_term(
1949
- self,
1950
- glossary_term_guid: str,
1951
- start_from: int = 0,
1952
- page_size: int = None,
1953
- ) -> list | str:
1844
+ def get_categories_for_term(self, glossary_term_guid: str, start_from: int = 0,
1845
+ page_size: int = None, ) -> list | str:
1954
1846
  """Return the list of categories associated with a glossary term.
1955
1847
 
1956
1848
  Parameters
@@ -1982,20 +1874,11 @@ class GlossaryBrowser(Client):
1982
1874
  """
1983
1875
  loop = asyncio.get_event_loop()
1984
1876
  response = loop.run_until_complete(
1985
- self._async_get_categories_for_term(
1986
- glossary_term_guid, start_from, page_size
1987
- )
1988
- )
1877
+ self._async_get_categories_for_term(glossary_term_guid, start_from, page_size))
1989
1878
  return response
1990
1879
 
1991
- async def _async_get_categories_by_name(
1992
- self,
1993
- name: str,
1994
- glossary_guid: str = None,
1995
- status: [str] = ["ACTIVE"],
1996
- start_from: int = 0,
1997
- page_size: int = None,
1998
- ) -> list | str:
1880
+ async def _async_get_categories_by_name(self, name: str, glossary_guid: str = None, status: [str] = ["ACTIVE"],
1881
+ start_from: int = 0, page_size: int = None, ) -> list | str:
1999
1882
  """Retrieve the list of glossary category metadata elements that either have the requested qualified name or
2000
1883
  display name. The name to search for is located in the request body and is interpreted as a plain string.
2001
1884
  The request body also supports the specification of a glossaryGUID to restrict the search to within a single
@@ -2042,27 +1925,18 @@ class GlossaryBrowser(Client):
2042
1925
 
2043
1926
  url = (
2044
1927
  f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/categories/"
2045
- f"by-name?startFrom={start_from}&pageSize={page_size}"
2046
- )
1928
+ f"by-name?startFrom={start_from}&pageSize={page_size}")
2047
1929
 
2048
1930
  body = {
2049
- "class": "GlossaryNameRequestBody",
2050
- "name": name,
2051
- "glossaryGUID": glossary_guid,
1931
+ "class": "GlossaryNameRequestBody", "name": name, "glossaryGUID": glossary_guid,
2052
1932
  "limitResultsByStatus": status,
2053
- }
1933
+ }
2054
1934
 
2055
1935
  response = await self._async_make_request("POST", url, body)
2056
1936
  return response.json().get("elementList", NO_CATEGORIES_FOUND)
2057
1937
 
2058
- def get_categories_by_name(
2059
- self,
2060
- name: str,
2061
- glossary_guid: str = None,
2062
- status: [str] = ["ACTIVE"],
2063
- start_from: int = 0,
2064
- page_size: int = None,
2065
- ) -> list | str:
1938
+ def get_categories_by_name(self, name: str, glossary_guid: str = None, status: [str] = ["ACTIVE"],
1939
+ start_from: int = 0, page_size: int = None, ) -> list | str:
2066
1940
  """Retrieve the list of glossary category metadata elements that either have the requested qualified name or
2067
1941
  display name. The name to search for is located in the request body and is interpreted as a plain string.
2068
1942
  The request body also supports the specification of a glossaryGUID to restrict the search to within a
@@ -2102,18 +1976,11 @@ class GlossaryBrowser(Client):
2102
1976
  """
2103
1977
  loop = asyncio.get_event_loop()
2104
1978
  response = loop.run_until_complete(
2105
- self._async_get_categories_by_name(
2106
- name, glossary_guid, status, start_from, page_size
2107
- )
2108
- )
1979
+ self._async_get_categories_by_name(name, glossary_guid, status, start_from, page_size))
2109
1980
  return response
2110
1981
 
2111
- async def _async_get_categories_by_guid(
2112
- self,
2113
- glossary_category_guid: str,
2114
- effective_time: str = None,
2115
- output_format: str = 'JSON',
2116
- ) -> list | str:
1982
+ async def _async_get_categories_by_guid(self, glossary_category_guid: str, effective_time: str = None,
1983
+ output_format: str = 'JSON', ) -> list | str:
2117
1984
  """Retrieve the requested glossary category metadata element. The optional request body contain an effective
2118
1985
  time for the query..
2119
1986
 
@@ -2154,13 +2021,11 @@ class GlossaryBrowser(Client):
2154
2021
  output_format = output_format.upper()
2155
2022
  url = (
2156
2023
  f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/categories/"
2157
- f"{glossary_category_guid}/retrieve"
2158
- )
2024
+ f"{glossary_category_guid}/retrieve")
2159
2025
 
2160
2026
  body = {
2161
- "class": "EffectiveTimeQueryRequestBody",
2162
- "effectiveTime": effective_time,
2163
- }
2027
+ "class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time,
2028
+ }
2164
2029
 
2165
2030
  response = await self._async_make_request("POST", url, body_slimmer(body))
2166
2031
  element = response.json().get("element", NO_CATEGORIES_FOUND)
@@ -2170,12 +2035,8 @@ class GlossaryBrowser(Client):
2170
2035
  return self.generate_categories_md(element, "GUID", output_format)
2171
2036
  return response.json().get("element", NO_CATEGORIES_FOUND)
2172
2037
 
2173
- def get_categories_by_guid(
2174
- self,
2175
- glossary_category_guid: str,
2176
- effective_time: str = None,
2177
- output_format: str = 'JSON',
2178
- ) -> list | str:
2038
+ def get_categories_by_guid(self, glossary_category_guid: str, effective_time: str = None,
2039
+ output_format: str = 'JSON', ) -> list | str:
2179
2040
  """Retrieve the requested glossary category metadata element. The optional request body contain an effective
2180
2041
  time for the query..
2181
2042
 
@@ -2213,15 +2074,10 @@ class GlossaryBrowser(Client):
2213
2074
  """
2214
2075
  loop = asyncio.get_event_loop()
2215
2076
  response = loop.run_until_complete(
2216
- self._async_get_categories_by_guid(glossary_category_guid, effective_time, output_format)
2217
- )
2077
+ self._async_get_categories_by_guid(glossary_category_guid, effective_time, output_format))
2218
2078
  return response
2219
2079
 
2220
- async def _async_get_category_parent(
2221
- self,
2222
- glossary_category_guid: str,
2223
- effective_time: str = None,
2224
- ) -> list | str:
2080
+ async def _async_get_category_parent(self, glossary_category_guid: str, effective_time: str = None, ) -> list | str:
2225
2081
  """Glossary categories can be organized in a hierarchy. Retrieve the parent glossary category metadata
2226
2082
  element for the glossary category with the supplied unique identifier. If the requested category
2227
2083
  does not have a parent category, null is returned. The optional request body contain an effective time
@@ -2259,22 +2115,16 @@ class GlossaryBrowser(Client):
2259
2115
 
2260
2116
  url = (
2261
2117
  f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/categories/"
2262
- f"{glossary_category_guid}/parent/retrieve"
2263
- )
2118
+ f"{glossary_category_guid}/parent/retrieve")
2264
2119
 
2265
2120
  body = {
2266
- "class": "EffectiveTimeQueryRequestBody",
2267
- "effectiveTime": effective_time,
2268
- }
2121
+ "class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time,
2122
+ }
2269
2123
 
2270
2124
  response = await self._async_make_request("POST", url, body)
2271
2125
  return response.json().get("element", "No Parent Category found")
2272
2126
 
2273
- def get_category_parent(
2274
- self,
2275
- glossary_category_guid: str,
2276
- effective_time: str = None,
2277
- ) -> list | str:
2127
+ def get_category_parent(self, glossary_category_guid: str, effective_time: str = None, ) -> list | str:
2278
2128
  """Glossary categories can be organized in a hierarchy. Retrieve the parent glossary category metadata
2279
2129
  element for the glossary category with the supplied unique identifier. If the requested category
2280
2130
  does not have a parent category, null is returned. The optional request body contain an effective time
@@ -2308,22 +2158,177 @@ class GlossaryBrowser(Client):
2308
2158
 
2309
2159
  """
2310
2160
  loop = asyncio.get_event_loop()
2311
- response = loop.run_until_complete(
2312
- self._async_get_category_parent(glossary_category_guid, effective_time)
2313
- )
2161
+ response = loop.run_until_complete(self._async_get_category_parent(glossary_category_guid, effective_time))
2314
2162
  return response
2315
2163
 
2164
+ def get_glossary_category_structure(self, glossary_guid: str, output_format: str = "DICT") -> dict | str:
2165
+ """Derive the category structure of an Egeria glossary.
2166
+
2167
+ This method builds a hierarchical representation of the categories in a glossary,
2168
+ showing the parent-child relationships between categories.
2169
+
2170
+ Parameters
2171
+ ----------
2172
+ glossary_guid: str
2173
+ The unique identifier of the glossary.
2174
+ output_format: str, default = 'DICT'
2175
+ The format of the output:
2176
+ - DICT: Returns a Python dictionary structure
2177
+ - LIST: Returns a markdown table
2178
+ - MD: Returns a markdown outline with bullets and indentations
2179
+
2180
+ Returns
2181
+ -------
2182
+ dict | str
2183
+ If output_format is DICT, returns a dictionary structure representing the category hierarchy.
2184
+ If output_format is LIST, returns a markdown table representing the category hierarchy.
2185
+ If output_format is MD, returns a markdown outline with bullets and indentations.
2186
+
2187
+ Raises
2188
+ ------
2189
+ InvalidParameterException
2190
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2191
+ PropertyServerException
2192
+ Raised by the server when an issue arises in processing a valid request
2193
+ NotAuthorizedException
2194
+ The principle specified by the user_id does not have authorization for the requested action
2195
+ """
2196
+ from pyegeria._validators import validate_guid
2197
+
2198
+ validate_guid(glossary_guid)
2199
+
2200
+ # Get all categories in the glossary
2201
+ all_categories = self.get_categories_for_glossary(glossary_guid)
2202
+ if isinstance(all_categories, str):
2203
+ return NO_CATEGORIES_FOUND
2204
+
2205
+ # Create a dictionary to store categories by GUID for quick lookup
2206
+ categories_by_guid = {cat['elementHeader']['guid']: cat for cat in all_categories}
2207
+
2208
+ # Identify root categories (categories with no parent)
2209
+ root_guids = []
2210
+ for cat_guid in categories_by_guid.keys():
2211
+ parent = self.get_category_parent(cat_guid)
2212
+ if isinstance(parent, str):
2213
+ root_guids.append(cat_guid) # This category has no parent
2214
+
2215
+ # Build the category tree
2216
+ category_tree = []
2217
+
2218
+ def build_category_tree(category_guid):
2219
+ """Recursively build a category tree for a category."""
2220
+ if category_guid not in categories_by_guid:
2221
+ return None
2222
+
2223
+ category = categories_by_guid[category_guid]
2224
+ display_name = category['glossaryCategoryProperties'].get('displayName', '---')
2225
+ qualified_name = category['glossaryCategoryProperties'].get('qualifiedName', '---')
2226
+ description = category['glossaryCategoryProperties'].get('description', '---')
2227
+
2228
+ # Get subcategories
2229
+ subcategories = self.get_glossary_subcategories(category_guid)
2230
+ children = []
2231
+
2232
+ if isinstance(subcategories, list):
2233
+ for subcat in subcategories:
2234
+ subcat_guid = subcat['elementHeader']['guid']
2235
+ child_tree = build_category_tree(subcat_guid)
2236
+ if child_tree:
2237
+ children.append(child_tree)
2238
+
2239
+ # Get parent category information
2240
+ parent_info = None
2241
+ parent = self.get_category_parent(category_guid)
2242
+ if not isinstance(parent, str):
2243
+ parent_guid = parent['elementHeader']['guid']
2244
+ parent_name = parent['glossaryCategoryProperties'].get('displayName', '---')
2245
+ parent_info = {
2246
+ 'guid': parent_guid,
2247
+ 'name': parent_name
2248
+ }
2249
+
2250
+ return {
2251
+ 'guid': category_guid,
2252
+ 'name': display_name,
2253
+ 'qualifiedName': qualified_name,
2254
+ 'description': description,
2255
+ 'parent': parent_info,
2256
+ 'children': children
2257
+ }
2258
+
2259
+ # Build tree for each root category
2260
+ for root_guid in root_guids:
2261
+ tree = build_category_tree(root_guid)
2262
+ if tree:
2263
+ category_tree.append(tree)
2264
+
2265
+ # Format the output according to the specified output_format
2266
+ if output_format == "DICT":
2267
+ return {
2268
+ 'glossary_guid': glossary_guid,
2269
+ 'categories': category_tree
2270
+ }
2271
+ elif output_format == "LIST":
2272
+ # Generate markdown table
2273
+ md_table = "| Category | Path | Description | Parent Category | Child Categories |\n"
2274
+ md_table += "|---------|------|-------------|----------------|------------------|\n"
2275
+
2276
+ def add_categories_to_table(categories, path=""):
2277
+ nonlocal md_table
2278
+ for category in categories:
2279
+ category_path = f"{path}/{category['name']}" if path else category['name']
2280
+
2281
+ # Get parent category name
2282
+ parent_name = "None"
2283
+ if category['parent']:
2284
+ parent_name = category['parent']['name']
2285
+
2286
+ # Get child categories names
2287
+ child_names = []
2288
+ for child in category['children']:
2289
+ child_names.append(child['name'])
2290
+ child_categories = ", ".join(child_names) if child_names else "None"
2291
+
2292
+ md_table += f"| {category['name']} | {category_path} | {self._format_for_markdown_table(category['description'])} | {parent_name} | {child_categories} |\n"
2293
+ if category['children']:
2294
+ add_categories_to_table(category['children'], category_path)
2295
+
2296
+ add_categories_to_table(category_tree)
2297
+ return md_table
2298
+ elif output_format == "MD":
2299
+ # Generate markdown outline with bullets and indentations
2300
+ md_outline = f"# Category Structure for Glossary (GUID: {glossary_guid})\n\n"
2301
+
2302
+ def add_categories_to_outline(categories, indent_level=0):
2303
+ nonlocal md_outline
2304
+ for category in categories:
2305
+ # Add bullet with proper indentation
2306
+ indent = " " * indent_level
2307
+ md_outline += f"{indent}- **{category['name']}**"
2308
+
2309
+ # Add description if available
2310
+ if category['description'] and category['description'] != '---':
2311
+ md_outline += f": {category['description']}"
2312
+
2313
+ md_outline += "\n"
2314
+
2315
+ # Process children with increased indentation
2316
+ if category['children']:
2317
+ add_categories_to_outline(category['children'], indent_level + 1)
2318
+
2319
+ add_categories_to_outline(category_tree)
2320
+ return md_outline
2321
+ else:
2322
+ return f"Unsupported output format: {output_format}. Use 'DICT', 'LIST', or 'MD'."
2323
+
2324
+
2325
+
2316
2326
  #
2317
2327
  # Terms
2318
2328
  #
2319
2329
 
2320
- async def _async_get_terms_for_category(
2321
- self,
2322
- glossary_category_guid: str,
2323
- effective_time: str = None,
2324
- start_from: int = 0,
2325
- page_size: int = None,
2326
- ) -> list | str:
2330
+ async def _async_get_terms_for_category(self, glossary_category_guid: str, effective_time: str = None,
2331
+ start_from: int = 0, page_size: int = None, ) -> list | str:
2327
2332
  """Retrieve ALL the glossary terms in a category.
2328
2333
  The request body also supports the specification of an effective time for the query.
2329
2334
 
@@ -2363,8 +2368,7 @@ class GlossaryBrowser(Client):
2363
2368
 
2364
2369
  url = (
2365
2370
  f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/categories/"
2366
- f"{glossary_category_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}"
2367
- )
2371
+ f"{glossary_category_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}")
2368
2372
 
2369
2373
  if effective_time is not None:
2370
2374
  body = {"effectiveTime": effective_time}
@@ -2374,13 +2378,8 @@ class GlossaryBrowser(Client):
2374
2378
 
2375
2379
  return response.json().get("elementList", "No terms found")
2376
2380
 
2377
- def get_terms_for_category(
2378
- self,
2379
- glossary_category_guid: str,
2380
- effective_time: str = None,
2381
- start_from: int = 0,
2382
- page_size: int = None,
2383
- ) -> list | str:
2381
+ def get_terms_for_category(self, glossary_category_guid: str, effective_time: str = None, start_from: int = 0,
2382
+ page_size: int = None, ) -> list | str:
2384
2383
  """Retrieve ALL the glossary terms in a category.
2385
2384
  The request body also supports the specification of an effective time for the query.
2386
2385
 
@@ -2416,23 +2415,12 @@ class GlossaryBrowser(Client):
2416
2415
  """
2417
2416
  loop = asyncio.get_event_loop()
2418
2417
  response = loop.run_until_complete(
2419
- self._async_get_terms_for_category(
2420
- glossary_category_guid,
2421
- effective_time,
2422
- start_from,
2423
- page_size,
2424
- )
2425
- )
2418
+ self._async_get_terms_for_category(glossary_category_guid, effective_time, start_from, page_size, ))
2426
2419
 
2427
2420
  return response
2428
2421
 
2429
- async def _async_get_terms_for_glossary(
2430
- self,
2431
- glossary_guid: str,
2432
- effective_time: str = None,
2433
- start_from: int = 0,
2434
- page_size: int = None,
2435
- ) -> list | str:
2422
+ async def _async_get_terms_for_glossary(self, glossary_guid: str, effective_time: str = None, start_from: int = 0,
2423
+ page_size: int = None, ) -> list | str:
2436
2424
  """Retrieve the list of glossary terms associated with a glossary.
2437
2425
  The request body also supports the specification of an effective time for the query.
2438
2426
  Parameters
@@ -2469,10 +2457,8 @@ class GlossaryBrowser(Client):
2469
2457
  if page_size is None:
2470
2458
  page_size = self.page_size
2471
2459
 
2472
- url = (
2473
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
2474
- f"{glossary_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}"
2475
- )
2460
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
2461
+ f"{glossary_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}")
2476
2462
 
2477
2463
  if effective_time is not None:
2478
2464
  body = {"effectiveTime": effective_time}
@@ -2482,13 +2468,8 @@ class GlossaryBrowser(Client):
2482
2468
 
2483
2469
  return response.json().get("elementList", "No terms found")
2484
2470
 
2485
- def get_terms_for_glossary(
2486
- self,
2487
- glossary_guid: str,
2488
- effective_time: str = None,
2489
- start_from: int = 0,
2490
- page_size: int = None,
2491
- ) -> list | str:
2471
+ def get_terms_for_glossary(self, glossary_guid: str, effective_time: str = None, start_from: int = 0,
2472
+ page_size: int = None, ) -> list | str:
2492
2473
  """Retrieve the list of glossary terms associated with a glossary.
2493
2474
  The request body also supports the specification of an effective time for the query.
2494
2475
  Parameters
@@ -2521,20 +2502,12 @@ class GlossaryBrowser(Client):
2521
2502
  """
2522
2503
  loop = asyncio.get_event_loop()
2523
2504
  response = loop.run_until_complete(
2524
- self._async_get_terms_for_glossary(
2525
- glossary_guid, effective_time, start_from, page_size
2526
- )
2527
- )
2505
+ self._async_get_terms_for_glossary(glossary_guid, effective_time, start_from, page_size))
2528
2506
 
2529
2507
  return response
2530
2508
 
2531
- async def _async_get_term_relationships(
2532
- self,
2533
- term_guid: str,
2534
- effective_time: str = None,
2535
- start_from: int = 0,
2536
- page_size: int = None,
2537
- ) -> list | str:
2509
+ async def _async_get_term_relationships(self, term_guid: str, effective_time: str = None, start_from: int = 0,
2510
+ page_size: int = None, ) -> list | str:
2538
2511
  """This call retrieves details of the glossary terms linked to this glossary term.
2539
2512
  Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
2540
2513
  Parameters
@@ -2571,10 +2544,8 @@ class GlossaryBrowser(Client):
2571
2544
  if page_size is None:
2572
2545
  page_size = self.page_size
2573
2546
 
2574
- url = (
2575
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
2576
- f"{term_guid}/related-terms?startFrom={start_from}&pageSize={page_size}"
2577
- )
2547
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
2548
+ f"{term_guid}/related-terms?startFrom={start_from}&pageSize={page_size}")
2578
2549
 
2579
2550
  if effective_time is not None:
2580
2551
  body = {"effectiveTime": effective_time}
@@ -2584,13 +2555,8 @@ class GlossaryBrowser(Client):
2584
2555
 
2585
2556
  return response.json().get("elementList", "No terms found")
2586
2557
 
2587
- def get_term_relationships(
2588
- self,
2589
- term_guid: str,
2590
- effective_time: str = None,
2591
- start_from: int = 0,
2592
- page_size: int = None,
2593
- ) -> list | str:
2558
+ def get_term_relationships(self, term_guid: str, effective_time: str = None, start_from: int = 0,
2559
+ page_size: int = None, ) -> list | str:
2594
2560
  """This call retrieves details of the glossary terms linked to this glossary term.
2595
2561
  Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
2596
2562
  Parameters
@@ -2623,16 +2589,11 @@ class GlossaryBrowser(Client):
2623
2589
  """
2624
2590
  loop = asyncio.get_event_loop()
2625
2591
  response = loop.run_until_complete(
2626
- self._async_get_term_relationships(
2627
- term_guid, effective_time, start_from, page_size
2628
- )
2629
- )
2592
+ self._async_get_term_relationships(term_guid, effective_time, start_from, page_size))
2630
2593
 
2631
2594
  return response
2632
2595
 
2633
- async def _async_get_glossary_for_term(
2634
- self, term_guid: str, effective_time: str = None
2635
- ) -> dict | str:
2596
+ async def _async_get_glossary_for_term(self, term_guid: str, effective_time: str = None) -> dict | str:
2636
2597
  """Retrieve the glossary metadata element for the requested term. The optional request body allows you to
2637
2598
  specify that the glossary element should only be returned if it was effective at a particular time.
2638
2599
 
@@ -2666,20 +2627,15 @@ class GlossaryBrowser(Client):
2666
2627
  validate_guid(term_guid)
2667
2628
 
2668
2629
  body = {
2669
- "class": "EffectiveTimeQueryRequestBody",
2670
- "effectiveTime": effective_time,
2671
- }
2672
- url = (
2673
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
2674
- f"for-term/{term_guid}/retrieve"
2675
- )
2630
+ "class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time,
2631
+ }
2632
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
2633
+ f"for-term/{term_guid}/retrieve")
2676
2634
 
2677
2635
  response = await self._async_make_request("POST", url, body)
2678
2636
  return response.json().get("element", "No glossary found")
2679
2637
 
2680
- def get_glossary_for_term(
2681
- self, term_guid: str, effective_time: str = None
2682
- ) -> dict | str:
2638
+ def get_glossary_for_term(self, term_guid: str, effective_time: str = None) -> dict | str:
2683
2639
  """Retrieve the glossary metadata element for the requested term. The optional request body allows you to
2684
2640
  specify that the glossary element should only be returned if it was effective at a particular time.
2685
2641
 
@@ -2710,22 +2666,12 @@ class GlossaryBrowser(Client):
2710
2666
  -----
2711
2667
  """
2712
2668
  loop = asyncio.get_event_loop()
2713
- response = loop.run_until_complete(
2714
- self._async_get_glossary_for_term(term_guid, effective_time)
2715
- )
2669
+ response = loop.run_until_complete(self._async_get_glossary_for_term(term_guid, effective_time))
2716
2670
  return response
2717
2671
 
2718
- async def _async_get_terms_by_name(
2719
- self,
2720
- term: str,
2721
- glossary_guid: str = None,
2722
- status_filter: list = [],
2723
- effective_time: str = None,
2724
- for_lineage: bool = False,
2725
- for_duplicate_processing: bool = False,
2726
- start_from: int = 0,
2727
- page_size: int = None,
2728
- ) -> list:
2672
+ async def _async_get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [],
2673
+ effective_time: str = None, for_lineage: bool = False, for_duplicate_processing: bool = False,
2674
+ start_from: int = 0, page_size: int = None, ) -> list:
2729
2675
  """Retrieve glossary terms by display name or qualified name. Async Version.
2730
2676
 
2731
2677
  Parameters
@@ -2773,36 +2719,23 @@ class GlossaryBrowser(Client):
2773
2719
  for_duplicate_processing_s = str(for_duplicate_processing).lower()
2774
2720
 
2775
2721
  body = {
2776
- "class": "GlossaryNameRequestBody",
2777
- "glossaryGUID": glossary_guid,
2778
- "name": term,
2779
- "effectiveTime": effective_time,
2780
- "limitResultsByStatus": status_filter,
2781
- }
2722
+ "class": "GlossaryNameRequestBody", "glossaryGUID": glossary_guid, "name": term,
2723
+ "effectiveTime": effective_time, "limitResultsByStatus": status_filter,
2724
+ }
2782
2725
  # body = body_slimmer(body)
2783
2726
 
2784
- url = (
2785
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
2786
- f"terms/by-name?startFrom={start_from}&pageSize={page_size}&"
2787
- f"&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}"
2788
- )
2727
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
2728
+ f"terms/by-name?startFrom={start_from}&pageSize={page_size}&"
2729
+ f"&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}")
2789
2730
 
2790
2731
  # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2791
2732
 
2792
2733
  response = await self._async_make_request("POST", url, body)
2793
2734
  return response.json().get("elementList", "No terms found")
2794
2735
 
2795
- def get_terms_by_name(
2796
- self,
2797
- term: str,
2798
- glossary_guid: str = None,
2799
- status_filter: list = [],
2800
- effective_time: str = None,
2801
- for_lineage: bool = False,
2802
- for_duplicate_processing: bool = False,
2803
- start_from: int = 0,
2804
- page_size: int = None,
2805
- ) -> list:
2736
+ def get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [],
2737
+ effective_time: str = None, for_lineage: bool = False, for_duplicate_processing: bool = False,
2738
+ start_from: int = 0, page_size: int = None, ) -> list:
2806
2739
  """Retrieve glossary terms by display name or qualified name.
2807
2740
 
2808
2741
  Parameters
@@ -2843,20 +2776,11 @@ class GlossaryBrowser(Client):
2843
2776
  """
2844
2777
  loop = asyncio.get_event_loop()
2845
2778
  response = loop.run_until_complete(
2846
- self._async_get_terms_by_name(
2847
- term,
2848
- glossary_guid,
2849
- status_filter,
2850
- effective_time,
2851
- for_lineage,
2852
- for_duplicate_processing,
2853
- start_from,
2854
- page_size,
2855
- )
2856
- )
2779
+ self._async_get_terms_by_name(term, glossary_guid, status_filter, effective_time, for_lineage,
2780
+ for_duplicate_processing, start_from, page_size, ))
2857
2781
  return response
2858
2782
 
2859
- async def _async_get_terms_by_guid(self, term_guid: str, output_format: str = 'JSON') -> dict | str:
2783
+ async def _async_get_term_by_guid(self, term_guid: str, output_format: str = 'JSON') -> dict | str:
2860
2784
  """Retrieve a term using its unique id. Async version.
2861
2785
  Parameters
2862
2786
  ----------
@@ -2887,10 +2811,8 @@ class GlossaryBrowser(Client):
2887
2811
  output_format = output_format.upper()
2888
2812
  validate_guid(term_guid)
2889
2813
 
2890
- url = (
2891
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
2892
- f"{term_guid}/retrieve"
2893
- )
2814
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
2815
+ f"{term_guid}/retrieve")
2894
2816
  response = await self._async_make_request("POST", url)
2895
2817
  term_element = response.json().get("element", NO_TERMS_FOUND)
2896
2818
  if term_element == NO_TERMS_FOUND:
@@ -2899,8 +2821,7 @@ class GlossaryBrowser(Client):
2899
2821
  return self.generate_terms_md(term_element, "GUID", output_format)
2900
2822
  return response.json().get("element", NO_TERMS_FOUND)
2901
2823
 
2902
-
2903
- def get_terms_by_guid(self, term_guid: str, output_format: str = 'JSON') -> dict | str:
2824
+ def get_term_by_guid(self, term_guid: str, output_format: str = 'JSON') -> dict | str:
2904
2825
  """Retrieve a term using its unique id. Async version.
2905
2826
  Parameters
2906
2827
  ----------
@@ -2932,12 +2853,11 @@ class GlossaryBrowser(Client):
2932
2853
 
2933
2854
  return response
2934
2855
 
2935
- async def _async_get_terms_versions(
2936
- self,
2937
- term_guid: str,
2938
- start_from: int = 0,
2939
- page_size=None,
2940
- ) -> dict | str:
2856
+ async def _async_get_term_versions(self, term_guid: str, effective_time: str = None, from_time: str = None,
2857
+ to_time: str = None, oldest_first: bool = False, for_lineage: bool = False,
2858
+ for_duplicate_processing: bool = False, start_from: int = 0, page_size=max_paging_size,
2859
+
2860
+ ) -> list | str:
2941
2861
  """Retrieve the versions of a glossary term. Async version.
2942
2862
  Parameters
2943
2863
  ----------
@@ -2950,8 +2870,8 @@ class GlossaryBrowser(Client):
2950
2870
  The number of terms to retrieve per page. If not provided, it will use the default page size.
2951
2871
  Returns
2952
2872
  -------
2953
- dict | str
2954
- A dict detailing the glossary term represented by the GUID. If no term is found, the string
2873
+ list | str
2874
+ A [dict] detailing the glossary term represented by the GUID. If no term is found, the string
2955
2875
  "No term found" will be returned.
2956
2876
 
2957
2877
  Raises
@@ -2962,27 +2882,37 @@ class GlossaryBrowser(Client):
2962
2882
  Raised by the server when an issue arises in processing a valid request.
2963
2883
  NotAuthorizedException
2964
2884
  The principle specified by the user_id does not have authorization for the requested action.
2885
+
2886
+ Args:
2887
+ term_guid:
2888
+ effective_time:
2889
+ from_time:
2890
+ to_time:
2891
+ oldest_first:
2892
+ for_lineage:
2893
+ for_duplicate_processing:
2894
+ start_from:
2895
+ page_size:
2965
2896
  """
2966
2897
 
2967
- if page_size is None:
2968
- page_size = self.page_size
2898
+ body = {
2899
+ "effective_time": effective_time, "fromTime": from_time, "toTime": to_time, "forLineage": for_lineage,
2900
+ "forDuplicateProcessing": for_duplicate_processing
2901
+ }
2969
2902
 
2903
+ oldest_first_s = str(oldest_first).lower()
2970
2904
  validate_guid(term_guid)
2971
2905
 
2972
- url = (
2973
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
2974
- f"{term_guid}/history?startFrom={start_from}&pageSize={page_size}"
2975
- )
2906
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
2907
+ f"{term_guid}/history?startFrom={start_from}&pageSize={page_size}&oldestFirst={oldest_first_s}&"
2908
+ f"forDuplicateProcessing={for_duplicate_processing}&forLineage={for_lineage}")
2976
2909
 
2977
- response = await self._async_make_request("POST", url)
2978
- return response.json().get("element", "No term found")
2979
-
2980
- def get_terms_versions(
2981
- self,
2982
- term_guid: str,
2983
- start_from: int = 0,
2984
- page_size=None,
2985
- ) -> dict | str:
2910
+ response = await self._async_make_request("POST", url, body_slimmer(body))
2911
+ return response.json().get("elementList", "No term found")
2912
+
2913
+ def get_term_versions(self, term_guid: str, effective_time: str = None, from_time: str = None, to_time: str = None,
2914
+ oldest_first: bool = False, for_lineage: bool = False, for_duplicate_processing: bool = False,
2915
+ start_from: int = 0, page_size=max_paging_size, ) -> dict | str:
2986
2916
  """Retrieve the versions of a glossary term.
2987
2917
  Parameters
2988
2918
  ----------
@@ -2995,8 +2925,8 @@ class GlossaryBrowser(Client):
2995
2925
  The number of terms to retrieve per page. If not provided, it will use the default page size.
2996
2926
  Returns
2997
2927
  -------
2998
- dict | str
2999
- A dict detailing the glossary term represented by the GUID. If no term is found, the string
2928
+ [dict] | str
2929
+ A [dict] detailing the glossary term represented by the GUID. If no term is found, the string
3000
2930
  "No term found" will be returned.
3001
2931
 
3002
2932
  Raises
@@ -3011,17 +2941,12 @@ class GlossaryBrowser(Client):
3011
2941
 
3012
2942
  loop = asyncio.get_event_loop()
3013
2943
  response = loop.run_until_complete(
3014
- self._async_get_terms_versions(term_guid, start_from, page_size)
3015
- )
2944
+ self._async_get_term_versions(term_guid, effective_time, from_time, to_time, oldest_first, for_lineage,
2945
+ for_duplicate_processing, start_from, page_size))
3016
2946
 
3017
2947
  return response
3018
2948
 
3019
- async def _async_get_term_revision_logs(
3020
- self,
3021
- term_guid: str,
3022
- start_from: int = 0,
3023
- page_size=None,
3024
- ) -> dict | str:
2949
+ async def _async_get_term_revision_logs(self, term_guid: str, start_from: int = 0, page_size=None, ) -> dict | str:
3025
2950
  """Retrieve the revision log history for a term. Async version.
3026
2951
  Parameters
3027
2952
  ----------
@@ -3053,20 +2978,13 @@ class GlossaryBrowser(Client):
3053
2978
 
3054
2979
  validate_guid(term_guid)
3055
2980
 
3056
- url = (
3057
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/elements/"
3058
- f"{term_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}"
3059
- )
2981
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/elements/"
2982
+ f"{term_guid}/note-logs/retrieve?startFrom={start_from}&pageSize={page_size}")
3060
2983
 
3061
2984
  response = await self._async_make_request("POST", url)
3062
2985
  return response.json().get("elementList", "No log found")
3063
2986
 
3064
- def get_term_revision_logs(
3065
- self,
3066
- term_guid: str,
3067
- start_from: int = 0,
3068
- page_size=None,
3069
- ) -> dict | str:
2987
+ def get_term_revision_logs(self, term_guid: str, start_from: int = 0, page_size=None, ) -> dict | str:
3070
2988
  """Retrieve the revision log history for a term.
3071
2989
  Parameters
3072
2990
  ----------
@@ -3094,18 +3012,12 @@ class GlossaryBrowser(Client):
3094
3012
  """
3095
3013
 
3096
3014
  loop = asyncio.get_event_loop()
3097
- response = loop.run_until_complete(
3098
- self._async_get_term_revision_logs(term_guid, start_from, page_size)
3099
- )
3015
+ response = loop.run_until_complete(self._async_get_term_revision_logs(term_guid, start_from, page_size))
3100
3016
 
3101
3017
  return response
3102
3018
 
3103
- async def _async_get_term_revision_history(
3104
- self,
3105
- term_revision_log_guid: str,
3106
- start_from: int = 0,
3107
- page_size=None,
3108
- ) -> dict | str:
3019
+ async def _async_get_term_revision_history(self, term_revision_log_guid: str, start_from: int = 0,
3020
+ page_size=None, ) -> dict | str:
3109
3021
  """Retrieve the revision history for a glossary term. Async version.
3110
3022
 
3111
3023
  Parameters
@@ -3143,20 +3055,14 @@ class GlossaryBrowser(Client):
3143
3055
 
3144
3056
  validate_guid(term_revision_log_guid)
3145
3057
 
3146
- url = (
3147
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/note-logs/"
3148
- f"{term_revision_log_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}"
3149
- )
3058
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/note-logs/"
3059
+ f"{term_revision_log_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}")
3150
3060
 
3151
3061
  response = await self._async_make_request("POST", url)
3152
3062
  return response.json().get("elementList", "No logs found")
3153
3063
 
3154
- def get_term_revision_history(
3155
- self,
3156
- term_revision_log_guid: str,
3157
- start_from: int = 0,
3158
- page_size=None,
3159
- ) -> dict | str:
3064
+ def get_term_revision_history(self, term_revision_log_guid: str, start_from: int = 0,
3065
+ page_size=None, ) -> dict | str:
3160
3066
  """Retrieve the revision history for a glossary term.
3161
3067
 
3162
3068
  Parameters
@@ -3191,28 +3097,86 @@ class GlossaryBrowser(Client):
3191
3097
 
3192
3098
  loop = asyncio.get_event_loop()
3193
3099
  response = loop.run_until_complete(
3194
- self._async_get_term_revision_history(
3195
- term_revision_log_guid, start_from, page_size
3196
- )
3197
- )
3100
+ self._async_get_term_revision_history(term_revision_log_guid, start_from, page_size))
3198
3101
 
3199
3102
  return response
3200
3103
 
3201
- async def _async_find_glossary_terms(
3202
- self,
3203
- search_string: str,
3204
- glossary_guid: str = None,
3205
- status_filter: list = [],
3206
- effective_time: str = None,
3207
- starts_with: bool = False,
3208
- ends_with: bool = False,
3209
- ignore_case: bool = False,
3210
- for_lineage: bool = False,
3211
- for_duplicate_processing: bool = False,
3212
- start_from: int = 0,
3213
- page_size: int = None,
3214
- output_format: str = "JSON",
3215
- ) -> list | str:
3104
+
3105
+ def list_full_term_history(self, term_guid: str, output_type: str = "DICT") -> list | str:
3106
+ """
3107
+ Retrieves and formats the entire version history of a specific term in the repository.
3108
+ The version history is either returned as a list of dictionaries or in a Markdown table
3109
+ format.
3110
+
3111
+ The returned history includes details about the creation and update timestamps, user
3112
+ information, and additional glossary term properties such as `displayName`,
3113
+ `qualifiedName`, `description`, and others.
3114
+
3115
+ Parameter
3116
+ ---------
3117
+ term_guid: The unique identifier of the glossary term for which the version
3118
+ history needs to be retrieved.
3119
+ output_type: The format in which the history should be returned. It can be
3120
+ either "DICT" (a list of dictionaries) or "LIST" (a Markdown table).
3121
+ Defaults to "DICT".
3122
+
3123
+ Returns
3124
+ -------
3125
+ list | str: A list of dictionaries representing the version history
3126
+ (if output_type is "DICT"), or a Markdown table of the version details
3127
+ (if output_type is "LIST"). If no history is found, returns a string
3128
+ message "No History Found".
3129
+ """
3130
+ history = self.get_term_versions(term_guid)
3131
+ if type(history) is str:
3132
+ return "No History Found"
3133
+ version_history = []
3134
+ for ver in history:
3135
+ create_time = ver["elementHeader"]["versions"].get("createTime", "---")
3136
+ update_time = ver["elementHeader"]["versions"].get("createTime", "---")
3137
+ created_by = ver["elementHeader"]["versions"].get("createdBy", "---")
3138
+ updated_by = ver["elementHeader"]["versions"].get("updatedBy", "---")
3139
+ version = ver["elementHeader"]["versions"].get("version")
3140
+
3141
+ qualified_name = ver["glossaryTermProperties"].get("qualifiedName", '---')
3142
+ display_name = ver["glossaryTermProperties"].get("displayName", '---')
3143
+ summary = ver["glossaryTermProperties"].get("summary", '---')
3144
+ description = ver["glossaryTermProperties"].get("description", '---')
3145
+ examples = ver["glossaryTermProperties"].get("examples", '---')
3146
+ usage = ver["glossaryTermProperties"].get("usage", '---')
3147
+ version_identifier = ver["glossaryTermProperties"].get("versionIdentifier", '---')
3148
+
3149
+ version_history.append({
3150
+ "version": version, "displayName": display_name, "summary": summary, "created": create_time,
3151
+ "updated": update_time, "createdBy": created_by, "updatedBy": updated_by,
3152
+ "qualifiedName": qualified_name, "description": description, "examples": examples, "usage": usage,
3153
+ "versionIdentifier": version_identifier,
3154
+ })
3155
+ sorted_history = sorted(version_history, key=lambda i: i['version'], reverse=True)
3156
+ if output_type == "DICT":
3157
+ return sorted_history
3158
+ elif output_type == "LIST":
3159
+ # Get the headers from the keys of the first dictionary
3160
+ headers = sorted_history[0].keys()
3161
+
3162
+ # Create the header row
3163
+ header_row = " | ".join(headers)
3164
+ separator_row = " | ".join(["---"] * len(headers)) # Markdown separator row
3165
+
3166
+ # Create the rows for the table
3167
+ rows = []
3168
+ for entry in sorted_history:
3169
+ row = " | ".join(str(entry.get(header, "---")) for header in headers)
3170
+ rows.append(row)
3171
+
3172
+ # Combine everything into a Markdown table string
3173
+ markdown_table = f"{header_row}\n{separator_row}\n" + "\n".join(rows)
3174
+ return markdown_table
3175
+
3176
+ async def _async_find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
3177
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False, ignore_case: bool = False,
3178
+ for_lineage: bool = False, for_duplicate_processing: bool = False, start_from: int = 0,
3179
+ page_size: int = None, output_format: str = "JSON", ) -> list | str:
3216
3180
  """Retrieve the list of glossary term metadata elements that contain the search string.
3217
3181
 
3218
3182
  Parameters
@@ -3288,45 +3252,32 @@ class GlossaryBrowser(Client):
3288
3252
  # validate_search_string(search_string)
3289
3253
 
3290
3254
  body = {
3291
- "class": "GlossarySearchStringRequestBody",
3292
- "glossaryGUID": glossary_guid,
3293
- "searchString": search_string,
3294
- "effectiveTime": effective_time,
3295
- "limitResultsByStatus": status_filter,
3296
- }
3297
-
3298
- url = (
3299
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
3300
- f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
3301
- f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
3302
- f"forDuplicateProcessing={for_duplicate_processing_s}"
3303
- )
3255
+ "class": "GlossarySearchStringRequestBody", "glossaryGUID": glossary_guid, "searchString": search_string,
3256
+ "effectiveTime": effective_time, "limitResultsByStatus": status_filter,
3257
+ }
3304
3258
 
3259
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
3260
+ f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
3261
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
3262
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
3305
3263
 
3306
3264
  response = await self._async_make_request("POST", url, body_slimmer(body))
3307
3265
  term_elements = response.json().get("elementList", NO_TERMS_FOUND)
3308
3266
  if term_elements == NO_TERMS_FOUND:
3309
- return NO_TERMS_FOUND
3267
+ if output_format == 'JSON':
3268
+ return NO_TERMS_FOUND
3269
+ elif output_format in ['MD', 'FORM', 'REPORT', 'LIST']:
3270
+ return "\n# No Terms found.\n"
3271
+ elif output_format == 'DICT':
3272
+ return None
3310
3273
  if output_format != "JSON": # return a simplified markdown representation
3311
3274
  return self.generate_terms_md(term_elements, search_string, output_format)
3312
3275
  return response.json().get("elementList", NO_TERMS_FOUND)
3313
3276
 
3314
-
3315
- def find_glossary_terms(
3316
- self,
3317
- search_string: str,
3318
- glossary_guid: str = None,
3319
- status_filter: list = [],
3320
- effective_time: str = None,
3321
- starts_with: bool = False,
3322
- ends_with: bool = False,
3323
- ignore_case: bool = False,
3324
- for_lineage: bool = False,
3325
- for_duplicate_processing: bool = False,
3326
- start_from: int = 0,
3327
- page_size: int = None,
3328
- output_format: str = "JSON",
3329
- ) -> list | str:
3277
+ def find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
3278
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False, ignore_case: bool = False,
3279
+ for_lineage: bool = False, for_duplicate_processing: bool = False, start_from: int = 0,
3280
+ page_size: int = None, output_format: str = "JSON", ) -> list | str:
3330
3281
  """Retrieve the list of glossary term metadata elements that contain the search string.
3331
3282
 
3332
3283
  Parameters
@@ -3390,34 +3341,16 @@ class GlossaryBrowser(Client):
3390
3341
 
3391
3342
  loop = asyncio.get_event_loop()
3392
3343
  response = loop.run_until_complete(
3393
- self._async_find_glossary_terms(
3394
- search_string,
3395
- glossary_guid,
3396
- status_filter,
3397
- effective_time,
3398
- starts_with,
3399
- ends_with,
3400
- ignore_case,
3401
- for_lineage,
3402
- for_duplicate_processing,
3403
- start_from,
3404
- page_size,
3405
- output_format
3406
- )
3407
- )
3344
+ self._async_find_glossary_terms(search_string, glossary_guid, status_filter, effective_time, starts_with,
3345
+ ends_with, ignore_case, for_lineage, for_duplicate_processing, start_from, page_size, output_format))
3408
3346
 
3409
3347
  return response
3410
3348
 
3411
3349
  #
3412
3350
  # Feedback
3413
3351
  #
3414
- async def _async_get_comment(
3415
- self,
3416
- commemt_guid: str,
3417
- effective_time: str,
3418
- for_lineage: bool = False,
3419
- for_duplicate_processing: bool = False,
3420
- ) -> dict | list:
3352
+ async def _async_get_comment(self, commemt_guid: str, effective_time: str, for_lineage: bool = False,
3353
+ for_duplicate_processing: bool = False, ) -> dict | list:
3421
3354
  """Retrieve the comment specified by the comment GUID"""
3422
3355
 
3423
3356
  validate_guid(commemt_guid)
@@ -3430,26 +3363,17 @@ class GlossaryBrowser(Client):
3430
3363
 
3431
3364
  body = {"effective_time": effective_time}
3432
3365
 
3433
- url = (
3434
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/comments/"
3435
- f"{commemt_guid}?forLineage={for_lineage_s}&"
3436
- f"forDuplicateProcessing={for_duplicate_processing_s}"
3437
- )
3366
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/comments/"
3367
+ f"{commemt_guid}?forLineage={for_lineage_s}&"
3368
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
3438
3369
 
3439
3370
  # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
3440
3371
 
3441
3372
  response = await self._async_make_request("POST", url, body)
3442
3373
  return response.json()
3443
3374
 
3444
- async def _async_add_comment_reply(
3445
- self,
3446
- comment_guid: str,
3447
- is_public: bool,
3448
- comment_type: str,
3449
- comment_text: str,
3450
- for_lineage: bool = False,
3451
- for_duplicate_processing: bool = False,
3452
- ) -> str:
3375
+ async def _async_add_comment_reply(self, comment_guid: str, is_public: bool, comment_type: str, comment_text: str,
3376
+ for_lineage: bool = False, for_duplicate_processing: bool = False, ) -> str:
3453
3377
  """Reply to a comment"""
3454
3378
 
3455
3379
  validate_guid(comment_guid)
@@ -3460,33 +3384,21 @@ class GlossaryBrowser(Client):
3460
3384
  for_duplicate_processing_s = str(for_duplicate_processing).lower()
3461
3385
 
3462
3386
  body = {
3463
- "class": "CommentRequestBody",
3464
- "commentType": comment_type,
3465
- "commentText": comment_text,
3387
+ "class": "CommentRequestBody", "commentType": comment_type, "commentText": comment_text,
3466
3388
  "isPublic": is_public,
3467
- }
3389
+ }
3468
3390
 
3469
- url = (
3470
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/comments/"
3471
- f"{comment_guid}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
3472
- f"forDuplicateProcessing={for_duplicate_processing_s}"
3473
- )
3391
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/comments/"
3392
+ f"{comment_guid}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
3393
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
3474
3394
 
3475
3395
  # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
3476
3396
 
3477
3397
  response = await self._async_make_request("POST", url, body)
3478
3398
  return response
3479
3399
 
3480
- async def _async_update_comment(
3481
- self,
3482
- comment_guid: str,
3483
- is_public: bool,
3484
- comment_type: str,
3485
- comment_text: str,
3486
- is_merge_update: bool = False,
3487
- for_lineage: bool = False,
3488
- for_duplicate_processing: bool = False,
3489
- ) -> str:
3400
+ async def _async_update_comment(self, comment_guid: str, is_public: bool, comment_type: str, comment_text: str,
3401
+ is_merge_update: bool = False, for_lineage: bool = False, for_duplicate_processing: bool = False, ) -> str:
3490
3402
  """Update the specified comment"""
3491
3403
 
3492
3404
  validate_guid(comment_guid)
@@ -3497,37 +3409,23 @@ class GlossaryBrowser(Client):
3497
3409
  for_duplicate_processing_s = str(for_duplicate_processing).lower()
3498
3410
 
3499
3411
  body = {
3500
- "class": "CommentRequestBody",
3501
- "commentType": comment_type,
3502
- "commentText": comment_text,
3412
+ "class": "CommentRequestBody", "commentType": comment_type, "commentText": comment_text,
3503
3413
  "isPublic": is_public,
3504
- }
3414
+ }
3505
3415
 
3506
- url = (
3507
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/comments/"
3508
- f"{comment_guid}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
3509
- f"forDuplicateProcessing={for_duplicate_processing_s}"
3510
- )
3416
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/comments/"
3417
+ f"{comment_guid}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
3418
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
3511
3419
 
3512
3420
  # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
3513
3421
 
3514
3422
  response = await self._async_make_request("POST", url, body)
3515
3423
  return response
3516
3424
 
3517
- async def _async_find_comment(
3518
- self,
3519
- search_string: str,
3520
- glossary_guid: str = None,
3521
- status_filter: list = [],
3522
- effective_time: str = None,
3523
- starts_with: bool = False,
3524
- ends_with: bool = False,
3525
- ignore_case: bool = False,
3526
- for_lineage: bool = False,
3527
- for_duplicate_processing: bool = False,
3528
- start_from: int = 0,
3529
- page_size: int = None,
3530
- ):
3425
+ async def _async_find_comment(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
3426
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False, ignore_case: bool = False,
3427
+ for_lineage: bool = False, for_duplicate_processing: bool = False, start_from: int = 0,
3428
+ page_size: int = None, ):
3531
3429
  """Find comments by search string"""
3532
3430
 
3533
3431
  if page_size is None:
@@ -3545,20 +3443,15 @@ class GlossaryBrowser(Client):
3545
3443
  # validate_search_string(search_string)
3546
3444
 
3547
3445
  body = {
3548
- "class": "GlossarySearchStringRequestBody",
3549
- "glossaryGUID": glossary_guid,
3550
- "searchString": search_string,
3551
- "effectiveTime": effective_time,
3552
- "limitResultsByStatus": status_filter,
3553
- }
3446
+ "class": "GlossarySearchStringRequestBody", "glossaryGUID": glossary_guid, "searchString": search_string,
3447
+ "effectiveTime": effective_time, "limitResultsByStatus": status_filter,
3448
+ }
3554
3449
  # body = body_slimmer(body)
3555
3450
 
3556
- url = (
3557
- f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
3558
- f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
3559
- f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
3560
- f"forDuplicateProcessing={for_duplicate_processing_s}"
3561
- )
3451
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
3452
+ f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
3453
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
3454
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
3562
3455
 
3563
3456
  # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
3564
3457
 
@@ -3567,4 +3460,4 @@ class GlossaryBrowser(Client):
3567
3460
 
3568
3461
 
3569
3462
  if __name__ == "__main__":
3570
- print("Main-Glosssary Browser")
3463
+ print("Main-Glossary Browser")