pyegeria 0.8.4.44__py3-none-any.whl → 0.8.4.45__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.
- commands/tech/list_related_elements.py +61 -33
- pyegeria/classification_manager_omvs.py +22 -172
- {pyegeria-0.8.4.44.dist-info → pyegeria-0.8.4.45.dist-info}/METADATA +1 -1
- {pyegeria-0.8.4.44.dist-info → pyegeria-0.8.4.45.dist-info}/RECORD +7 -7
- {pyegeria-0.8.4.44.dist-info → pyegeria-0.8.4.45.dist-info}/LICENSE +0 -0
- {pyegeria-0.8.4.44.dist-info → pyegeria-0.8.4.45.dist-info}/WHEEL +0 -0
- {pyegeria-0.8.4.44.dist-info → pyegeria-0.8.4.45.dist-info}/entry_points.txt +0 -0
@@ -32,7 +32,7 @@ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
|
32
32
|
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
33
33
|
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
34
34
|
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
35
|
-
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "
|
35
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "220"))
|
36
36
|
|
37
37
|
|
38
38
|
def list_related_elements(
|
@@ -49,14 +49,13 @@ def list_related_elements(
|
|
49
49
|
c_client = EgeriaTech(server, url, user_id=username, user_pwd=password)
|
50
50
|
token = c_client.create_egeria_bearer_token()
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
elements = c_client.get_related_elements(element_guid, relationship_type, om_type)
|
52
|
+
if om_type is not None:
|
53
|
+
om_typedef = c_client.get_typedef_by_name(om_type)
|
54
|
+
if type(om_typedef) is str:
|
55
|
+
print(
|
56
|
+
f"The type name '{om_type}' is not known to the Egeria platform at {url} - {server}"
|
57
|
+
)
|
58
|
+
sys.exit(1)
|
60
59
|
|
61
60
|
def generate_table() -> Table:
|
62
61
|
"""Make a new table."""
|
@@ -69,33 +68,42 @@ def list_related_elements(
|
|
69
68
|
caption_style="white on black",
|
70
69
|
show_lines=True,
|
71
70
|
box=box.ROUNDED,
|
72
|
-
title=f"Elements
|
71
|
+
title=f"Elements related to: '{element_guid}' ",
|
73
72
|
expand=True,
|
74
73
|
# width=500
|
75
74
|
)
|
76
|
-
|
77
|
-
table.add_column("
|
78
|
-
table.add_column("
|
79
|
-
table.add_column("
|
80
|
-
table.add_column("Home Store")
|
81
|
-
table.add_column("GUID", width=38, no_wrap=True)
|
75
|
+
table.add_column("Relationship GUID", width=38, no_wrap=True)
|
76
|
+
table.add_column("Rel Header", width=38, no_wrap=True)
|
77
|
+
table.add_column("Relationship Props")
|
78
|
+
table.add_column("Related GUID", width=38, no_wrap=True)
|
82
79
|
table.add_column("Properties")
|
83
|
-
table.add_column("
|
80
|
+
table.add_column("Element Header")
|
81
|
+
|
82
|
+
elements = c_client.get_related_elements(
|
83
|
+
element_guid, relationship_type, om_type
|
84
|
+
)
|
84
85
|
|
85
86
|
if type(elements) is list:
|
86
87
|
for element in elements:
|
87
|
-
header = element["
|
88
|
-
el_q_name = element["properties"].get("qualifiedName", "---")
|
88
|
+
header = element["relationshipHeader"]
|
89
89
|
el_type = header["type"]["typeName"]
|
90
90
|
el_home = header["origin"]["homeMetadataCollectionName"]
|
91
91
|
el_create_time = header["versions"]["createTime"][:-10]
|
92
92
|
el_guid = header["guid"]
|
93
93
|
el_class = header.get("classifications", "---")
|
94
|
+
rel_header_md = (
|
95
|
+
f"* Type: {el_type}\n"
|
96
|
+
f"* Home: {el_home}\n"
|
97
|
+
f"* Created: {el_create_time}\n"
|
98
|
+
)
|
99
|
+
rel_header_out = Markdown(rel_header_md)
|
94
100
|
|
95
|
-
|
96
|
-
for prop in element["
|
97
|
-
|
98
|
-
|
101
|
+
rel_props_md = ""
|
102
|
+
for prop in element["relationshipProperties"].keys():
|
103
|
+
rel_props_md += (
|
104
|
+
f"* **{prop}**: {element['relationshipProperties'][prop]}\n"
|
105
|
+
)
|
106
|
+
rel_props_out = Markdown(rel_props_md)
|
99
107
|
|
100
108
|
c_md = ""
|
101
109
|
if type(el_class) is list:
|
@@ -112,14 +120,30 @@ def list_related_elements(
|
|
112
120
|
c_md += f" * **{prop}**: {class_props[prop]}\n"
|
113
121
|
c_md_out = Markdown(c_md)
|
114
122
|
|
123
|
+
rel_element = element["relatedElement"]
|
124
|
+
rel_el_header = rel_element["elementHeader"]
|
125
|
+
rel_type = rel_el_header["type"]["typeName"]
|
126
|
+
rel_home = rel_el_header["origin"]["homeMetadataCollectionName"]
|
127
|
+
rel_guid = rel_el_header["guid"]
|
128
|
+
|
129
|
+
rel_el_header_md = f"* Type: {rel_type}\n" f"* Home: {rel_home}\n"
|
130
|
+
rel_el_header_out = Markdown(rel_el_header_md)
|
131
|
+
|
132
|
+
rel_el_props_md = ""
|
133
|
+
for prop in rel_element["properties"].keys():
|
134
|
+
rel_el_props_md += (
|
135
|
+
f"* **{prop}**: {rel_element['properties'][prop]}\n"
|
136
|
+
)
|
137
|
+
rel_el_props_out = Markdown(rel_el_props_md)
|
138
|
+
|
115
139
|
table.add_row(
|
116
|
-
el_q_name,
|
117
|
-
el_type,
|
118
|
-
el_create_time,
|
119
|
-
el_home,
|
120
140
|
el_guid,
|
121
|
-
|
122
|
-
|
141
|
+
rel_header_out,
|
142
|
+
rel_props_out,
|
143
|
+
# el_q_name,
|
144
|
+
rel_guid,
|
145
|
+
rel_el_props_out,
|
146
|
+
rel_el_header_out,
|
123
147
|
)
|
124
148
|
|
125
149
|
return table
|
@@ -159,11 +183,15 @@ def main():
|
|
159
183
|
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
160
184
|
|
161
185
|
try:
|
162
|
-
element_guid = Prompt.ask("Guid of base element")
|
163
|
-
om_type = Prompt.ask(
|
164
|
-
|
186
|
+
element_guid = Prompt.ask("Guid of base element").strip()
|
187
|
+
om_type = Prompt.ask("Enter the Open Metadata Type to find elements of")
|
188
|
+
relationship_type = Prompt.ask("Enter the relationship type to follow")
|
189
|
+
|
190
|
+
om_type = None if len(om_type) == 0 else om_type.strip()
|
191
|
+
relationship_type = (
|
192
|
+
None if len(relationship_type) == 0 else relationship_type.strip()
|
165
193
|
)
|
166
|
-
|
194
|
+
|
167
195
|
list_related_elements(
|
168
196
|
element_guid, om_type, relationship_type, server, url, userid, password
|
169
197
|
)
|
@@ -1494,169 +1494,11 @@ class ClassificationManager(Client):
|
|
1494
1494
|
#
|
1495
1495
|
# related elements
|
1496
1496
|
#
|
1497
|
-
async def _async_get_all_related_elements(
|
1498
|
-
self,
|
1499
|
-
element_guid: str,
|
1500
|
-
open_metadata_type_name: str = None,
|
1501
|
-
start_at_end: int = 1,
|
1502
|
-
effective_time: str = None,
|
1503
|
-
for_lineage: bool = None,
|
1504
|
-
for_duplicate_processing: bool = None,
|
1505
|
-
start_from: int = 0,
|
1506
|
-
page_size: int = max_paging_size,
|
1507
|
-
time_out: int = default_time_out,
|
1508
|
-
) -> list | str:
|
1509
|
-
"""
|
1510
|
-
Retrieve elements linked any relationship type name. It is also possible to limit the results by
|
1511
|
-
specifying a type name for the elements that should be returned. If no type name is specified then any type of
|
1512
|
-
element may be returned. Async version.
|
1513
|
-
|
1514
|
-
https://egeria-project.org/types/
|
1515
|
-
|
1516
|
-
Parameters
|
1517
|
-
----------
|
1518
|
-
element_guid: str
|
1519
|
-
- the base element to get related elements for
|
1520
|
-
open_metadata_type_name : str, default = None
|
1521
|
-
- open metadata type to be used to restrict the search
|
1522
|
-
start_at_end: int, default = 1
|
1523
|
-
- The end of the relationship to start from - typically End1
|
1524
|
-
effective_time: str, default = None
|
1525
|
-
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1526
|
-
for_lineage: bool, default is set by server
|
1527
|
-
- determines if elements classified as Memento should be returned - normally false
|
1528
|
-
for_duplicate_processing: bool, default is set by server
|
1529
|
-
- Normally false. Set true when the caller is part of a deduplication function
|
1530
|
-
start_from: int, default = 0
|
1531
|
-
- index of the list to start from (0 for start).
|
1532
|
-
page_size
|
1533
|
-
- maximum number of elements to return.
|
1534
|
-
|
1535
|
-
|
1536
|
-
time_out: int, default = default_time_out
|
1537
|
-
- http request timeout for this request
|
1538
|
-
|
1539
|
-
Returns
|
1540
|
-
-------
|
1541
|
-
[dict] | str
|
1542
|
-
Returns a string if no elements found and a list of dict of elements with the results.
|
1543
|
-
|
1544
|
-
Raises
|
1545
|
-
------
|
1546
|
-
InvalidParameterException
|
1547
|
-
one of the parameters is null or invalid or
|
1548
|
-
PropertyServerException
|
1549
|
-
There is a problem adding the element properties to the metadata repository or
|
1550
|
-
UserNotAuthorizedException
|
1551
|
-
the requesting user is not authorized to issue this request.
|
1552
|
-
"""
|
1553
|
-
|
1554
|
-
possible_query_params = query_string(
|
1555
|
-
[
|
1556
|
-
("startFrom", start_from),
|
1557
|
-
("pageSize", page_size),
|
1558
|
-
("forLineage", for_lineage),
|
1559
|
-
("forDuplicateProcessing", for_duplicate_processing),
|
1560
|
-
("startAtEnd", start_at_end),
|
1561
|
-
]
|
1562
|
-
)
|
1563
|
-
|
1564
|
-
body = {
|
1565
|
-
"class": "FindProperties",
|
1566
|
-
"openMetadataTypeName": open_metadata_type_name,
|
1567
|
-
"effectiveTime": effective_time,
|
1568
|
-
}
|
1569
|
-
|
1570
|
-
url = (
|
1571
|
-
f"{base_path(self, self.view_server)}/elements/{element_guid}/by-relationship"
|
1572
|
-
f"{possible_query_params}"
|
1573
|
-
)
|
1574
|
-
response: Response = await self._async_make_request(
|
1575
|
-
"POST", url, body_slimmer(body), time_out=time_out
|
1576
|
-
)
|
1577
|
-
elements = response.json().get("elements", "No elements found")
|
1578
|
-
if type(elements) is list:
|
1579
|
-
if len(elements) == 0:
|
1580
|
-
return "No elements found"
|
1581
|
-
return elements
|
1582
|
-
|
1583
|
-
def get_all_related_elements(
|
1584
|
-
self,
|
1585
|
-
element_guid: str,
|
1586
|
-
open_metadata_type_name: str = None,
|
1587
|
-
start_at_end: int = 1,
|
1588
|
-
effective_time: str = None,
|
1589
|
-
for_lineage: bool = None,
|
1590
|
-
for_duplicate_processing: bool = None,
|
1591
|
-
start_from: int = 0,
|
1592
|
-
page_size: int = max_paging_size,
|
1593
|
-
time_out: int = default_time_out,
|
1594
|
-
) -> list | str:
|
1595
|
-
"""
|
1596
|
-
Retrieve elements linked via any relationship type name. It is also possible to limit the results by
|
1597
|
-
specifying a type name for the elements that should be returned. If no type name is specified then any type of
|
1598
|
-
element may be returned.
|
1599
|
-
|
1600
|
-
https://egeria-project.org/types/
|
1601
|
-
|
1602
|
-
Parameters
|
1603
|
-
----------
|
1604
|
-
element_guid: str
|
1605
|
-
- the base element to get related elements for
|
1606
|
-
open_metadata_type_name : str, default = None
|
1607
|
-
- open metadata type to be used to restrict the search
|
1608
|
-
start_at_end: int, default = 1
|
1609
|
-
- The end of the relationship to start from - typically End1
|
1610
|
-
effective_time: str, default = None
|
1611
|
-
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
1612
|
-
for_lineage: bool, default is set by server
|
1613
|
-
- determines if elements classified as Memento should be returned - normally false
|
1614
|
-
for_duplicate_processing: bool, default is set by server
|
1615
|
-
- Normally false. Set true when the caller is part of a deduplication function
|
1616
|
-
start_from: int, default = 0
|
1617
|
-
- index of the list to start from (0 for start).
|
1618
|
-
page_size
|
1619
|
-
- maximum number of elements to return.
|
1620
|
-
|
1621
|
-
|
1622
|
-
time_out: int, default = default_time_out
|
1623
|
-
- http request timeout for this request
|
1624
|
-
|
1625
|
-
Returns
|
1626
|
-
-------
|
1627
|
-
[dict] | str
|
1628
|
-
Returns a string if no elements found and a list of dict of elements with the results.
|
1629
|
-
|
1630
|
-
Raises
|
1631
|
-
------
|
1632
|
-
InvalidParameterException
|
1633
|
-
one of the parameters is null or invalid or
|
1634
|
-
PropertyServerException
|
1635
|
-
There is a problem adding the element properties to the metadata repository or
|
1636
|
-
UserNotAuthorizedException
|
1637
|
-
the requesting user is not authorized to issue this request.
|
1638
|
-
"""
|
1639
|
-
|
1640
|
-
loop = asyncio.get_event_loop()
|
1641
|
-
response = loop.run_until_complete(
|
1642
|
-
self._async_get_all_related_elements(
|
1643
|
-
element_guid,
|
1644
|
-
open_metadata_type_name,
|
1645
|
-
start_at_end,
|
1646
|
-
effective_time,
|
1647
|
-
for_lineage,
|
1648
|
-
for_duplicate_processing,
|
1649
|
-
start_from,
|
1650
|
-
page_size,
|
1651
|
-
time_out,
|
1652
|
-
)
|
1653
|
-
)
|
1654
|
-
return response
|
1655
1497
|
|
1656
1498
|
async def _async_get_related_elements(
|
1657
1499
|
self,
|
1658
1500
|
element_guid: str,
|
1659
|
-
relationship_type: str,
|
1501
|
+
relationship_type: str = None,
|
1660
1502
|
open_metadata_type_name: str = None,
|
1661
1503
|
start_at_end: int = 1,
|
1662
1504
|
effective_time: str = None,
|
@@ -1667,9 +1509,9 @@ class ClassificationManager(Client):
|
|
1667
1509
|
time_out: int = default_time_out,
|
1668
1510
|
) -> list | str:
|
1669
1511
|
"""
|
1670
|
-
Retrieve elements linked
|
1671
|
-
|
1672
|
-
element may be returned. Async version.
|
1512
|
+
Retrieve elements linked by relationship type name. If the relationship type is None, then all related elements
|
1513
|
+
will be returned. It is also possible to limit the results by specifying a type name for the elements that
|
1514
|
+
should be returned. If no type name is specified then any type of element may be returned. Async version.
|
1673
1515
|
|
1674
1516
|
https://egeria-project.org/types/
|
1675
1517
|
|
@@ -1677,8 +1519,9 @@ class ClassificationManager(Client):
|
|
1677
1519
|
----------
|
1678
1520
|
element_guid: str
|
1679
1521
|
- the base element to get related elements for
|
1680
|
-
relationship_type: str
|
1681
|
-
- the type of relationship to navigate to related elements
|
1522
|
+
relationship_type: str, optional, default = None
|
1523
|
+
- the type of relationship to navigate to related elements.
|
1524
|
+
If None, then all related elements will be returned.
|
1682
1525
|
open_metadata_type_name : str, default = None
|
1683
1526
|
- open metadata type to be used to restrict the search
|
1684
1527
|
start_at_end: int, default = 1
|
@@ -1729,10 +1572,17 @@ class ClassificationManager(Client):
|
|
1729
1572
|
"effectiveTime": effective_time,
|
1730
1573
|
}
|
1731
1574
|
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1575
|
+
if relationship_type is None:
|
1576
|
+
url = (
|
1577
|
+
f"{base_path(self, self.view_server)}/elements/{element_guid}/by-relationship"
|
1578
|
+
f"{possible_query_params}"
|
1579
|
+
)
|
1580
|
+
else:
|
1581
|
+
url = (
|
1582
|
+
f"{base_path(self, self.view_server)}/elements/{element_guid}/by-relationship/"
|
1583
|
+
f"{relationship_type}{possible_query_params}"
|
1584
|
+
)
|
1585
|
+
|
1736
1586
|
response: Response = await self._async_make_request(
|
1737
1587
|
"POST", url, body_slimmer(body), time_out=time_out
|
1738
1588
|
)
|
@@ -1745,7 +1595,7 @@ class ClassificationManager(Client):
|
|
1745
1595
|
def get_related_elements(
|
1746
1596
|
self,
|
1747
1597
|
element_guid: str,
|
1748
|
-
relationship_type: str,
|
1598
|
+
relationship_type: str = None,
|
1749
1599
|
open_metadata_type_name: str = None,
|
1750
1600
|
start_at_end: int = 1,
|
1751
1601
|
effective_time: str = None,
|
@@ -1756,9 +1606,9 @@ class ClassificationManager(Client):
|
|
1756
1606
|
time_out: int = default_time_out,
|
1757
1607
|
) -> list | str:
|
1758
1608
|
"""
|
1759
|
-
Retrieve elements linked
|
1760
|
-
|
1761
|
-
element may be returned.
|
1609
|
+
Retrieve elements linked by relationship type name. If the relationship type is None, then all related elements
|
1610
|
+
will be returned. It is also possible to limit the results by specifying a type name for the elements that
|
1611
|
+
should be returned. If no type name is specified then any type of element may be returned.
|
1762
1612
|
|
1763
1613
|
https://egeria-project.org/types/
|
1764
1614
|
|
@@ -56,7 +56,7 @@ commands/tech/list_elements.py,sha256=vO4SPEhcKm0L5rHVr6r8KYX3sPazGJ78oWsO2wLcf2
|
|
56
56
|
commands/tech/list_elements_for_classification.py,sha256=oAge8RFz4z9H-jCE0fBDhS4AbIHqhQWBvZ4Dp7BZbfM,6194
|
57
57
|
commands/tech/list_elements_x.py,sha256=k5jkekB7wh6cbzjn7FnwL7pKrPFq_oE-x36c_Z1FuSo,6500
|
58
58
|
commands/tech/list_registered_services.py,sha256=QzE_ebdopNkHWMxa-xc902GG6ac4Yw-ln8i8NUsgHVA,6542
|
59
|
-
commands/tech/list_related_elements.py,sha256=
|
59
|
+
commands/tech/list_related_elements.py,sha256=rM7YJ1rSWQTsPePMxlw2rEb5QC5jOX1HjypqWhmvquA,7607
|
60
60
|
commands/tech/list_related_specification.py,sha256=mWrKenXOskL4cl0DHjH2Z8M9-FJzjkzK62W-tsx3WDU,5918
|
61
61
|
commands/tech/list_relationship_types.py,sha256=BlVzrPznZXqMVLN2-2vYEVRGeYsiJrqXxIJEikobyoo,5875
|
62
62
|
commands/tech/list_tech_templates.py,sha256=RiyA8a4fIL9BGeGf37Bkk471mK5ECkDJMN9QVNReC1M,6192
|
@@ -70,7 +70,7 @@ pyegeria/_globals.py,sha256=1Uc8392wjbiVN5L__RzxC1-U97RMXj77_iUsMSgeAjQ,638
|
|
70
70
|
pyegeria/_validators.py,sha256=rnZelHJnjHaLZ8UhUTDyB59MfIUJifhALtkYoHBaos4,12736
|
71
71
|
pyegeria/asset_catalog_omvs.py,sha256=fffZsSukOrG-xszD6uEPf2IX4p0IK63T0_w7_6BpG1Q,21075
|
72
72
|
pyegeria/automated_curation_omvs.py,sha256=TQfA1_Evy6oQECtxYULeZUuPPRiSxwSMXcid2qytcHI,133257
|
73
|
-
pyegeria/classification_manager_omvs.py,sha256=
|
73
|
+
pyegeria/classification_manager_omvs.py,sha256=Op6JqnJWMoIRkgzRr__P-mnROSaoWBq54cnjuAhoo5Q,180808
|
74
74
|
pyegeria/collection_manager_omvs.py,sha256=kye2kjthNnmwxMZhHQKV0xoHbxcNPWjNzRAYOItj_gY,99201
|
75
75
|
pyegeria/core_omag_server_config.py,sha256=EtHaPKyc9d6pwTgbnQqGwe5lSBMPIfJOlbJEa1zg1JA,94946
|
76
76
|
pyegeria/create_tech_guid_lists.py,sha256=HHkC6HW58EN1BiolrYSRqSE0JhPbTepOFzwtdwBxVaU,4640
|
@@ -93,8 +93,8 @@ pyegeria/server_operations.py,sha256=ciH890hYT85YQ6OpByn4w7s3a7TtvWZpIG5rkRqbcI0
|
|
93
93
|
pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
|
94
94
|
pyegeria/valid_metadata_omvs.py,sha256=raBU_bK0oMhOqjOUTSbU_OZuGKsYqRoiFbtUwz4OtZI,29060
|
95
95
|
pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
|
96
|
-
pyegeria-0.8.4.
|
97
|
-
pyegeria-0.8.4.
|
98
|
-
pyegeria-0.8.4.
|
99
|
-
pyegeria-0.8.4.
|
100
|
-
pyegeria-0.8.4.
|
96
|
+
pyegeria-0.8.4.45.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
97
|
+
pyegeria-0.8.4.45.dist-info/METADATA,sha256=g_Eni-Iwrn3MkWF0xzpAiRjDgQk256NWNGUWvANwPgk,2868
|
98
|
+
pyegeria-0.8.4.45.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
99
|
+
pyegeria-0.8.4.45.dist-info/entry_points.txt,sha256=flo8ASXXBWDaip5ThOzzOKq0U6BMdVO27MHjXWZRXOw,3496
|
100
|
+
pyegeria-0.8.4.45.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|