pyegeria 5.3.8.8__py3-none-any.whl → 5.3.8.10__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.
@@ -21,6 +21,27 @@ from pyegeria._validators import validate_guid, validate_name
21
21
  from pyegeria.glossary_browser_omvs import GlossaryBrowser
22
22
  from pyegeria.utils import body_slimmer
23
23
 
24
+ def query_seperator(current_string):
25
+ if current_string == "":
26
+ return "?"
27
+ else:
28
+ return "&"
29
+
30
+
31
+ "params are in the form of [(paramName, value), (param2Name, value)] if the value is not None, it will be added to the query string"
32
+
33
+
34
+ def query_string(params):
35
+ result = ""
36
+ for i in range(len(params)):
37
+ if params[i][1] is not None:
38
+ result = f"{result}{query_seperator(result)}{params[i][0]}={params[i][1]}"
39
+ return result
40
+
41
+
42
+ def base_path(client, view_server: str):
43
+ return f"{client.platform_url}/servers/{view_server}/api/open-metadata/classification-manager"
44
+
24
45
 
25
46
  class GlossaryManager(GlossaryBrowser):
26
47
  """
@@ -781,6 +802,7 @@ class GlossaryManager(GlossaryBrowser):
781
802
  "class" : "GlossaryTermProperties",
782
803
  "qualifiedName" : "GlossaryTerm: term name : {$isoTimestamp}",
783
804
  "displayName" : "term name",
805
+ "aliases": []
784
806
  "summary" : "This is the short description.",
785
807
  "description" : "This is the long description of the term.",
786
808
  "abbreviation" : "GT",
@@ -848,6 +870,7 @@ class GlossaryManager(GlossaryBrowser):
848
870
  "class" : "GlossaryTermProperties",
849
871
  "qualifiedName" : "GlossaryTerm: term name : {$isoTimestamp}",
850
872
  "displayName" : "term name",
873
+ "aliases": []
851
874
  "summary" : "This is the short description.",
852
875
  "description" : "This is the long description of the term.",
853
876
  "abbreviation" : "GT",
@@ -1473,6 +1496,389 @@ class GlossaryManager(GlossaryBrowser):
1473
1496
  self._async_remove_term_from_category(glossary_term_guid, glossary_category_guid)
1474
1497
  )
1475
1498
 
1499
+ async def _async_add_relationship_between_terms(
1500
+ self, term1_guid: str, term2_guid: str, relationship_type: str, body: dict = None,
1501
+ for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
1502
+ """Add a relationship between terms. Async Version.
1503
+
1504
+ Parameters
1505
+ ----------
1506
+ term1_guid : str
1507
+ Unique identifier of the first glossary term in relationship.
1508
+ term2_guid : str
1509
+ Unique identifier of the second glossary term in relationship.
1510
+ relationship_type: str
1511
+ Type of relationship to add.
1512
+ body: dict, optional, default = None
1513
+ Further optional details for the relationship.
1514
+ for_lineage: bool, default is set by server
1515
+ - determines if elements classified as Memento should be returned - normally false
1516
+ for_duplicate_processing: bool, default is set by server
1517
+ - Normally false. Set true when the caller is part of a deduplication function
1518
+
1519
+ Returns
1520
+ -------
1521
+ None
1522
+
1523
+ Raises
1524
+ ------
1525
+ InvalidParameterException
1526
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1527
+ PropertyServerException
1528
+ Raised by the server when an issue arises in processing a valid request.
1529
+ NotAuthorizedException
1530
+ The principle specified by the user_id does not have authorization for the requested action.
1531
+
1532
+ Notes
1533
+ ----
1534
+ Body is currently required but can be empty except for class. Basic structure is:
1535
+
1536
+ {
1537
+ "class" : "RelationshipRequestBody",
1538
+ "effectiveTime" : {{@isoTimestamp}},
1539
+ "properties" : {
1540
+ "class" : "GlossaryTermRelationship",
1541
+ "expression" : "",
1542
+ "confidence" : 0,
1543
+ "description" : "",
1544
+ "status" : "",
1545
+ "steward" : "",
1546
+ "source" : "",
1547
+ "effectiveFrom" : "{{@isoTimestamp}}",
1548
+ "effectiveTo" : "{{@isoTimestamp}}",
1549
+ "extendedProperties" : {
1550
+ }
1551
+ }
1552
+ }
1553
+ """
1554
+
1555
+ validate_guid(term1_guid)
1556
+ validate_guid(term2_guid)
1557
+
1558
+ if body is None:
1559
+ body = {"class": "RelationshipRequestBody",
1560
+ "properties":
1561
+ {"class": "GlossaryTermRelationship",}
1562
+ }
1563
+
1564
+ possible_query_params = query_string(
1565
+ [
1566
+ ("forLineage", for_lineage),
1567
+ ("forDuplicateProcessing", for_duplicate_processing),
1568
+ ]
1569
+ )
1570
+
1571
+ url = (
1572
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
1573
+ f"terms/{term1_guid}/relationships/{relationship_type}/terms/{term2_guid}{possible_query_params}"
1574
+ )
1575
+
1576
+ await self._async_make_request("POST", url, body_slimmer(body))
1577
+
1578
+
1579
+ def add_relationship_between_terms(
1580
+ self, term1_guid: str, term2_guid: str, relationship_type: str, body: dict = None,
1581
+ for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
1582
+ """Add a relationship between terms.
1583
+
1584
+ Parameters
1585
+ ----------
1586
+ term1_guid : str
1587
+ Unique identifier of the first glossary term in relationship.
1588
+ term2_guid : str
1589
+ Unique identifier of the second glossary term in relationship.
1590
+ relationship_type: str
1591
+ Type of relationship to add. A list of relationship types can be found using get_term_relationship_types().
1592
+ body: dict, optional, default = None
1593
+ Further optional details for the relationship.
1594
+ for_lineage: bool, default is set by server
1595
+ - determines if elements classified as Memento should be returned - normally false
1596
+ for_duplicate_processing: bool, default is set by server
1597
+ - Normally false. Set true when the caller is part of a deduplication function
1598
+
1599
+ Returns
1600
+ -------
1601
+ None
1602
+
1603
+ Raises
1604
+ ------
1605
+ InvalidParameterException
1606
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1607
+ PropertyServerException
1608
+ Raised by the server when an issue arises in processing a valid request.
1609
+ NotAuthorizedException
1610
+ The principle specified by the user_id does not have authorization for the requested action.
1611
+
1612
+ Notes
1613
+ ----
1614
+ Body is currently required but can be empty except for class. Basic structure is:
1615
+
1616
+ {
1617
+ "class" : "RelationshipRequestBody",
1618
+ "effectiveTime" : {{@isoTimestamp}},
1619
+ "properties" : {
1620
+ "class" : "GlossaryTermRelationship",
1621
+ "expression" : "",
1622
+ "confidence" : 0,
1623
+ "description" : "",
1624
+ "status" : "",
1625
+ "steward" : "",
1626
+ "source" : "",
1627
+ "effectiveFrom" : "{{@isoTimestamp}}",
1628
+ "effectiveTo" : "{{@isoTimestamp}}",
1629
+ "extendedProperties" : {
1630
+ }
1631
+ }
1632
+ }
1633
+ """
1634
+ loop = asyncio.get_event_loop()
1635
+ loop.run_until_complete(
1636
+ self._async_add_relationship_between_terms(term1_guid, term2_guid, relationship_type,
1637
+ body, for_lineage, for_duplicate_processing)
1638
+ )
1639
+
1640
+
1641
+ async def _async_update_relationship_between_terms(
1642
+ self, term1_guid: str, term2_guid: str, relationship_type: str, body: dict = None,
1643
+ for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
1644
+
1645
+ """Update a relationship between terms. Async Version.
1646
+
1647
+ Parameters
1648
+ ----------
1649
+ term1_guid : str
1650
+ Unique identifier of the first glossary term in relationship.
1651
+ term2_guid : str
1652
+ Unique identifier of the second glossary term in relationship.
1653
+ relationship_type: str
1654
+ Type of relationship to update.
1655
+ body: dict, optional, default = None
1656
+ Further optional details for the relationship.
1657
+ for_lineage: bool, default is set by server
1658
+ - determines if elements classified as Memento should be returned - normally false
1659
+ for_duplicate_processing: bool, default is set by server
1660
+ - Normally false. Set true when the caller is part of a deduplication function
1661
+
1662
+ Returns
1663
+ -------
1664
+ None
1665
+
1666
+ Raises
1667
+ ------
1668
+ InvalidParameterException
1669
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1670
+ PropertyServerException
1671
+ Raised by the server when an issue arises in processing a valid request.
1672
+ NotAuthorizedException
1673
+ The principle specified by the user_id does not have authorization for the requested action.
1674
+
1675
+ Notes
1676
+ ----
1677
+ Body is currently required but can be empty except for class. Basic structure is:
1678
+
1679
+ {
1680
+ "class" : "RelationshipRequestBody",
1681
+ "effectiveTime" : {{@isoTimestamp}},
1682
+ "properties" : {
1683
+ "class" : "GlossaryTermRelationship",
1684
+ "expression" : "",
1685
+ "confidence" : 0,
1686
+ "description" : "",
1687
+ "status" : "",
1688
+ "steward" : "",
1689
+ "source" : "",
1690
+ "effectiveFrom" : "{{@isoTimestamp}}",
1691
+ "effectiveTo" : "{{@isoTimestamp}}",
1692
+ "extendedProperties" : {
1693
+ }
1694
+ }
1695
+ }
1696
+ """
1697
+
1698
+ validate_guid(term1_guid)
1699
+ validate_guid(term2_guid)
1700
+
1701
+ possible_query_params = query_string(
1702
+ [
1703
+ ("forLineage", for_lineage),
1704
+ ("forDuplicateProcessing", for_duplicate_processing),
1705
+ ]
1706
+ )
1707
+
1708
+ if body is None:
1709
+ body = {"properties": {"class": "RelationshipRequestBody"}}
1710
+
1711
+ url = (
1712
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
1713
+ f"terms/{term1_guid}/relationships/{relationship_type}/terms/{term2_guid}/update{possible_query_params}"
1714
+ )
1715
+
1716
+ await self._async_make_request("POST", url, body_slimmer(body))
1717
+
1718
+
1719
+ def update_relationship_between_terms(
1720
+ self, term1_guid: str, term2_guid: str, relationship_type: str, body: dict,
1721
+ for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
1722
+ """Update a relationship between terms.
1723
+
1724
+ Parameters
1725
+ ----------
1726
+ term1_guid : str
1727
+ Unique identifier of the first glossary term in relationship.
1728
+ term2_guid : str
1729
+ Unique identifier of the second glossary term in relationship.
1730
+ relationship_type: str
1731
+ Type of relationship to update. A list of relationship types can be found using get_term_relationship_types().
1732
+ body: dict
1733
+ Details of the relationship to update.
1734
+ for_lineage: bool, default is set by server
1735
+ - determines if elements classified as Memento should be returned - normally false
1736
+ for_duplicate_processing: bool, default is set by server
1737
+ - Normally false. Set true when the caller is part of a deduplication function
1738
+
1739
+ Returns
1740
+ -------
1741
+ None
1742
+
1743
+ Raises
1744
+ ------
1745
+ InvalidParameterException
1746
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1747
+ PropertyServerException
1748
+ Raised by the server when an issue arises in processing a valid request.
1749
+ NotAuthorizedException
1750
+ The principle specified by the user_id does not have authorization for the requested action.
1751
+
1752
+ Notes
1753
+ ----
1754
+ Body is currently required but can be empty except for class. Basic structure is:
1755
+
1756
+ {
1757
+ "class" : "RelationshipRequestBody",
1758
+ "effectiveTime" : {{@isoTimestamp}},
1759
+ "properties" : {
1760
+ "class" : "GlossaryTermRelationship",
1761
+ "expression" : "",
1762
+ "confidence" : 0,
1763
+ "description" : "",
1764
+ "status" : "",
1765
+ "steward" : "",
1766
+ "source" : "",
1767
+ "effectiveFrom" : "{{@isoTimestamp}}",
1768
+ "effectiveTo" : "{{@isoTimestamp}}",
1769
+ "extendedProperties" : {
1770
+ }
1771
+ }
1772
+ }
1773
+ """
1774
+ loop = asyncio.get_event_loop()
1775
+ loop.run_until_complete(
1776
+ self._async_update_relationship_between_terms(term1_guid, term2_guid, relationship_type,
1777
+ body,for_lineage,for_duplicate_processing)
1778
+ )
1779
+
1780
+ async def _async_remove_relationship_between_terms(
1781
+ self, term1_guid: str, term2_guid: str, relationship_type: str, effective_time: str = None,
1782
+ for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
1783
+ """Remove a relationship between terms. Async Version.
1784
+
1785
+ Parameters
1786
+ ----------
1787
+ term1_guid : str
1788
+ Unique identifier of the first glossary term in relationship.
1789
+ term2_guid : str
1790
+ Unique identifier of the second glossary term in relationship.
1791
+ relationship_type: str
1792
+ Type of relationship to add.
1793
+ effective_time: str, optional, default = None
1794
+ Effective time to remove the relationship.
1795
+ for_lineage: bool, default is set by server
1796
+ - determines if elements classified as Memento should be returned - normally false
1797
+ for_duplicate_processing: bool, default is set by server
1798
+ - Normally false. Set true when the caller is part of a deduplication function
1799
+
1800
+ Returns
1801
+ -------
1802
+ None
1803
+
1804
+ Raises
1805
+ ------
1806
+ InvalidParameterException
1807
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1808
+ PropertyServerException
1809
+ Raised by the server when an issue arises in processing a valid request.
1810
+ NotAuthorizedException
1811
+ The principle specified by the user_id does not have authorization for the requested action.
1812
+
1813
+
1814
+ """
1815
+
1816
+ validate_guid(term1_guid)
1817
+ validate_guid(term2_guid)
1818
+
1819
+ possible_query_params = query_string(
1820
+ [
1821
+ ("forLineage", for_lineage),
1822
+ ("forDuplicateProcessing", for_duplicate_processing),
1823
+ ]
1824
+ )
1825
+
1826
+ body = {"properties": {
1827
+ "class": "EffectiveTimeQueryRequestBody",
1828
+ "effectiveTime": effective_time
1829
+ }
1830
+ }
1831
+
1832
+ url = (
1833
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
1834
+ f"terms/{term1_guid}/relationships/{relationship_type}/terms/{term2_guid}/remove{possible_query_params}"
1835
+ )
1836
+
1837
+ await self._async_make_request("POST", url, body_slimmer(body))
1838
+
1839
+
1840
+ def remove_relationship_between_terms(
1841
+ self, term1_guid: str, term2_guid: str, relationship_type: str, effective_time: str = None,
1842
+ for_lineage: bool = False, for_duplicate_processing: bool = False) -> None:
1843
+ """Remove a relationship between terms.
1844
+
1845
+ Parameters
1846
+ ----------
1847
+ term1_guid : str
1848
+ Unique identifier of the first glossary term in relationship.
1849
+ term2_guid : str
1850
+ Unique identifier of the second glossary term in relationship.
1851
+ relationship_type: str
1852
+ Type of relationship to remove. A list of relationship types can be found using get_term_relationship_types().
1853
+ effective_time: str, optional, default = None
1854
+ Effective time to remove the relationship.
1855
+ for_lineage: bool, default is set by server
1856
+ - determines if elements classified as Memento should be returned - normally false
1857
+ for_duplicate_processing: bool, default is set by server
1858
+ - Normally false. Set true when the caller is part of a deduplication function
1859
+
1860
+ Returns
1861
+ -------
1862
+ None
1863
+
1864
+ Raises
1865
+ ------
1866
+ InvalidParameterException
1867
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1868
+ PropertyServerException
1869
+ Raised by the server when an issue arises in processing a valid request.
1870
+ NotAuthorizedException
1871
+ The principle specified by the user_id does not have authorization for the requested action.
1872
+
1873
+ """
1874
+ loop = asyncio.get_event_loop()
1875
+ loop.run_until_complete(
1876
+ self._async_remove_relationship_between_terms(term1_guid, term2_guid, relationship_type,
1877
+ effective_time, for_lineage, for_duplicate_processing)
1878
+ )
1879
+
1880
+
1881
+
1476
1882
  async def _async_add_confidentiality_to_term(
1477
1883
  self,
1478
1884
  glossary_term_guid: str,
@@ -1663,7 +2069,7 @@ class GlossaryManager(GlossaryBrowser):
1663
2069
  self,
1664
2070
  glossary_term_guid: str,
1665
2071
  body: dict,
1666
- is_merge_update: bool = True,
2072
+ is_merge_update: bool = False,
1667
2073
  for_lineage: bool = False,
1668
2074
  for_duplicate_processig: bool = False,
1669
2075
  ) -> None:
@@ -2026,7 +2432,8 @@ class GlossaryManager(GlossaryBrowser):
2026
2432
 
2027
2433
  return
2028
2434
 
2029
-
2435
+ async def _async_relate_terms(self, term1_guid: str, term2_guid: str, relationship: str) -> None:
2436
+ pass
2030
2437
 
2031
2438
 
2032
2439
  if __name__ == "__main__":