pyegeria 0.3.4__tar.gz → 0.3.6__tar.gz
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-0.3.4/src/pyegeria.egg-info → pyegeria-0.3.6}/PKG-INFO +1 -1
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/.DS_Store +0 -0
- pyegeria-0.3.6/examples/Doc_Samples/Create_Collection_Sample.py +292 -0
- pyegeria-0.3.6/examples/Doc_Samples/Create_Sustainability_Collection_Sample.py +115 -0
- pyegeria-0.3.6/examples/Jupyter Notebooks/P-egeria-server-config.ipynb +2248 -0
- pyegeria-0.3.6/examples/Jupyter Notebooks/README.md +2 -0
- pyegeria-0.3.6/examples/Jupyter Notebooks/common/P-environment-check.ipynb +114 -0
- pyegeria-0.3.6/examples/Jupyter Notebooks/common/__init__.py +15 -0
- pyegeria-0.3.6/examples/Jupyter Notebooks/common/common-functions.ipynb +4694 -0
- pyegeria-0.3.6/examples/Jupyter Notebooks/common/environment-check.ipynb +53 -0
- pyegeria-0.3.6/examples/Jupyter Notebooks/common/globals.ipynb +184 -0
- pyegeria-0.3.6/examples/Jupyter Notebooks/common/globals.py +153 -0
- pyegeria-0.3.6/examples/Jupyter Notebooks/common/orig_globals.py +151 -0
- pyegeria-0.3.6/examples/widgets/.DS_Store +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/README.md +5 -1
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/coco_status.py +8 -10
- pyegeria-0.3.6/examples/widgets/collection_viewer.py +98 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/engine_action_status.py +8 -10
- pyegeria-0.3.6/examples/widgets/get_relationship_types.py +141 -0
- pyegeria-0.3.6/examples/widgets/get_tech_details.py +147 -0
- pyegeria-0.3.6/examples/widgets/get_tech_types.py +124 -0
- pyegeria-0.3.6/examples/widgets/get_valid_metadata_values.py +144 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/list_asset_types.py +2 -3
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/multi-server_status.py +1 -4
- pyegeria-0.3.6/examples/widgets/project_list_viewer.py +153 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/view_my_profile.py +1 -1
- {pyegeria-0.3.4 → pyegeria-0.3.6}/pyproject.toml +1 -1
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/__init__.py +3 -1
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/automated_curation_omvs.py +73 -20
- pyegeria-0.3.6/src/pyegeria/collection_manager_omvs.py +2428 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/core_omag_server_config.py +5 -2
- pyegeria-0.3.6/src/pyegeria/project_manager_omvs.py +1689 -0
- pyegeria-0.3.6/src/pyegeria/valid_metadata_omvs.py +779 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6/src/pyegeria.egg-info}/PKG-INFO +1 -1
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria.egg-info/SOURCES.txt +24 -2
- pyegeria-0.3.6/tests/test_automated_curation_omvs.py +1034 -0
- pyegeria-0.3.6/tests/test_collection_manager_omvs.py +1207 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_core_omag_server_config.py +2 -2
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_platform_services.py +3 -3
- pyegeria-0.3.6/tests/test_project_manager_omvs.py +704 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_registered_info.py +2 -2
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_server_operations.py +4 -3
- pyegeria-0.3.6/tests/test_valid_metadata_omvs.py +346 -0
- pyegeria-0.3.4/src/pyegeria/exceptions.py +0 -382
- pyegeria-0.3.4/tests/test_automated_curation_omvs.py +0 -495
- pyegeria-0.3.4/tests/test_automated_curation_omvs_cray.py +0 -320
- {pyegeria-0.3.4 → pyegeria-0.3.6}/LICENSE +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/MANIFEST.in +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/README.md +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/README.md +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/__init__.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_cocoMDS1.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_cocoMDS2.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_cocoMDS3.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_cocoMDS4.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_cocoMDS5.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_cocoMDS6.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_cocoMDSx.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_cocoView1.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_exchangeDL01.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_governDL01.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_monitorDev01.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/config_monitorGov01.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/Coco_config/globals.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/__init__.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/__pycache__/__init__.cpython-312.pyc +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/__init__.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/__pycache__/__init__.cpython-312.pyc +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/__pycache__/server_status_widget.cpython-312-pytest-7.4.4.pyc +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/find_todos.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/glossary_view.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/gov_engine_status.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/integration_daemon_status.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/my_todos.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/open_todos.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/server_status.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/examples/widgets/server_status_widget.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/setup.cfg +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/setup.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/_client.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/_exceptions.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/_globals.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/_validators.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/full_omag_server_config.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/glossary_omvs.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/gov_engine.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/governance_author.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/my_profile_omvs.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/platform_services.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/registered_info.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/server_operations.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria/utils.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria.egg-info/dependency_links.txt +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria.egg-info/requires.txt +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/src/pyegeria.egg-info/top_level.txt +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_client.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_full_omag_server_config.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_glossary_omvs.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_gov_engine.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_my_profile_omvs.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_util_exp.py +0 -0
- {pyegeria-0.3.4 → pyegeria-0.3.6}/tests/test_validators.py +0 -0
Binary file
|
@@ -0,0 +1,292 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
This sample creates the collection structure show in https://egeria-project.org/types/0/0021-Collections
|
6
|
+
|
7
|
+
"""
|
8
|
+
|
9
|
+
import time
|
10
|
+
|
11
|
+
from rich import print
|
12
|
+
from rich.console import Console
|
13
|
+
|
14
|
+
from pyegeria import CollectionManager, InvalidParameterException, PropertyServerException, UserNotAuthorizedException
|
15
|
+
|
16
|
+
view_server = 'view-server'
|
17
|
+
platform_url = 'https://localhost:9443'
|
18
|
+
user = 'erinoverview'
|
19
|
+
console = Console()
|
20
|
+
|
21
|
+
try:
|
22
|
+
c_client = CollectionManager(view_server, platform_url,
|
23
|
+
user_id=user)
|
24
|
+
|
25
|
+
token = c_client.create_egeria_bearer_token(user, "secret")
|
26
|
+
start_time = time.perf_counter()
|
27
|
+
|
28
|
+
# Create a Data Products Root collection
|
29
|
+
anchor_guid = None
|
30
|
+
parent_guid = None
|
31
|
+
parent_relationship_type_name = None
|
32
|
+
parent_at_end1 = False
|
33
|
+
display_name = "Digital Products Root"
|
34
|
+
description = "This is the root catalog for digital products"
|
35
|
+
collection_type = "Digital Products Root"
|
36
|
+
is_own_anchor = True
|
37
|
+
|
38
|
+
response = c_client.create_root_collection(anchor_guid, parent_guid,
|
39
|
+
parent_relationship_type_name, parent_at_end1,
|
40
|
+
display_name, description, collection_type,
|
41
|
+
is_own_anchor)
|
42
|
+
# Create first folder for Agriculture Insights
|
43
|
+
parent_guid = "97bbfe07-6696-4550-bf8b-6b577d25bef0"
|
44
|
+
parent_relationship_type_name = "CollectionMembership"
|
45
|
+
display_name = "Agriculture Insights Collection"
|
46
|
+
description = "A folder for agricultural insights data product collections"
|
47
|
+
collection_type = "Digital Product Marketplace"
|
48
|
+
|
49
|
+
folder1 = c_client.create_folder_collection(None, parent_guid,
|
50
|
+
parent_relationship_type_name,
|
51
|
+
True, display_name, description,
|
52
|
+
collection_type, True, "DATE_CREATED",
|
53
|
+
None
|
54
|
+
)
|
55
|
+
print(f"\n\n created a folder with guid {folder1}")
|
56
|
+
# create second folder for Earth Observations
|
57
|
+
display_name = "Earth Observation Data Collection"
|
58
|
+
description = "A folder for Earth Observation data product collections"
|
59
|
+
|
60
|
+
folder2 = c_client.create_folder_collection(None, parent_guid,
|
61
|
+
parent_relationship_type_name,
|
62
|
+
True, display_name, description,
|
63
|
+
collection_type, True, "DATE_CREATED",
|
64
|
+
None
|
65
|
+
)
|
66
|
+
print(f"\n\n created a folder with guid {folder2}")
|
67
|
+
|
68
|
+
# create a digital product, child of folder 1, for Land Use products
|
69
|
+
parent_guid = folder1
|
70
|
+
parent_relationship_type_name = "CollectionMembership"
|
71
|
+
display_name = "Land Use Classification"
|
72
|
+
description = "Land use classification assets"
|
73
|
+
collection_type = "Digital Product"
|
74
|
+
classification_name = "Digital Product"
|
75
|
+
body_3 = {
|
76
|
+
"class": "NewDigitalProductRequestBody",
|
77
|
+
"isOwnAnchor": True,
|
78
|
+
"parentGUID": parent_guid,
|
79
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
80
|
+
"parentAtEnd1": True,
|
81
|
+
"collectionProperties": {
|
82
|
+
"class": "CollectionProperties",
|
83
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
84
|
+
"name": display_name,
|
85
|
+
"description": description,
|
86
|
+
"collectionType": collection_type,
|
87
|
+
"collectionOrdering": "DATE_CREATED",
|
88
|
+
},
|
89
|
+
"digitalProductProperties": {
|
90
|
+
"class": "DigitalProductProperties",
|
91
|
+
"productStatus": "ACTIVE",
|
92
|
+
"productName": "Land Use Classifications",
|
93
|
+
"productType": "Geospatial Data Assets",
|
94
|
+
"description": "Land use classification assets",
|
95
|
+
"introductionDate": "2023-12-01",
|
96
|
+
"maturity": "Nacent",
|
97
|
+
"serviceLife": "3 years",
|
98
|
+
"currentVersion": "V.5",
|
99
|
+
"nextVersionDate": "2024-12-01",
|
100
|
+
"withdrawDate": "2030-01-01",
|
101
|
+
"additionalProperties": {
|
102
|
+
"thought_id": "a guid",
|
103
|
+
"license": "cc-by-sa",
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
folder3 = c_client.create_digital_product(body_3)
|
108
|
+
print(f"\n\n created a collection with guid {folder3}")
|
109
|
+
|
110
|
+
# create a fourth collection, a digital product, child of folder 2, for Landsat 8
|
111
|
+
parent_guid = folder2
|
112
|
+
display_name = "Landsat 8"
|
113
|
+
description = "Landsat 8 data products"
|
114
|
+
|
115
|
+
body_4 = {
|
116
|
+
"class": "NewDigitalProductRequestBody",
|
117
|
+
"isOwnAnchor": True,
|
118
|
+
"parentGUID": parent_guid,
|
119
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
120
|
+
"parentAtEnd1": True,
|
121
|
+
"collectionProperties": {
|
122
|
+
"class": "CollectionProperties",
|
123
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
124
|
+
"name": display_name,
|
125
|
+
"description": description,
|
126
|
+
"collectionType": collection_type,
|
127
|
+
"collectionOrdering": "DATE_CREATED",
|
128
|
+
},
|
129
|
+
"digitalProductProperties": {
|
130
|
+
"class": "DigitalProductProperties",
|
131
|
+
"productStatus": "ACTIVE",
|
132
|
+
"productName": "Landsat 8 Imagery",
|
133
|
+
"productType": "Geospatial Data Assets",
|
134
|
+
"description": description,
|
135
|
+
"introductionDate": "2024-01-01",
|
136
|
+
"maturity": "Mature",
|
137
|
+
"serviceLife": "3 years",
|
138
|
+
"currentVersion": "V1.5",
|
139
|
+
"nextVersion": "2024-06-01",
|
140
|
+
"withdrawDate": "2030-01-01",
|
141
|
+
"additionalProperties": {
|
142
|
+
"thought_id": "a guid",
|
143
|
+
"license": "cc-by-sa",
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
folder4 = c_client.create_digital_product(body_4)
|
148
|
+
print(f"\n\n created a collection with guid {folder4}")
|
149
|
+
|
150
|
+
# Now create a 5th collection for sentinel 2 data
|
151
|
+
parent_guid = folder2
|
152
|
+
display_name = "Sentinel 2"
|
153
|
+
description = "Sentinel 2 products"
|
154
|
+
parent_relationship_type_name = "CollectionMembership"
|
155
|
+
collection_type = "Digital Product Marketplace"
|
156
|
+
|
157
|
+
folder5 = c_client.create_folder_collection(None, parent_guid,
|
158
|
+
parent_relationship_type_name,
|
159
|
+
True, display_name, description,
|
160
|
+
collection_type, True, "DATE_CREATED",
|
161
|
+
None
|
162
|
+
)
|
163
|
+
# Create a DigitalProduct for Level-1B
|
164
|
+
parent_guid = folder5
|
165
|
+
display_name = "Sentinel 2 - Level 1B"
|
166
|
+
description = "Level 1B of Sentinel 2"
|
167
|
+
|
168
|
+
body_6 = {
|
169
|
+
"class": "NewDigitalProductRequestBody",
|
170
|
+
"anchor_guid": parent_guid,
|
171
|
+
"isOwnAnchor": False,
|
172
|
+
"parentGUID": parent_guid,
|
173
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
174
|
+
"parentAtEnd1": True,
|
175
|
+
"collectionProperties": {
|
176
|
+
"class": "CollectionProperties",
|
177
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
178
|
+
"name": display_name,
|
179
|
+
"description": description,
|
180
|
+
"collectionType": collection_type,
|
181
|
+
"collectionOrdering": "DATE_CREATED",
|
182
|
+
},
|
183
|
+
"digitalProductProperties": {
|
184
|
+
"class": "DigitalProductProperties",
|
185
|
+
"productStatus": "ACTIVE",
|
186
|
+
"productName": "Sentinel 2 - Level 1B",
|
187
|
+
"productType": "Geospatial Data Assets",
|
188
|
+
"description": description,
|
189
|
+
"introductionDate": "2024-01-01",
|
190
|
+
"maturity": "Mature",
|
191
|
+
"serviceLife": "3 years",
|
192
|
+
"currentVersion": "V1.5",
|
193
|
+
"nextVersion": "2024-06-01",
|
194
|
+
"withdrawDate": "2030-01-01",
|
195
|
+
"additionalProperties": {
|
196
|
+
"thought_id": "a guid",
|
197
|
+
"license": "cc-by-sa",
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
folder6 = c_client.create_digital_product(body_6)
|
202
|
+
print(f"\n\n created a collection with guid {folder6}")
|
203
|
+
|
204
|
+
# now lets create a digital product for - Level - 1c
|
205
|
+
parent_guid = folder5
|
206
|
+
display_name = "Sentinel 2 - Level 1C"
|
207
|
+
description = "Level 1C of Sentinel 2"
|
208
|
+
body_7 = {
|
209
|
+
"class": "NewDigitalProductRequestBody",
|
210
|
+
"anchor_guid": parent_guid,
|
211
|
+
"isOwnAnchor": False,
|
212
|
+
"parentGUID": parent_guid,
|
213
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
214
|
+
"parentAtEnd1": True,
|
215
|
+
"collectionProperties": {
|
216
|
+
"class": "CollectionProperties",
|
217
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
218
|
+
"name": display_name,
|
219
|
+
"description": description,
|
220
|
+
"collectionType": collection_type,
|
221
|
+
"collectionOrdering": "DATE_CREATED",
|
222
|
+
},
|
223
|
+
"digitalProductProperties": {
|
224
|
+
"class": "DigitalProductProperties",
|
225
|
+
"productStatus": "ACTIVE",
|
226
|
+
"productName": "Sentinel 2 - Level 1B",
|
227
|
+
"productType": "Geospatial Data Assets",
|
228
|
+
"description": description,
|
229
|
+
"introductionDate": "2024-01-01",
|
230
|
+
"maturity": "Mature",
|
231
|
+
"serviceLife": "3 years",
|
232
|
+
"currentVersion": "V1.5",
|
233
|
+
"nextVersion": "2024-06-01",
|
234
|
+
"withdrawDate": "2030-01-01",
|
235
|
+
"additionalProperties": {
|
236
|
+
"thought_id": "a guid",
|
237
|
+
"license": "cc-by-sa",
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
folder7 = c_client.create_digital_product(body_7)
|
242
|
+
print(f"\n\n created a collection with guid {folder7}")
|
243
|
+
|
244
|
+
# now let's create a digital product for - Level - 2A
|
245
|
+
parent_guid = folder5
|
246
|
+
display_name = "Sentinel 2 - Level 2A"
|
247
|
+
description = "Level 2A of Sentinel 2"
|
248
|
+
body_8 = {
|
249
|
+
"class": "NewDigitalProductRequestBody",
|
250
|
+
"anchor_guid": parent_guid,
|
251
|
+
"isOwnAnchor": False,
|
252
|
+
"parentGUID": parent_guid,
|
253
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
254
|
+
"parentAtEnd1": True,
|
255
|
+
"collectionProperties": {
|
256
|
+
"class": "CollectionProperties",
|
257
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
258
|
+
"name": display_name,
|
259
|
+
"description": description,
|
260
|
+
"collectionType": collection_type,
|
261
|
+
"collectionOrdering": "DATE_CREATED",
|
262
|
+
},
|
263
|
+
"digitalProductProperties": {
|
264
|
+
"class": "DigitalProductProperties",
|
265
|
+
"productStatus": "ACTIVE",
|
266
|
+
"productName": "Sentinel 2 - Level 1B",
|
267
|
+
"productType": "Geospatial Data Assets",
|
268
|
+
"description": description,
|
269
|
+
"introductionDate": "2024-01-01",
|
270
|
+
"maturity": "Mature",
|
271
|
+
"serviceLife": "3 years",
|
272
|
+
"currentVersion": "V1.5",
|
273
|
+
"nextVersion": "2024-06-01",
|
274
|
+
"withdrawDate": "2030-01-01",
|
275
|
+
"additionalProperties": {
|
276
|
+
"thought_id": "a guid",
|
277
|
+
"license": "cc-by-sa",
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}
|
281
|
+
folder8 = c_client.create_digital_product(body_8)
|
282
|
+
print(f"\n\n created a collection with guid {folder8}")
|
283
|
+
|
284
|
+
except (
|
285
|
+
InvalidParameterException,
|
286
|
+
PropertyServerException,
|
287
|
+
UserNotAuthorizedException
|
288
|
+
) as e:
|
289
|
+
console.print_exception(show_locals=True)
|
290
|
+
|
291
|
+
finally:
|
292
|
+
c_client.close_session()
|
@@ -0,0 +1,115 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
This sample creates a collection structure for a sustainability reporting project. It is
|
6
|
+
simplistic but shows how we can set up a collection hierarchy that can hold different kinds of
|
7
|
+
assets.
|
8
|
+
|
9
|
+
"""
|
10
|
+
|
11
|
+
import time
|
12
|
+
|
13
|
+
from rich import print
|
14
|
+
from rich.console import Console
|
15
|
+
|
16
|
+
from pyegeria import CollectionManager, InvalidParameterException, PropertyServerException, UserNotAuthorizedException
|
17
|
+
|
18
|
+
view_server = 'view-server'
|
19
|
+
platform_url = 'https://localhost:9443'
|
20
|
+
user = 'erinoverview'
|
21
|
+
console = Console()
|
22
|
+
|
23
|
+
try:
|
24
|
+
c_client = CollectionManager(view_server, platform_url,
|
25
|
+
user_id=user)
|
26
|
+
|
27
|
+
token = c_client.create_egeria_bearer_token(user, "secret")
|
28
|
+
start_time = time.perf_counter()
|
29
|
+
|
30
|
+
# Create a root collection for the sustainability project
|
31
|
+
parent_guid = None
|
32
|
+
parent_relationship_type_name = None
|
33
|
+
display_name = "Root Sustainability Collection"
|
34
|
+
description = "The root collection for our sustainability reporting project."
|
35
|
+
collection_type = "Sustainability Collection"
|
36
|
+
|
37
|
+
root = c_client.create_root_collection(None, parent_guid,
|
38
|
+
parent_relationship_type_name,
|
39
|
+
False, display_name, description,
|
40
|
+
collection_type, True)
|
41
|
+
print(f"\n\n created a root with guid {root}")
|
42
|
+
# create a folder for Scope 1 Emissions
|
43
|
+
anchor_guid = root
|
44
|
+
parent_guid = root
|
45
|
+
parent_relationship_type_name = "CollectionMembership"
|
46
|
+
display_name = "Scope 1 Emissions"
|
47
|
+
description = "A folder for information about scope 1 emissions."
|
48
|
+
collection_type = "Sustainability Collection"
|
49
|
+
|
50
|
+
scope1_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
51
|
+
parent_relationship_type_name,
|
52
|
+
True, display_name, description,
|
53
|
+
collection_type, False, "DATE_CREATED",
|
54
|
+
None
|
55
|
+
)
|
56
|
+
print(f"\n\n created scope1_folder with guid {scope1_folder}")
|
57
|
+
|
58
|
+
# create a folder for Scope 2 Emissions.
|
59
|
+
anchor_guid = root
|
60
|
+
parent_guid = root
|
61
|
+
parent_relationship_type_name = "CollectionMembership"
|
62
|
+
display_name = "Scope 2 Emissions"
|
63
|
+
description = "A folder for information about scope 2 emissions."
|
64
|
+
collection_type = "Sustainability Collection"
|
65
|
+
|
66
|
+
scope2_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
67
|
+
parent_relationship_type_name,
|
68
|
+
True, display_name, description,
|
69
|
+
collection_type, False, "DATE_CREATED",
|
70
|
+
None
|
71
|
+
)
|
72
|
+
print(f"\n\n created scope2_folder with guid {scope2_folder}")
|
73
|
+
|
74
|
+
# create a folder for Scope 3 Emissions.
|
75
|
+
anchor_guid = root
|
76
|
+
parent_guid = root
|
77
|
+
parent_relationship_type_name = "CollectionMembership"
|
78
|
+
display_name = "Scope 3 Emissions"
|
79
|
+
description = "A folder for information about scope 3 emissions."
|
80
|
+
collection_type = "Sustainability Collection"
|
81
|
+
|
82
|
+
scope3_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
83
|
+
parent_relationship_type_name,
|
84
|
+
True, display_name, description,
|
85
|
+
collection_type, False, "DATE_CREATED",
|
86
|
+
None
|
87
|
+
)
|
88
|
+
print(f"\n\n created scope3_folder with guid {scope3_folder}")
|
89
|
+
|
90
|
+
# create a folder for Business Travel Emissions.
|
91
|
+
anchor_guid = root
|
92
|
+
parent_guid = scope3_folder
|
93
|
+
parent_relationship_type_name = "CollectionMembership"
|
94
|
+
display_name = "Business Travel Emissions"
|
95
|
+
description = "A folder for information about scope 3 business travel emissions."
|
96
|
+
collection_type = "Sustainability Collection"
|
97
|
+
|
98
|
+
travel_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
99
|
+
parent_relationship_type_name,
|
100
|
+
True, display_name, description,
|
101
|
+
collection_type, False, "DATE_CREATED",
|
102
|
+
None
|
103
|
+
)
|
104
|
+
print(f"\n\n created travel_folder with guid {travel_folder}")
|
105
|
+
|
106
|
+
|
107
|
+
except (
|
108
|
+
InvalidParameterException,
|
109
|
+
PropertyServerException,
|
110
|
+
UserNotAuthorizedException
|
111
|
+
) as e:
|
112
|
+
console.print_exception(show_locals=True)
|
113
|
+
|
114
|
+
finally:
|
115
|
+
c_client.close_session()
|