pyegeria 5.3.6.1__py3-none-any.whl → 5.3.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyegeria/commands/cat/freddie_utils.py +1 -1
- pyegeria/commands/cat/freddies-outbox/Terms-2025-03-06-13-19-29-Report.md +69 -0
- pyegeria/commands/cat/freddies-outbox/Terms-2025-03-06-13-20-30-Update-Form.md +78 -0
- pyegeria/commands/cat/list_glossaries.py +40 -1
- pyegeria/commands/cat/list_terms.py +49 -2
- pyegeria/commands/cli/egeria.py +48 -2
- pyegeria/commands/cli/egeria_cat.py +30 -2
- pyegeria/commands/cli/ops_config.py +4 -0
- pyegeria/glossary_browser_omvs.py +123 -10
- pyegeria/glossary_manager_omvs.py +0 -365
- {pyegeria-5.3.6.1.dist-info → pyegeria-5.3.6.2.dist-info}/METADATA +1 -1
- {pyegeria-5.3.6.1.dist-info → pyegeria-5.3.6.2.dist-info}/RECORD +15 -13
- {pyegeria-5.3.6.1.dist-info → pyegeria-5.3.6.2.dist-info}/LICENSE +0 -0
- {pyegeria-5.3.6.1.dist-info → pyegeria-5.3.6.2.dist-info}/WHEEL +0 -0
- {pyegeria-5.3.6.1.dist-info → pyegeria-5.3.6.2.dist-info}/entry_points.txt +0 -0
@@ -518,7 +518,7 @@ def process_per_proj_upsert_command(egeria_client: EgeriaTech, element_dictionar
|
|
518
518
|
msg += f"* {ERROR}Project {project_name} does not exist\n"
|
519
519
|
valid = False
|
520
520
|
if len(project_details) > 1 and project_exists:
|
521
|
-
msg += f"* {ERROR}More than one
|
521
|
+
msg += f"* {ERROR}More than one project with name {project_name} found\n"
|
522
522
|
valid = False
|
523
523
|
if len(project_details) == 1:
|
524
524
|
known_guid = project_details[0]['elementHeader'].get('guid', None)
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Glossaries Report - created at 2025-03-06 13:19
|
2
|
+
Glossaries found from the search string: `All Glossaries`
|
3
|
+
|
4
|
+
# Glossary Name: Egeria-Markdown
|
5
|
+
|
6
|
+
## Description
|
7
|
+
Glossary to describe the vocabulary of Freddie - an Egeria Markdown language to support the exchange of metadata in a Markdown form.
|
8
|
+
Freddie allows users to input metadata using any text entry system that supports the entry of standard Markdown characters and through post-processing
|
9
|
+
commands, validates the Egeria content and allows the requests to be sent to Egeria. This is an update
|
10
|
+
|
11
|
+
## Language
|
12
|
+
English
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
1) (optional) load an example or template for the type of object from Egeria.
|
16
|
+
2) Create a new document (perhaps from the template) and edit it, adding in the content with the Freddie controlled Markdown language.
|
17
|
+
3) Process the document to validate and display it before you submit it, Validation may annotate your document with recommendations and potential issues.
|
18
|
+
4) Submit the document to Egeria using the Freddie_sings command.
|
19
|
+
5) anything?
|
20
|
+
|
21
|
+
## Qualified Name
|
22
|
+
Glossary:Egeria-Markdown
|
23
|
+
|
24
|
+
## GUID
|
25
|
+
5d45b499-d0d5-4fad-bc23-763bc4073296
|
26
|
+
|
27
|
+
|
28
|
+
---
|
29
|
+
|
30
|
+
# Glossary Name: Teddy Bear Drop Foot Terminology
|
31
|
+
|
32
|
+
## Description
|
33
|
+
This glossary describes terminology invented for the fictitious study into Teddy Bear Drop Foot that is being used to demonstrate aspects of open governance without risk to real patient data.
|
34
|
+
|
35
|
+
## Language
|
36
|
+
English
|
37
|
+
|
38
|
+
## Usage
|
39
|
+
Used with the Teddy Bear Drop Foot Demonstration Study.
|
40
|
+
|
41
|
+
## Qualified Name
|
42
|
+
Glossary:TeddyBearDropFootTerminology
|
43
|
+
|
44
|
+
## GUID
|
45
|
+
c103d0c9-7581-47e1-a684-6bbe0ecd596f
|
46
|
+
|
47
|
+
|
48
|
+
---
|
49
|
+
|
50
|
+
# Glossary Name: Sustainability Glossary
|
51
|
+
|
52
|
+
## Description
|
53
|
+
Terminology associated with Coco Pharmaceutical's sustainability initiative.
|
54
|
+
|
55
|
+
## Language
|
56
|
+
English
|
57
|
+
|
58
|
+
## Usage
|
59
|
+
For all Coco Pharmaceutical employees wishing to understand more about sustainability and the organization's efforts to improve its operations.
|
60
|
+
|
61
|
+
## Qualified Name
|
62
|
+
Glossary:Sustainability
|
63
|
+
|
64
|
+
## GUID
|
65
|
+
30bfe79e-adf2-4fda-b9c5-9c86ad6b0d6c
|
66
|
+
|
67
|
+
|
68
|
+
---
|
69
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Update Glossaries Form - created at 2025-03-06 13:20
|
2
|
+
Glossaries found from the search string: `All Glossaries`
|
3
|
+
|
4
|
+
# Update Glossary
|
5
|
+
|
6
|
+
## Glossary Name
|
7
|
+
Egeria-Markdown
|
8
|
+
|
9
|
+
## Description
|
10
|
+
Glossary to describe the vocabulary of Freddie - an Egeria Markdown language to support the exchange of metadata in a Markdown form.
|
11
|
+
Freddie allows users to input metadata using any text entry system that supports the entry of standard Markdown characters and through post-processing
|
12
|
+
commands, validates the Egeria content and allows the requests to be sent to Egeria. This is an update
|
13
|
+
|
14
|
+
## Language
|
15
|
+
English
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
1) (optional) load an example or template for the type of object from Egeria.
|
19
|
+
2) Create a new document (perhaps from the template) and edit it, adding in the content with the Freddie controlled Markdown language.
|
20
|
+
3) Process the document to validate and display it before you submit it, Validation may annotate your document with recommendations and potential issues.
|
21
|
+
4) Submit the document to Egeria using the Freddie_sings command.
|
22
|
+
5) anything?
|
23
|
+
|
24
|
+
## Qualified Name
|
25
|
+
Glossary:Egeria-Markdown
|
26
|
+
|
27
|
+
## GUID
|
28
|
+
5d45b499-d0d5-4fad-bc23-763bc4073296
|
29
|
+
|
30
|
+
|
31
|
+
---
|
32
|
+
|
33
|
+
# Update Glossary
|
34
|
+
|
35
|
+
## Glossary Name
|
36
|
+
Teddy Bear Drop Foot Terminology
|
37
|
+
|
38
|
+
## Description
|
39
|
+
This glossary describes terminology invented for the fictitious study into Teddy Bear Drop Foot that is being used to demonstrate aspects of open governance without risk to real patient data.
|
40
|
+
|
41
|
+
## Language
|
42
|
+
English
|
43
|
+
|
44
|
+
## Usage
|
45
|
+
Used with the Teddy Bear Drop Foot Demonstration Study.
|
46
|
+
|
47
|
+
## Qualified Name
|
48
|
+
Glossary:TeddyBearDropFootTerminology
|
49
|
+
|
50
|
+
## GUID
|
51
|
+
c103d0c9-7581-47e1-a684-6bbe0ecd596f
|
52
|
+
|
53
|
+
|
54
|
+
---
|
55
|
+
|
56
|
+
# Update Glossary
|
57
|
+
|
58
|
+
## Glossary Name
|
59
|
+
Sustainability Glossary
|
60
|
+
|
61
|
+
## Description
|
62
|
+
Terminology associated with Coco Pharmaceutical's sustainability initiative.
|
63
|
+
|
64
|
+
## Language
|
65
|
+
English
|
66
|
+
|
67
|
+
## Usage
|
68
|
+
For all Coco Pharmaceutical employees wishing to understand more about sustainability and the organization's efforts to improve its operations.
|
69
|
+
|
70
|
+
## Qualified Name
|
71
|
+
Glossary:Sustainability
|
72
|
+
|
73
|
+
## GUID
|
74
|
+
30bfe79e-adf2-4fda-b9c5-9c86ad6b0d6c
|
75
|
+
|
76
|
+
|
77
|
+
---
|
78
|
+
|
@@ -43,6 +43,11 @@ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
|
43
43
|
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
44
44
|
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
45
45
|
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
46
|
+
EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
|
47
|
+
EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "/Users/dwolfson/localGit/egeria-v5-3/egeria-python")
|
48
|
+
EGERIA_FREDDIE_INBOX_PATH = os.environ.get("EGERIA_FREDDIE_INBOX_PATH", "pyegeria/commands/cat/freddies-inbox")
|
49
|
+
EGERIA_FREDDIE_OUTBOX_PATH = os.environ.get("EGERIA_FREDDIE_OUTBOX_PATH", "pyegeria/commands/cat/freddies-outbox")
|
50
|
+
|
46
51
|
|
47
52
|
|
48
53
|
def display_glossaries(
|
@@ -53,6 +58,8 @@ def display_glossaries(
|
|
53
58
|
user_pass: str = EGERIA_USER_PASSWORD,
|
54
59
|
jupyter: bool = EGERIA_JUPYTER,
|
55
60
|
width: int = EGERIA_WIDTH,
|
61
|
+
md: bool = False,
|
62
|
+
form: bool = False,
|
56
63
|
):
|
57
64
|
"""Display either a specified glossary or all glossaries if the search_string is '*'.
|
58
65
|
Parameters
|
@@ -71,10 +78,36 @@ def display_glossaries(
|
|
71
78
|
A boolean indicating whether the output is intended for a Jupyter notebook (default is EGERIA_JUPYTER).
|
72
79
|
width : int, optional
|
73
80
|
The width of the console output (default is EGERIA_WIDTH).
|
81
|
+
md: bool, [default=False]
|
82
|
+
If true, a simplified markdown report of the glossaries will be created. Filename is Glossaries-<DATE>-<ACTION>
|
83
|
+
The filepath is derived from the environment variables EGERIA_ROOT_PATH and EGERIA_FREDDIE_OUTPUT_PATH, respectively.
|
84
|
+
form: bool, [default=False]
|
85
|
+
If true and md is true, a form for the glossaries will be created as a markdown file.
|
86
|
+
If false and md is true, a markdown report for the glossaries will be created.
|
74
87
|
"""
|
75
88
|
m_client = EgeriaTech(view_server, view_url, user_id=user, user_pwd=user_pass)
|
76
89
|
token = m_client.create_egeria_bearer_token()
|
90
|
+
|
91
|
+
|
77
92
|
try:
|
93
|
+
if md:
|
94
|
+
if form:
|
95
|
+
action = "Update-Form"
|
96
|
+
else:
|
97
|
+
action = "Report"
|
98
|
+
file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_FREDDIE_OUTBOX_PATH)
|
99
|
+
file_name = f"Glossaries-{time.strftime('%Y-%m-%d-%H-%M-%S')}-{action}.md"
|
100
|
+
full_file_path = os.path.join(file_path, file_name)
|
101
|
+
os.makedirs(os.path.dirname(full_file_path), exist_ok=True)
|
102
|
+
output = m_client.find_glossaries(search_string, md=md, form=form)
|
103
|
+
if output == "NO_GLOSSARIES_FOUND":
|
104
|
+
print(f"\n==> No glossaries found for search string '{search_string}'")
|
105
|
+
return
|
106
|
+
with open(full_file_path, 'w') as f:
|
107
|
+
f.write(output)
|
108
|
+
print(f"\n==> Glossaries output written to {full_file_path}")
|
109
|
+
return
|
110
|
+
|
78
111
|
table = Table(
|
79
112
|
title=f"Glossary List @ {time.asctime()}",
|
80
113
|
style="bright_white on black",
|
@@ -139,8 +172,14 @@ def main():
|
|
139
172
|
search_string = Prompt.ask(
|
140
173
|
"Enter the glossary you are searching for or '*' for all:", default="*"
|
141
174
|
)
|
175
|
+
mdq = Prompt.ask("Do you want to create a markdown report?", choices=["y", "n"], default="n")
|
176
|
+
md = True if mdq.lower() == "y" else False
|
177
|
+
|
178
|
+
formq = Prompt.ask("Do you want to create a form?", choices=["y", "n"], default="n")
|
179
|
+
form = True if formq.lower() == "y" else False
|
142
180
|
|
143
|
-
display_glossaries(search_string, server, url, userid,
|
181
|
+
display_glossaries(search_string, server, url, userid,
|
182
|
+
user_pass, md = md, form = form)
|
144
183
|
|
145
184
|
except KeyboardInterrupt:
|
146
185
|
pass
|
@@ -43,7 +43,10 @@ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
|
43
43
|
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
44
44
|
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
45
45
|
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
46
|
-
|
46
|
+
EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
|
47
|
+
EGERIA_ROOT_PATH = os.environ.get("EGERIA_ROOT_PATH", "/Users/dwolfson/localGit/egeria-v5-3/egeria-python")
|
48
|
+
EGERIA_FREDDIE_INBOX_PATH = os.environ.get("EGERIA_FREDDIE_INBOX_PATH", "pyegeria/commands/cat/freddies-inbox")
|
49
|
+
EGERIA_FREDDIE_OUTBOX_PATH = os.environ.get("EGERIA_FREDDIE_OUTBOX_PATH", "pyegeria/commands/cat/freddies-outbox")
|
47
50
|
|
48
51
|
|
49
52
|
def display_glossary_terms(
|
@@ -56,6 +59,8 @@ def display_glossary_terms(
|
|
56
59
|
user_pass: str = EGERIA_USER_PASSWORD,
|
57
60
|
jupyter: bool = EGERIA_JUPYTER,
|
58
61
|
width: int = EGERIA_WIDTH,
|
62
|
+
md: bool = False,
|
63
|
+
form: bool = False,
|
59
64
|
):
|
60
65
|
"""Display a table of glossary terms filtered by search_string and glossary, if specified. If no
|
61
66
|
filters then all terms are displayed. If glossary_guid or name is specified, then only terms from that
|
@@ -84,6 +89,12 @@ def display_glossary_terms(
|
|
84
89
|
Flag to indicate if the output should be formatted for Jupyter notebook. Defaults to EGERIA_JUPYTER.
|
85
90
|
width : int
|
86
91
|
The width of the console output. Defaults to EGERIA_WIDTH.
|
92
|
+
md: bool, [default=False]
|
93
|
+
If true, a simplified markdown report of the terms will be created. Filename is Terms-<DATE>-<ACTION>
|
94
|
+
The filepath is derived from the environment variables EGERIA_ROOT_PATH and EGERIA_FREDDIE_OUTPUT_PATH, respectively.
|
95
|
+
form: bool, [default=False]
|
96
|
+
If true and md is true, a form for the terms will be created as a markdown file.
|
97
|
+
If false and md is true, a markdown report for the terms will be created.
|
87
98
|
"""
|
88
99
|
|
89
100
|
console = Console(
|
@@ -101,6 +112,34 @@ def display_glossary_terms(
|
|
101
112
|
elif (glossary_guid is not None) and (len(glossary_guid) < 10):
|
102
113
|
glossary_guid = None
|
103
114
|
|
115
|
+
if md:
|
116
|
+
if form:
|
117
|
+
action = "Update-Form"
|
118
|
+
else:
|
119
|
+
action = "Report"
|
120
|
+
try:
|
121
|
+
file_path = os.path.join(EGERIA_ROOT_PATH, EGERIA_FREDDIE_OUTBOX_PATH)
|
122
|
+
file_name = f"Terms-{time.strftime('%Y-%m-%d-%H-%M-%S')}-{action}.md"
|
123
|
+
full_file_path = os.path.join(file_path, file_name)
|
124
|
+
os.makedirs(os.path.dirname(full_file_path), exist_ok=True)
|
125
|
+
output = g_client.find_glossaries(search_string, md=md, form=form)
|
126
|
+
if output == "NO_TERMS_FOUND":
|
127
|
+
print(f"\n==> No terms found for search string '{search_string}'")
|
128
|
+
return
|
129
|
+
with open(full_file_path, 'w') as f:
|
130
|
+
f.write(output)
|
131
|
+
print(f"\n==> Terms output written to {full_file_path}")
|
132
|
+
return
|
133
|
+
except (
|
134
|
+
InvalidParameterException,
|
135
|
+
PropertyServerException,
|
136
|
+
UserNotAuthorizedException,
|
137
|
+
) as e:
|
138
|
+
console.print_exception()
|
139
|
+
finally:
|
140
|
+
g_client.close_session()
|
141
|
+
|
142
|
+
|
104
143
|
def generate_table(search_string: str, glossary_guid: str) -> Table:
|
105
144
|
"""Make a new table."""
|
106
145
|
table = Table(
|
@@ -234,8 +273,16 @@ def main():
|
|
234
273
|
"Enter the name of the glossary to search or '*' for all glossaries:",
|
235
274
|
default="*",
|
236
275
|
)
|
276
|
+
|
277
|
+
mdq = Prompt.ask("Do you want to create a markdown report?", choices=["y", "n"], default="n")
|
278
|
+
md = True if mdq.lower() == "y" else False
|
279
|
+
|
280
|
+
formq = Prompt.ask("Do you want to create a form?", choices=["y", "n"], default="n")
|
281
|
+
form = True if formq.lower() == "y" else False
|
282
|
+
|
237
283
|
display_glossary_terms(
|
238
|
-
|
284
|
+
search_string, guid, glossary_name, server, url,
|
285
|
+
userid, user_pass, md = md, form = form
|
239
286
|
)
|
240
287
|
|
241
288
|
except KeyboardInterrupt:
|
pyegeria/commands/cli/egeria.py
CHANGED
@@ -211,6 +211,19 @@ from pyegeria.commands.tech.list_valid_metadata_values import display_metadata_v
|
|
211
211
|
default=os.environ.get("EGERIA_GLOSSARY_PATH", "/home/jovyan/loading-bay/glossary"),
|
212
212
|
help="Path to glossary import/export files",
|
213
213
|
)
|
214
|
+
|
215
|
+
@click.option(
|
216
|
+
"--inbox_path",
|
217
|
+
default=os.environ.get("EGERIA_ROOT_PATH", "/home/jovyan"),
|
218
|
+
help="Path to inbox files",
|
219
|
+
)
|
220
|
+
|
221
|
+
@click.option(
|
222
|
+
"--outbox_path",
|
223
|
+
default=os.environ.get("EGERIA_FREDDIE_OUTBOX_PATH", "distribution-hub/freddies-outbox"),
|
224
|
+
help="Path to outbox files",
|
225
|
+
)
|
226
|
+
|
214
227
|
@click.pass_context
|
215
228
|
def cli(
|
216
229
|
ctx,
|
@@ -231,6 +244,9 @@ def cli(
|
|
231
244
|
width,
|
232
245
|
home_glossary_guid,
|
233
246
|
glossary_path,
|
247
|
+
inbox_path,
|
248
|
+
outbox_path,
|
249
|
+
|
234
250
|
):
|
235
251
|
"""An Egeria Command Line interface for Operations"""
|
236
252
|
ctx.obj = Config(
|
@@ -251,6 +267,8 @@ def cli(
|
|
251
267
|
width,
|
252
268
|
home_glossary_guid,
|
253
269
|
glossary_path,
|
270
|
+
inbox_path,
|
271
|
+
outbox_path
|
254
272
|
)
|
255
273
|
ctx.max_content_width = 250
|
256
274
|
ctx.ensure_object(Config)
|
@@ -1114,8 +1132,20 @@ def glossary_group(ctx):
|
|
1114
1132
|
default="*",
|
1115
1133
|
help="Optionally restrict search to a specific named glossary",
|
1116
1134
|
)
|
1135
|
+
@click.option(
|
1136
|
+
"--markdown",
|
1137
|
+
flag_value=True,
|
1138
|
+
default=False,
|
1139
|
+
help="Optionally display glossary list in markdown format",
|
1140
|
+
)
|
1141
|
+
@click.option(
|
1142
|
+
"--form",
|
1143
|
+
flag_value=True,
|
1144
|
+
default=False,
|
1145
|
+
help="Optionally display glossary list as an update form",
|
1146
|
+
)
|
1117
1147
|
@click.pass_context
|
1118
|
-
def show_terms(ctx, search_string, glossary_guid, glossary_name):
|
1148
|
+
def show_terms(ctx, search_string, glossary_guid, glossary_name, md, form):
|
1119
1149
|
"""Find and display glossary terms"""
|
1120
1150
|
c = ctx.obj
|
1121
1151
|
display_glossary_terms(
|
@@ -1128,6 +1158,8 @@ def show_terms(ctx, search_string, glossary_guid, glossary_name):
|
|
1128
1158
|
c.password,
|
1129
1159
|
c.jupyter,
|
1130
1160
|
c.width,
|
1161
|
+
md,
|
1162
|
+
form,
|
1131
1163
|
)
|
1132
1164
|
|
1133
1165
|
|
@@ -1685,8 +1717,20 @@ def databases(ctx):
|
|
1685
1717
|
|
1686
1718
|
@glossary_group.command("glossaries")
|
1687
1719
|
@click.option("--search_string", default="*", help="Name to search for glossaries")
|
1720
|
+
@click.option(
|
1721
|
+
"--markdown",
|
1722
|
+
flag_value=True,
|
1723
|
+
default=False,
|
1724
|
+
help="Optionally display glossary list in markdown format",
|
1725
|
+
)
|
1726
|
+
@click.option(
|
1727
|
+
"--form",
|
1728
|
+
flag_value=True,
|
1729
|
+
default=False,
|
1730
|
+
help="Optionally display glossary list as an update form",
|
1731
|
+
)
|
1688
1732
|
@click.pass_context
|
1689
|
-
def glossaries(ctx, search_string):
|
1733
|
+
def glossaries(ctx, search_string, md, form):
|
1690
1734
|
"""Display a list of glossaries"""
|
1691
1735
|
c = ctx.obj
|
1692
1736
|
display_glossaries(
|
@@ -1697,6 +1741,8 @@ def glossaries(ctx, search_string):
|
|
1697
1741
|
c.password,
|
1698
1742
|
c.jupyter,
|
1699
1743
|
c.width,
|
1744
|
+
md,
|
1745
|
+
form
|
1700
1746
|
)
|
1701
1747
|
|
1702
1748
|
|
@@ -325,8 +325,20 @@ def glossary_group(ctx):
|
|
325
325
|
default="*",
|
326
326
|
help="Optionally restrict search to a specific named glossary",
|
327
327
|
)
|
328
|
+
@click.option(
|
329
|
+
"--markdown",
|
330
|
+
flag_value=True,
|
331
|
+
default=False,
|
332
|
+
help="Optionally display glossary list in markdown format",
|
333
|
+
)
|
334
|
+
@click.option(
|
335
|
+
"--form",
|
336
|
+
flag_value=True,
|
337
|
+
default=False,
|
338
|
+
help="Optionally display glossary list as an update form",
|
339
|
+
)
|
328
340
|
@click.pass_context
|
329
|
-
def show_terms(ctx, search_string, glossary_guid, glossary_name):
|
341
|
+
def show_terms(ctx, search_string, glossary_guid, glossary_name, md, form):
|
330
342
|
"""Find and display glossary terms"""
|
331
343
|
c = ctx.obj
|
332
344
|
display_glossary_terms(
|
@@ -339,13 +351,27 @@ def show_terms(ctx, search_string, glossary_guid, glossary_name):
|
|
339
351
|
c.password,
|
340
352
|
c.jupyter,
|
341
353
|
c.width,
|
354
|
+
md,
|
355
|
+
form,
|
342
356
|
)
|
343
357
|
|
344
358
|
|
345
359
|
@glossary_group.command("glossaries")
|
346
360
|
@click.option("--search_string", default="*", help="Name to search for glossaries")
|
361
|
+
@click.option(
|
362
|
+
"--markdown",
|
363
|
+
flag_value=True,
|
364
|
+
default=False,
|
365
|
+
help="Optionally display glossary list in markdown format",
|
366
|
+
)
|
367
|
+
@click.option(
|
368
|
+
"--form",
|
369
|
+
flag_value=True,
|
370
|
+
default=False,
|
371
|
+
help="Optionally display glossary list as an update form",
|
372
|
+
)
|
347
373
|
@click.pass_context
|
348
|
-
def glossaries(ctx, search_string):
|
374
|
+
def glossaries(ctx, search_string, md, form):
|
349
375
|
"""Display a list of glossaries"""
|
350
376
|
c = ctx.obj
|
351
377
|
display_glossaries(
|
@@ -356,6 +382,8 @@ def glossaries(ctx, search_string):
|
|
356
382
|
c.password,
|
357
383
|
c.jupyter,
|
358
384
|
c.width,
|
385
|
+
md,
|
386
|
+
form,
|
359
387
|
)
|
360
388
|
|
361
389
|
|
@@ -21,6 +21,8 @@ class Config(object):
|
|
21
21
|
width: int,
|
22
22
|
home_glossary_guid: str,
|
23
23
|
glossary_path: str,
|
24
|
+
inbox_path: str,
|
25
|
+
outbox_path: str
|
24
26
|
):
|
25
27
|
self.metadata_store = server
|
26
28
|
self.metadata_store_url = url
|
@@ -41,6 +43,8 @@ class Config(object):
|
|
41
43
|
self.url = url
|
42
44
|
self.home_glossary_guid = home_glossary_guid
|
43
45
|
self.glossary_path = glossary_path
|
46
|
+
self.inbox_path = inbox_path
|
47
|
+
self.outbox_path = outbox_path
|
44
48
|
|
45
49
|
|
46
50
|
pass_config = click.make_pass_decorator(Config)
|
@@ -10,12 +10,13 @@ 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
|
14
|
-
|
13
|
+
from pyegeria import NO_GLOSSARIES_FOUND, NO_CATEGORIES_FOUND, NO_TERMS_FOUND
|
14
|
+
import json
|
15
15
|
from pyegeria._client import Client
|
16
16
|
from pyegeria._validators import validate_guid, validate_name, validate_search_string
|
17
17
|
from pyegeria.utils import body_slimmer
|
18
18
|
from pyegeria._globals import NO_ELEMENTS_FOUND
|
19
|
+
MD_SEPERATOR = "\n---\n\n"
|
19
20
|
|
20
21
|
class GlossaryBrowser(Client):
|
21
22
|
"""
|
@@ -52,6 +53,79 @@ class GlossaryBrowser(Client):
|
|
52
53
|
|
53
54
|
Client.__init__(self, view_server, platform_url, user_id, user_pwd, token)
|
54
55
|
|
56
|
+
def generate_glossaries_md(self, elements: list, search_string: str, form:bool = True)-> str:
|
57
|
+
if form:
|
58
|
+
elements_md = f"# Update Glossaries Form - created at {datetime.now().strftime('%Y-%m-%d %H:%M')}\n"
|
59
|
+
elements_action = "Update Glossary"
|
60
|
+
else:
|
61
|
+
elements_md = f"# Glossaries Report - created at {datetime.now().strftime('%Y-%m-%d %H:%M')}\n"
|
62
|
+
elements_action = None
|
63
|
+
search_string = search_string if search_string else "All Glossaries"
|
64
|
+
elements_md += f"Glossaries found from the search string: `{search_string}`\n\n"
|
65
|
+
|
66
|
+
for element in elements:
|
67
|
+
guid = element['elementHeader'].get("guid", None)
|
68
|
+
properties = element['glossaryProperties']
|
69
|
+
display_name = properties.get("displayName", None)
|
70
|
+
description = properties.get("description", None)
|
71
|
+
language = properties.get("language", None)
|
72
|
+
usage = properties.get("usage", None)
|
73
|
+
qualified_name = properties.get("qualifiedName", None)
|
74
|
+
|
75
|
+
if form:
|
76
|
+
elements_md += f"# {elements_action}\n\n"
|
77
|
+
elements_md += f"## Glossary Name \n{display_name}\n\n"
|
78
|
+
else:
|
79
|
+
elements_md += f"# Glossary Name: {display_name}\n\n"
|
80
|
+
|
81
|
+
|
82
|
+
elements_md += f"## Description\n{description}\n\n"
|
83
|
+
elements_md += f"## Language\n{language}\n\n"
|
84
|
+
elements_md += f"## Usage\n{usage}\n\n"
|
85
|
+
elements_md += f"## Qualified Name\n{qualified_name}\n\n"
|
86
|
+
elements_md += f"## GUID\n{guid}\n\n"
|
87
|
+
elements_md += MD_SEPERATOR
|
88
|
+
return elements_md
|
89
|
+
|
90
|
+
def generate_terms_md(self, elements: list, search_string: str, form:bool = True)-> str:
|
91
|
+
if form:
|
92
|
+
elements_md = f"# Update terms Form - created at {datetime.now().strftime('%Y-%m-%d %H:%M')}\n"
|
93
|
+
elements_action = "Update Terms"
|
94
|
+
else:
|
95
|
+
elements_md = f"# Glossary Terms Report - created at {datetime.now().strftime('%Y-%m-%d %H:%M')}\n"
|
96
|
+
elements_action = None
|
97
|
+
search_string = search_string if search_string else "All Terms"
|
98
|
+
elements_md += f"Terms found from the search string: `{search_string}`\n\n"
|
99
|
+
|
100
|
+
for element in elements:
|
101
|
+
guid = element['elementHeader'].get("guid", None)
|
102
|
+
element_properties = element['glossaryTermProperties']
|
103
|
+
display_name = element_properties.get("displayName", None)
|
104
|
+
summary = element_properties.get("summary", None)
|
105
|
+
description = element_properties.get("description", None)
|
106
|
+
examples = element_properties.get("examples", None)
|
107
|
+
usage = element_properties.get("usage", None)
|
108
|
+
pub_version = element_properties.get("publishedVersionIdentifier", None)
|
109
|
+
qualified_name = element_properties.get("qualifiedName", None)
|
110
|
+
status = element['elementHeader']['classifications'][0].get('status', None)
|
111
|
+
|
112
|
+
if form:
|
113
|
+
elements_md += f"# {elements_action}\n\n"
|
114
|
+
elements_md += f"## Term Name \n{display_name}\n\n"
|
115
|
+
else:
|
116
|
+
elements_md += f"# Term Name: {display_name}\n\n"
|
117
|
+
|
118
|
+
elements_md += f"## Status\n{status}\n\n"
|
119
|
+
elements_md += f"## Summary\n{summary}\n\n"
|
120
|
+
elements_md += f"## Description\n{description}\n\n"
|
121
|
+
elements_md += f"## Examples\n{examples}\n\n"
|
122
|
+
elements_md += f"## Usage\n{usage}\n\n"
|
123
|
+
elements_md += f"## Published Version\n{pub_version}\n\n"
|
124
|
+
elements_md += f"## Qualified Name\n{qualified_name}\n\n"
|
125
|
+
elements_md += f"## GUID\n{guid}\n\n"
|
126
|
+
elements_md += MD_SEPERATOR
|
127
|
+
return elements_md
|
128
|
+
|
55
129
|
#
|
56
130
|
# Get Valid Values for Enumerations
|
57
131
|
#
|
@@ -193,6 +267,8 @@ class GlossaryBrowser(Client):
|
|
193
267
|
type_name: str = None,
|
194
268
|
start_from: int = 0,
|
195
269
|
page_size: int = None,
|
270
|
+
md: bool = False,
|
271
|
+
form: bool = True
|
196
272
|
) -> list | str:
|
197
273
|
"""Retrieve the list of glossary metadata elements that contain the search string. Async version.
|
198
274
|
The search string is located in the request body and is interpreted as a plain string.
|
@@ -225,6 +301,12 @@ class GlossaryBrowser(Client):
|
|
225
301
|
page_size: int, [default=None]
|
226
302
|
The number of items to return in a single page. If not specified, the default will be taken from
|
227
303
|
the class instance.
|
304
|
+
md: bool, [default=False]
|
305
|
+
If true, a simplified markdown representation of the glossary will be returned
|
306
|
+
form: bool, [default=True]
|
307
|
+
If true and md is true, a form for the glossaries will be returned as a markdown string.
|
308
|
+
If false and md is true, a report for the glossaries will be returned.
|
309
|
+
|
228
310
|
Returns
|
229
311
|
-------
|
230
312
|
List | str
|
@@ -263,7 +345,6 @@ class GlossaryBrowser(Client):
|
|
263
345
|
"typeName": type_name,
|
264
346
|
}
|
265
347
|
body = body_slimmer(body)
|
266
|
-
# print(f"\n\nBody is: \n{body}")
|
267
348
|
|
268
349
|
url = (
|
269
350
|
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
|
@@ -273,7 +354,12 @@ class GlossaryBrowser(Client):
|
|
273
354
|
)
|
274
355
|
|
275
356
|
response = await self._async_make_request("POST", url, body)
|
276
|
-
|
357
|
+
glossary_elements = response.json().get("elementList", NO_GLOSSARIES_FOUND)
|
358
|
+
if glossary_elements == NO_GLOSSARIES_FOUND:
|
359
|
+
return NO_GLOSSARIES_FOUND
|
360
|
+
if md: # return a simplified markdown representation
|
361
|
+
return self.generate_glossaries_md(glossary_elements, search_string,form)
|
362
|
+
return response.json().get("elementList", NO_GLOSSARIES_FOUND)
|
277
363
|
|
278
364
|
def find_glossaries(
|
279
365
|
self,
|
@@ -287,6 +373,8 @@ class GlossaryBrowser(Client):
|
|
287
373
|
type_name: str = None,
|
288
374
|
start_from: int = 0,
|
289
375
|
page_size: int = None,
|
376
|
+
md: bool = False,
|
377
|
+
form: bool = True
|
290
378
|
) -> list | str:
|
291
379
|
"""Retrieve the list of glossary metadata elements that contain the search string.
|
292
380
|
The search string is located in the request body and is interpreted as a plain string.
|
@@ -320,6 +408,11 @@ class GlossaryBrowser(Client):
|
|
320
408
|
page_size: int, [default=None]
|
321
409
|
The number of items to return in a single page. If not specified, the default will be taken from
|
322
410
|
the class instance.
|
411
|
+
md: bool, [default=False]
|
412
|
+
If true, a simplified markdown representation of the glossary will be returned
|
413
|
+
form: bool, [default=True]
|
414
|
+
If true and md is true, a form for the glossaries will be returned as a markdown string.
|
415
|
+
If false and md is true, a report for the glossaries will be returned.
|
323
416
|
Returns
|
324
417
|
-------
|
325
418
|
List | str
|
@@ -350,6 +443,8 @@ class GlossaryBrowser(Client):
|
|
350
443
|
type_name,
|
351
444
|
start_from,
|
352
445
|
page_size,
|
446
|
+
md,
|
447
|
+
form
|
353
448
|
)
|
354
449
|
)
|
355
450
|
|
@@ -2162,6 +2257,8 @@ class GlossaryBrowser(Client):
|
|
2162
2257
|
for_duplicate_processing: bool = False,
|
2163
2258
|
start_from: int = 0,
|
2164
2259
|
page_size: int = None,
|
2260
|
+
md: bool = False,
|
2261
|
+
form: bool = True,
|
2165
2262
|
) -> list | str:
|
2166
2263
|
"""Retrieve the list of glossary term metadata elements that contain the search string.
|
2167
2264
|
|
@@ -2193,6 +2290,11 @@ class GlossaryBrowser(Client):
|
|
2193
2290
|
Page of results to start from
|
2194
2291
|
page_size : int, optional
|
2195
2292
|
Number of elements to return per page - if None, then default for class will be used.
|
2293
|
+
md: bool, [default=False]
|
2294
|
+
If true, a simplified markdown representation of the glossary will be returned
|
2295
|
+
form: bool, [default=True]
|
2296
|
+
If true and md is true, a form for the glossaries will be returned as a markdown string.
|
2297
|
+
If false and md is true, a report for the glossaries will be returned.
|
2196
2298
|
|
2197
2299
|
Returns
|
2198
2300
|
-------
|
@@ -2238,7 +2340,7 @@ class GlossaryBrowser(Client):
|
|
2238
2340
|
"effectiveTime": effective_time,
|
2239
2341
|
"limitResultsByStatus": status_filter,
|
2240
2342
|
}
|
2241
|
-
|
2343
|
+
body = body_slimmer(body)
|
2242
2344
|
|
2243
2345
|
url = (
|
2244
2346
|
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
|
@@ -2247,12 +2349,14 @@ class GlossaryBrowser(Client):
|
|
2247
2349
|
f"forDuplicateProcessing={for_duplicate_processing_s}"
|
2248
2350
|
)
|
2249
2351
|
|
2250
|
-
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
2251
|
-
|
2252
2352
|
response = await self._async_make_request("POST", url, body)
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2353
|
+
term_elements = response.json().get("elementList", NO_TERMS_FOUND)
|
2354
|
+
if term_elements == NO_TERMS_FOUND:
|
2355
|
+
return NO_TERMS_FOUND
|
2356
|
+
if md: # return a simplified markdown representation
|
2357
|
+
return self.generate_terms_md(term_elements, search_string, form)
|
2358
|
+
return response.json().get("elementList", NO_TERMS_FOUND)
|
2359
|
+
|
2256
2360
|
|
2257
2361
|
def find_glossary_terms(
|
2258
2362
|
self,
|
@@ -2267,6 +2371,8 @@ class GlossaryBrowser(Client):
|
|
2267
2371
|
for_duplicate_processing: bool = False,
|
2268
2372
|
start_from: int = 0,
|
2269
2373
|
page_size: int = None,
|
2374
|
+
md: bool = False,
|
2375
|
+
form: bool = True,
|
2270
2376
|
) -> list | str:
|
2271
2377
|
"""Retrieve the list of glossary term metadata elements that contain the search string.
|
2272
2378
|
|
@@ -2299,6 +2405,11 @@ class GlossaryBrowser(Client):
|
|
2299
2405
|
Page of results to start from
|
2300
2406
|
page_size : int, optional
|
2301
2407
|
Number of elements to return per page - if None, then default for class will be used.
|
2408
|
+
md: bool, [default=False]
|
2409
|
+
If true, a simplified markdown representation of the glossary will be returned
|
2410
|
+
form: bool, [default=True]
|
2411
|
+
If true and md is true, a form for the glossaries will be returned as a markdown string.
|
2412
|
+
If false and md is true, a report for the glossaries will be returned.
|
2302
2413
|
|
2303
2414
|
Returns
|
2304
2415
|
-------
|
@@ -2337,6 +2448,8 @@ class GlossaryBrowser(Client):
|
|
2337
2448
|
for_duplicate_processing,
|
2338
2449
|
start_from,
|
2339
2450
|
page_size,
|
2451
|
+
md,
|
2452
|
+
form,
|
2340
2453
|
)
|
2341
2454
|
)
|
2342
2455
|
|
@@ -303,184 +303,6 @@ class GlossaryManager(GlossaryBrowser):
|
|
303
303
|
# Glossaries
|
304
304
|
#
|
305
305
|
|
306
|
-
async def _async_find_glossaries(
|
307
|
-
self,
|
308
|
-
search_string: str,
|
309
|
-
effective_time: str = None,
|
310
|
-
starts_with: bool = False,
|
311
|
-
ends_with: bool = False,
|
312
|
-
ignore_case: bool = False,
|
313
|
-
for_lineage: bool = False,
|
314
|
-
for_duplicate_processing: bool = False,
|
315
|
-
type_name: str = None,
|
316
|
-
start_from: int = 0,
|
317
|
-
page_size: int = None,
|
318
|
-
output_format: str = "JSON",
|
319
|
-
) -> list | str:
|
320
|
-
"""Retrieve the list of glossary metadata elements that contain the search string. Async version.
|
321
|
-
The search string is located in the request body and is interpreted as a plain string.
|
322
|
-
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
323
|
-
|
324
|
-
Parameters
|
325
|
-
----------
|
326
|
-
search_string: str,
|
327
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
328
|
-
|
329
|
-
effective_time: str, [default=None], optional
|
330
|
-
Effective time of the query. If not specified will default to any time. Time format is
|
331
|
-
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
332
|
-
|
333
|
-
starts_with : bool, [default=False], optional
|
334
|
-
Starts with the supplied string.
|
335
|
-
ends_with : bool, [default=False], optional
|
336
|
-
Ends with the supplied string
|
337
|
-
ignore_case : bool, [default=False], optional
|
338
|
-
Ignore case when searching
|
339
|
-
for_lineage : bool, [default=False], optional
|
340
|
-
|
341
|
-
for_duplicate_processing : bool, [default=False], optional
|
342
|
-
type_name: str, [default=None], optional
|
343
|
-
An optional parameter indicating the subtype of the glossary to filter by.
|
344
|
-
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
345
|
-
start_from: int, [default=0], optional
|
346
|
-
When multiple pages of results are available, the page number to start from.
|
347
|
-
page_size: int, [default=None]
|
348
|
-
The number of items to return in a single page. If not specified, the default will be taken from
|
349
|
-
the class instance.
|
350
|
-
output_format: str, [default="JSON"]
|
351
|
-
One of JSON or MD for now
|
352
|
-
|
353
|
-
Returns
|
354
|
-
-------
|
355
|
-
List | str
|
356
|
-
|
357
|
-
A list of glossary definitions active in the server.
|
358
|
-
|
359
|
-
Raises
|
360
|
-
------
|
361
|
-
|
362
|
-
InvalidParameterException
|
363
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
364
|
-
PropertyServerException
|
365
|
-
Raised by the server when an issue arises in processing a valid request
|
366
|
-
NotAuthorizedException
|
367
|
-
The principle specified by the user_id does not have authorization for the requested action
|
368
|
-
|
369
|
-
"""
|
370
|
-
|
371
|
-
if page_size is None:
|
372
|
-
page_size = self.page_size
|
373
|
-
starts_with_s = str(starts_with).lower()
|
374
|
-
ends_with_s = str(ends_with).lower()
|
375
|
-
ignore_case_s = str(ignore_case).lower()
|
376
|
-
for_lineage_s = str(for_lineage).lower()
|
377
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
378
|
-
|
379
|
-
validate_search_string(search_string)
|
380
|
-
|
381
|
-
if search_string == "*":
|
382
|
-
search_string = None
|
383
|
-
|
384
|
-
body = {
|
385
|
-
"class": "SearchStringRequestBody",
|
386
|
-
"searchString": search_string,
|
387
|
-
"effectiveTime": effective_time,
|
388
|
-
"typeName": type_name,
|
389
|
-
}
|
390
|
-
body = body_slimmer(body)
|
391
|
-
# print(f"\n\nBody is: \n{body}")
|
392
|
-
|
393
|
-
url = (
|
394
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
|
395
|
-
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
396
|
-
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
397
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}"
|
398
|
-
)
|
399
|
-
|
400
|
-
response = await self._async_make_request("POST", url, body)
|
401
|
-
if output_format == "JSON":
|
402
|
-
return response.json().get("elementList", "No Glossaries found")
|
403
|
-
elif output_format == "MD":
|
404
|
-
pass
|
405
|
-
|
406
|
-
|
407
|
-
def find_glossaries(
|
408
|
-
self,
|
409
|
-
search_string: str,
|
410
|
-
effective_time: str = None,
|
411
|
-
starts_with: bool = False,
|
412
|
-
ends_with: bool = False,
|
413
|
-
ignore_case: bool = False,
|
414
|
-
for_lineage: bool = False,
|
415
|
-
for_duplicate_processing: bool = False,
|
416
|
-
type_name: str = None,
|
417
|
-
start_from: int = 0,
|
418
|
-
page_size: int = None,
|
419
|
-
) -> list | str:
|
420
|
-
"""Retrieve the list of glossary metadata elements that contain the search string.
|
421
|
-
The search string is located in the request body and is interpreted as a plain string.
|
422
|
-
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
423
|
-
|
424
|
-
Parameters
|
425
|
-
----------
|
426
|
-
search_string: str,
|
427
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
428
|
-
|
429
|
-
effective_time: str, [default=None], optional
|
430
|
-
Effective time of the query. If not specified will default to any time. Time format is
|
431
|
-
"YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
432
|
-
|
433
|
-
starts_with : bool, [default=False], optional
|
434
|
-
Starts with the supplied string.
|
435
|
-
ends_with : bool, [default=False], optional
|
436
|
-
Ends with the supplied string
|
437
|
-
ignore_case : bool, [default=False], optional
|
438
|
-
Ignore case when searching
|
439
|
-
for_lineage : bool, [default=False], optional
|
440
|
-
Indicates the search is for lineage.
|
441
|
-
for_duplicate_processing : bool, [default=False], optional
|
442
|
-
type_name: str, [default=None], optional
|
443
|
-
An optional parameter indicating the subtype of the glossary to filter by.
|
444
|
-
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
445
|
-
start_from: int, [default=0], optional
|
446
|
-
When multiple pages of results are available, the page number to start from.
|
447
|
-
page_size: int, [default=None]
|
448
|
-
The number of items to return in a single page. If not specified, the default will be taken from
|
449
|
-
the class instance.
|
450
|
-
Returns
|
451
|
-
-------
|
452
|
-
List | str
|
453
|
-
|
454
|
-
A list of glossary definitions active in the server.
|
455
|
-
|
456
|
-
Raises
|
457
|
-
------
|
458
|
-
|
459
|
-
InvalidParameterException
|
460
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
461
|
-
PropertyServerException
|
462
|
-
Raised by the server when an issue arises in processing a valid request
|
463
|
-
NotAuthorizedException
|
464
|
-
The principle specified by the user_id does not have authorization for the requested action
|
465
|
-
|
466
|
-
"""
|
467
|
-
loop = asyncio.get_event_loop()
|
468
|
-
response = loop.run_until_complete(
|
469
|
-
self._async_find_glossaries(
|
470
|
-
search_string,
|
471
|
-
effective_time,
|
472
|
-
starts_with,
|
473
|
-
ends_with,
|
474
|
-
ignore_case,
|
475
|
-
for_lineage,
|
476
|
-
for_duplicate_processing,
|
477
|
-
type_name,
|
478
|
-
start_from,
|
479
|
-
page_size,
|
480
|
-
)
|
481
|
-
)
|
482
|
-
|
483
|
-
return response
|
484
306
|
|
485
307
|
async def _async_get_glossaries_by_name(
|
486
308
|
self,
|
@@ -3610,193 +3432,6 @@ class GlossaryManager(GlossaryBrowser):
|
|
3610
3432
|
|
3611
3433
|
return response
|
3612
3434
|
|
3613
|
-
async def _async_find_glossary_terms(
|
3614
|
-
self,
|
3615
|
-
search_string: str,
|
3616
|
-
glossary_guid: str = None,
|
3617
|
-
status_filter: list = [],
|
3618
|
-
effective_time: str = None,
|
3619
|
-
starts_with: bool = False,
|
3620
|
-
ends_with: bool = False,
|
3621
|
-
ignore_case: bool = True,
|
3622
|
-
for_lineage: bool = False,
|
3623
|
-
for_duplicate_processing: bool = False,
|
3624
|
-
start_from: int = 0,
|
3625
|
-
page_size: int = None,
|
3626
|
-
) -> list | str:
|
3627
|
-
"""Retrieve the list of glossary term metadata elements that contain the search string.
|
3628
|
-
|
3629
|
-
Parameters
|
3630
|
-
----------
|
3631
|
-
search_string: str
|
3632
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
3633
|
-
glossary_guid str
|
3634
|
-
Identifier of the glossary to search within. If None, then all glossaries are searched.
|
3635
|
-
status_filter: list, default = [], optional
|
3636
|
-
Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
|
3637
|
-
the results will not be filtered.
|
3638
|
-
effective_time: str, [default=None], optional
|
3639
|
-
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
3640
|
-
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
3641
|
-
|
3642
|
-
starts_with : bool, [default=False], optional
|
3643
|
-
Starts with the supplied string.
|
3644
|
-
ends_with : bool, [default=False], optional
|
3645
|
-
Ends with the supplied string
|
3646
|
-
ignore_case : bool, [default=False], optional
|
3647
|
-
Ignore case when searching
|
3648
|
-
for_lineage : bool, [default=False], optional
|
3649
|
-
|
3650
|
-
for_duplicate_processing : bool, [default=False], optional
|
3651
|
-
|
3652
|
-
start_from: str, [default=0], optional
|
3653
|
-
Page of results to start from
|
3654
|
-
page_size : int, optional
|
3655
|
-
Number of elements to return per page - if None, then default for class will be used.
|
3656
|
-
|
3657
|
-
Returns
|
3658
|
-
-------
|
3659
|
-
List | str
|
3660
|
-
|
3661
|
-
A list of term definitions
|
3662
|
-
|
3663
|
-
Raises
|
3664
|
-
------
|
3665
|
-
InvalidParameterException
|
3666
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
3667
|
-
PropertyServerException
|
3668
|
-
Raised by the server when an issue arises in processing a valid request
|
3669
|
-
NotAuthorizedException
|
3670
|
-
The principle specified by the user_id does not have authorization for the requested action
|
3671
|
-
|
3672
|
-
Notes
|
3673
|
-
-----
|
3674
|
-
The search string is located in the request body and is interpreted as a plain string.
|
3675
|
-
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
3676
|
-
The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
|
3677
|
-
"""
|
3678
|
-
|
3679
|
-
if page_size is None:
|
3680
|
-
page_size = self.page_size
|
3681
|
-
if effective_time is None:
|
3682
|
-
effective_time = datetime.now().isoformat()
|
3683
|
-
starts_with_s = str(starts_with).lower()
|
3684
|
-
ends_with_s = str(ends_with).lower()
|
3685
|
-
ignore_case_s = str(ignore_case).lower()
|
3686
|
-
for_lineage_s = str(for_lineage).lower()
|
3687
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
3688
|
-
if search_string == "*":
|
3689
|
-
search_string = None
|
3690
|
-
|
3691
|
-
# validate_search_string(search_string)
|
3692
|
-
|
3693
|
-
body = {
|
3694
|
-
"class": "GlossarySearchStringRequestBody",
|
3695
|
-
"glossaryGUID": glossary_guid,
|
3696
|
-
"searchString": search_string,
|
3697
|
-
"effectiveTime": effective_time,
|
3698
|
-
"limitResultsByStatus": status_filter,
|
3699
|
-
}
|
3700
|
-
body = body_slimmer(body)
|
3701
|
-
|
3702
|
-
url = (
|
3703
|
-
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
|
3704
|
-
f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
3705
|
-
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
3706
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}"
|
3707
|
-
)
|
3708
|
-
|
3709
|
-
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
3710
|
-
|
3711
|
-
response = await self._async_make_request("POST", url, body)
|
3712
|
-
return response.json().get(
|
3713
|
-
"elementList", NO_TERMS_FOUND
|
3714
|
-
) # return response.text
|
3715
|
-
|
3716
|
-
def find_glossary_terms(
|
3717
|
-
self,
|
3718
|
-
search_string: str,
|
3719
|
-
glossary_guid: str = None,
|
3720
|
-
status_filter: list = [],
|
3721
|
-
effective_time: str = None,
|
3722
|
-
starts_with: bool = False,
|
3723
|
-
ends_with: bool = False,
|
3724
|
-
ignore_case: bool = False,
|
3725
|
-
for_lineage: bool = False,
|
3726
|
-
for_duplicate_processing: bool = False,
|
3727
|
-
start_from: int = 0,
|
3728
|
-
page_size: int = None,
|
3729
|
-
) -> list | str:
|
3730
|
-
"""Retrieve the list of glossary term metadata elements that contain the search string.
|
3731
|
-
|
3732
|
-
Parameters
|
3733
|
-
----------
|
3734
|
-
search_string: str
|
3735
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
3736
|
-
glossary_guid str
|
3737
|
-
Identifier of the glossary to search within. If None, then all glossaries are searched.
|
3738
|
-
status_filter: list, default = [], optional
|
3739
|
-
Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
|
3740
|
-
the results will not be filtered.
|
3741
|
-
effective_time: str, [default=None], optional
|
3742
|
-
If specified, the term information will be retrieved if it is active at the `effective_time`.
|
3743
|
-
Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
3744
|
-
|
3745
|
-
starts_with : bool, [default=False], optional
|
3746
|
-
Starts with the supplied string.
|
3747
|
-
ends_with : bool, [default=False], optional
|
3748
|
-
Ends with the supplied string
|
3749
|
-
ignore_case : bool, [default=False], optional
|
3750
|
-
Ignore case when searching
|
3751
|
-
for_lineage : bool, [default=False], optional
|
3752
|
-
|
3753
|
-
for_duplicate_processing : bool, [default=False], optional
|
3754
|
-
|
3755
|
-
start_from: str, [default=0], optional
|
3756
|
-
Page of results to start from
|
3757
|
-
page_size : int, optional
|
3758
|
-
Number of elements to return per page - if None, then default for class will be used.
|
3759
|
-
|
3760
|
-
Returns
|
3761
|
-
-------
|
3762
|
-
List | str
|
3763
|
-
|
3764
|
-
A list of term definitions
|
3765
|
-
|
3766
|
-
Raises
|
3767
|
-
------
|
3768
|
-
InvalidParameterException
|
3769
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
3770
|
-
PropertyServerException
|
3771
|
-
Raised by the server when an issue arises in processing a valid request
|
3772
|
-
NotAuthorizedException
|
3773
|
-
The principle specified by the user_id does not have authorization for the requested action
|
3774
|
-
|
3775
|
-
Notes
|
3776
|
-
-----
|
3777
|
-
The search string is located in the request body and is interpreted as a plain string.
|
3778
|
-
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
3779
|
-
The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
|
3780
|
-
"""
|
3781
|
-
|
3782
|
-
loop = asyncio.get_event_loop()
|
3783
|
-
response = loop.run_until_complete(
|
3784
|
-
self._async_find_glossary_terms(
|
3785
|
-
search_string,
|
3786
|
-
glossary_guid,
|
3787
|
-
status_filter,
|
3788
|
-
effective_time,
|
3789
|
-
starts_with,
|
3790
|
-
ends_with,
|
3791
|
-
ignore_case,
|
3792
|
-
for_lineage,
|
3793
|
-
for_duplicate_processing,
|
3794
|
-
start_from,
|
3795
|
-
page_size,
|
3796
|
-
)
|
3797
|
-
)
|
3798
|
-
|
3799
|
-
return response
|
3800
3435
|
|
3801
3436
|
|
3802
3437
|
if __name__ == "__main__":
|
@@ -17,10 +17,12 @@ pyegeria/commands/cat/exp_list_glossaries.py,sha256=dC6Bnfm3YSMTKPP146qeslIFRiZn
|
|
17
17
|
pyegeria/commands/cat/freddie_jup.py,sha256=zSuV8kiAGvOVBPnaln-dIY2T03hWQN2HeoLhkodayAo,5686
|
18
18
|
pyegeria/commands/cat/freddie_jupyter.py,sha256=w4qS9Lfzl5v7EwwsPdNnHICFrYX9qoPLsh9zs0wV7vw,6243
|
19
19
|
pyegeria/commands/cat/freddie_md.py,sha256=qEdjnu1vAYe2MhQBcNU5k80j6G6HfoJRcWLd_CcHQDg,7135
|
20
|
-
pyegeria/commands/cat/freddie_utils.py,sha256=
|
20
|
+
pyegeria/commands/cat/freddie_utils.py,sha256=r7e1EaUouwAY4sc4VjIr6xtknkhq4wz-UncyWW04IBk,26742
|
21
21
|
pyegeria/commands/cat/freddies-inbox/freddie_intro.md,sha256=2HGuA2xsRpwqxDtG59iD4hDdCkyHcqE-OhXCT1KgeW8,6512
|
22
22
|
pyegeria/commands/cat/freddies-inbox/glossary_creation_experiment.ipynb,sha256=dbzNu90fCKNohOWVSRBOB1GLyd95x8Qw51I5AkaPtso,11552
|
23
23
|
pyegeria/commands/cat/freddies-inbox/glossary_exp.md,sha256=KsUeTzDe5QkrTmIfIAXR74qZ29oSfRW-NAEn0RYIRqM,2534
|
24
|
+
pyegeria/commands/cat/freddies-outbox/Terms-2025-03-06-13-19-29-Report.md,sha256=nvwc4CxfCylURRZHhHrYthEYhGkiV6huOTct0tV7xRE,1981
|
25
|
+
pyegeria/commands/cat/freddies-outbox/Terms-2025-03-06-13-20-30-Update-Form.md,sha256=FKBOoF4VQCta8IzjuPPsJ12THr7_dUszFAmsD48MrIY,2046
|
24
26
|
pyegeria/commands/cat/get_asset_graph.py,sha256=xnXJfpDTVH1TJ2TwE3dtjaXU36Di6-N6JAyhothzz2o,12461
|
25
27
|
pyegeria/commands/cat/get_collection.py,sha256=KbSFoGZeK30_bMCa0BpIuCwBF5ywCX0g4hgDPnI0lEo,5356
|
26
28
|
pyegeria/commands/cat/get_project_dependencies.py,sha256=wDK_lAfR6p4VxYRV6MZE9XgU3OfIRcWKKYn0Xf64w6o,5986
|
@@ -35,21 +37,21 @@ pyegeria/commands/cat/list_deployed_catalogs.py,sha256=VdN6R9kRVWX-fGIgubOigvMVP
|
|
35
37
|
pyegeria/commands/cat/list_deployed_database_schemas.py,sha256=1Qicke1R2_7Xi3Qf5sp8KJ3_reAIt0z1iaz2sG8Z0Qs,9458
|
36
38
|
pyegeria/commands/cat/list_deployed_databases.py,sha256=ryrBW1CxJRfOeLP978qQwxb5oImqhIsHghtcpWeBIrw,7587
|
37
39
|
pyegeria/commands/cat/list_deployed_servers.py,sha256=_xR7EaaCsxIjTphxmoCZlARoja_vQqZ881pFiEuhw-8,5719
|
38
|
-
pyegeria/commands/cat/list_glossaries.py,sha256=
|
40
|
+
pyegeria/commands/cat/list_glossaries.py,sha256=8-hs6bXWIOrmZaIwke2ts281AAqmnQO960tTR3W2Q-g,7784
|
39
41
|
pyegeria/commands/cat/list_projects.py,sha256=NzWTuepTGUEyxK-eWvuUxtBgCtNWubVwmz2eqm2UN1c,7997
|
40
42
|
pyegeria/commands/cat/list_tech_type_elements.py,sha256=-9omj5en9dSP1xMSljYVHyfXsuhuE1bO2IFj_bZPhAs,6873
|
41
43
|
pyegeria/commands/cat/list_tech_types.py,sha256=uqZcXHCzAznhEG6WWeM5j-spwUh8ycygFqpVDeXOG-0,4653
|
42
|
-
pyegeria/commands/cat/list_terms.py,sha256=
|
44
|
+
pyegeria/commands/cat/list_terms.py,sha256=zBOnDjzvxfyC55kY0Pq43fidt_1mRheETeEyEmozlnE,11990
|
43
45
|
pyegeria/commands/cat/list_todos.py,sha256=NitCw0uyVVjmN1hxb1W-I4FbOsa8wQxW2ICyOElHyc8,6556
|
44
46
|
pyegeria/commands/cat/list_user_ids.py,sha256=X5Q-YNEp38saPYDuy9VwdQC5Qpa4HyC3WvAdbyp_P6M,5108
|
45
47
|
pyegeria/commands/cli/__init__.py,sha256=hpTVSMP2gnPRhcAZPdeUEsQ-eaDySlXlk239dNWYmng,292
|
46
|
-
pyegeria/commands/cli/egeria.py,sha256=
|
47
|
-
pyegeria/commands/cli/egeria_cat.py,sha256=
|
48
|
+
pyegeria/commands/cli/egeria.py,sha256=D4ZWcjB1LJ7fxhV5Ez1lkJAqmIaVujNJ3D02iLgytT4,52653
|
49
|
+
pyegeria/commands/cli/egeria_cat.py,sha256=SLjusGmM_cT04ora4flSt0sWExcX32M2pBLQncVlvQY,16653
|
48
50
|
pyegeria/commands/cli/egeria_login_tui.py,sha256=W5ouG3nlN7z2Waa-wzYFS7yyoGfOrK-lNB0FMt2JdOk,9492
|
49
51
|
pyegeria/commands/cli/egeria_my.py,sha256=0KTH7OIeKyp16ZeN7zK5uhadbPfAQsq38GMzJNWYG8g,6386
|
50
52
|
pyegeria/commands/cli/egeria_ops.py,sha256=8W4t2jFGn22OOOtyUAapQH8yyOl1wo09CVNTojRQKvo,12817
|
51
53
|
pyegeria/commands/cli/egeria_tech.py,sha256=HaTP1tzymvj4bhKl5O37JdCPTsACssqPQ-vkYeeeJXE,21140
|
52
|
-
pyegeria/commands/cli/ops_config.py,sha256=
|
54
|
+
pyegeria/commands/cli/ops_config.py,sha256=cH7Zzlh5rx_Wmr2ymUNTMhPPDhAoj50GyZR-pXP2cA8,1454
|
53
55
|
pyegeria/commands/cli/txt_custom_v2.tcss,sha256=ixkzpFyTZ5i3byFO9EmEAeJgzbEa7nZb_3iTgxNtVPk,232
|
54
56
|
pyegeria/commands/doc/README.md,sha256=3TDtLjanw5Sn5fhw0apsYv2HS2Hd7NSdjLu3qTwwXBg,13941
|
55
57
|
pyegeria/commands/doc/Visual Command Reference/README.md,sha256=StopwmMDYmJgfKeRC8nHOJMbXkz6n15zIDJBmHDPoxM,32445
|
@@ -227,8 +229,8 @@ pyegeria/egeria_my_client.py,sha256=eOKLk2zdI6FHZnhAimfR_0yNdBjpUgD41dJZcJODcqE,
|
|
227
229
|
pyegeria/egeria_tech_client.py,sha256=uycgYfCpb4jzFfaQ7I5JxbZ5PKsWdaWxLOJjbw6C2Zk,3817
|
228
230
|
pyegeria/feedback_manager_omvs.py,sha256=0xBs0p54vmdfVYYgQ8pOanLC4fxfgTk1Z61Y6D1U7_I,152978
|
229
231
|
pyegeria/full_omag_server_config.py,sha256=CQqLCy_3DZFvJZEOcGf50HWdFaWpiAIs6z-kKyjvpDA,47464
|
230
|
-
pyegeria/glossary_browser_omvs.py,sha256=
|
231
|
-
pyegeria/glossary_manager_omvs.py,sha256=
|
232
|
+
pyegeria/glossary_browser_omvs.py,sha256=55HguIU4ypbwLOZqHZRspUeeEaMIEc-riIctPHHH7Rw,99554
|
233
|
+
pyegeria/glossary_manager_omvs.py,sha256=BM54pCQBpzxry4nHUpPQ56kI1W864toHevTEZ6RckLE,126957
|
232
234
|
pyegeria/m_test.py,sha256=M5-M2ZczsAJLXWfSeqTTADHdx6Ku-y4PbQ4M21JthAE,7778
|
233
235
|
pyegeria/mermaid_utilities.py,sha256=sQqdFUWdNpHu9d3Tk9UVe80M-5bOzses0XcFYX5FF-E,54254
|
234
236
|
pyegeria/metadata_explorer_omvs.py,sha256=xHnZTQKbd6XwOhYia-RiIisrvZcqHi0SL1l6OCf04Gk,86911
|
@@ -248,8 +250,8 @@ pyegeria/test_w.html,sha256=q9HCstV2Ar-QiAqswte6hQ8EJuKqr5s99MUuXSxs7a8,11461
|
|
248
250
|
pyegeria/utils.py,sha256=GCt1C0bp0Xng1ahzbZhzV9qQwH7Dj93IaCt2dvWb-sg,5417
|
249
251
|
pyegeria/valid_metadata_omvs.py,sha256=Xq9DqBQvBFFJzaFIRKcVZ2k4gJvSh9yeXs_j-O3vn1w,65050
|
250
252
|
pyegeria/x_action_author_omvs.py,sha256=RcqSzahUKCtvb_3u_wyintAlc9WFkC_2v0E12TZs8lQ,6433
|
251
|
-
pyegeria-5.3.6.
|
252
|
-
pyegeria-5.3.6.
|
253
|
-
pyegeria-5.3.6.
|
254
|
-
pyegeria-5.3.6.
|
255
|
-
pyegeria-5.3.6.
|
253
|
+
pyegeria-5.3.6.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
254
|
+
pyegeria-5.3.6.2.dist-info/METADATA,sha256=knC6A-fMZXoAI650ze7rN_3LB8G9iuZK0CEWqiABaO4,2743
|
255
|
+
pyegeria-5.3.6.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
256
|
+
pyegeria-5.3.6.2.dist-info/entry_points.txt,sha256=9LIuEBIFodyDPNWxZFCJNSzK7-ZS85Kes3eTTYTGWHo,6407
|
257
|
+
pyegeria-5.3.6.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|