bnop 0.2.0__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.
- bnop-0.2.0/LICENSE.md +21 -0
- bnop-0.2.0/PKG-INFO +61 -0
- bnop-0.2.0/README.md +49 -0
- bnop-0.2.0/bnop/__init__.py +0 -0
- bnop-0.2.0/bnop/bnop_facades.py +307 -0
- bnop-0.2.0/bnop/bnop_io/__init__.py +0 -0
- bnop-0.2.0/bnop/bnop_io/shelve_bnop.py +42 -0
- bnop-0.2.0/bnop/core/__init__.py +0 -0
- bnop-0.2.0/bnop/core/factories/__init__.py +0 -0
- bnop-0.2.0/bnop/core/factories/bnop_element_factories.py +16 -0
- bnop-0.2.0/bnop/core/factories/bnop_name_factories.py +22 -0
- bnop-0.2.0/bnop/core/factories/bnop_object_factories.py +29 -0
- bnop-0.2.0/bnop/core/factories/bnop_placeabletype_factories.py +22 -0
- bnop-0.2.0/bnop/core/factories/bnop_tuple_factories.py +25 -0
- bnop-0.2.0/bnop/core/factories/bnop_type_factories.py +26 -0
- bnop-0.2.0/bnop/core/factories/bnop_type_place_factories.py +26 -0
- bnop-0.2.0/bnop/core/object_model/__init__.py +0 -0
- bnop-0.2.0/bnop/core/object_model/bnop_repositories.py +4 -0
- bnop-0.2.0/bnop/core/object_model/objects/__init__.py +0 -0
- bnop-0.2.0/bnop/core/object_model/objects/bnop_elements.py +26 -0
- bnop-0.2.0/bnop/core/object_model/objects/bnop_names.py +29 -0
- bnop-0.2.0/bnop/core/object_model/objects/bnop_objects.py +86 -0
- bnop-0.2.0/bnop/core/object_model/objects/bnop_placeable_types.py +32 -0
- bnop-0.2.0/bnop/core/object_model/objects/bnop_representations.py +24 -0
- bnop-0.2.0/bnop/core/object_model/objects/bnop_tuples.py +33 -0
- bnop-0.2.0/bnop/core/object_model/objects/bnop_type_places.py +34 -0
- bnop-0.2.0/bnop/core/object_model/objects/bnop_types.py +7 -0
- bnop-0.2.0/bnop/core/object_model/objects/places/__init__.py +0 -0
- bnop-0.2.0/bnop/core/object_model/objects/places/bnop_placed_objects_dictionaries.py +35 -0
- bnop-0.2.0/bnop/core/object_model/objects/places/bnop_placed_types_dictionaries.py +35 -0
- bnop-0.2.0/bnop/infrastructure/__init__.py +0 -0
- bnop-0.2.0/bnop/infrastructure/names.py +55 -0
- bnop-0.2.0/bnop/infrastructure/translators.py +33 -0
- bnop-0.2.0/bnop/mappings/__init__.py +0 -0
- bnop-0.2.0/bnop/mappings/boro_object_ckid_mappings.py +54 -0
- bnop-0.2.0/bnop/migrations/__init__.py +0 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/__init__.py +0 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/adders/__init__.py +0 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/adders/bnop_name_xml_adder.py +89 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/adders/bnop_object_xml_adder.py +120 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/adders/bnop_xml_named_objects_adder.py +42 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/adders/bnop_xml_names_adder.py +36 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/bnop_xml_write_orchestrator.py +42 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/common_knowledge/__init__.py +0 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/common_knowledge/bnop_to_xml_migration_configurations.py +6 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/common_knowledge/vanilla_bnop_to_xml_migration_configurations.py +27 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/sorters/__init__.py +0 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/sorters/bnop_name_sorters.py +31 -0
- bnop-0.2.0/bnop/migrations/bnop_to_xml_migration/xml_bnop_registers.py +133 -0
- bnop-0.2.0/pyproject.toml +14 -0
bnop-0.2.0/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 BORO Solutions Ltd.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
bnop-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: bnop
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: a common top level ontology for bCLEARer based on BORO.
|
|
5
|
+
Author: Mesbah Khan
|
|
6
|
+
Author-email: khanm@ontoledgy.io
|
|
7
|
+
Requires-Python: >=3.12,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# BNOP
|
|
13
|
+
|
|
14
|
+
BNOP is a reference library containing the code for the BNOP Domain (BORO Native Objects (Python)).
|
|
15
|
+
|
|
16
|
+
**This project is currently closed, but may be sporadically updated by the BORO Development Team in the future.**
|
|
17
|
+
|
|
18
|
+
## Execution
|
|
19
|
+
|
|
20
|
+
* This code is a library, so not to be run on its own.
|
|
21
|
+
|
|
22
|
+
## Usage Examples
|
|
23
|
+
|
|
24
|
+
For examples see usages in the following projects:
|
|
25
|
+
|
|
26
|
+
* https://github.com/boro-alpha/bclearer_boson_1_1.git
|
|
27
|
+
|
|
28
|
+
## Documentation
|
|
29
|
+
|
|
30
|
+
#### Background
|
|
31
|
+
|
|
32
|
+
The Agile Manifesto prefers “working software over comprehensive documentation”. Robert C. Martin, one of the original authors of the Agile Manifesto, is also the author of the book Clean Code.
|
|
33
|
+
|
|
34
|
+
In this book, he makes a strong case for code being self-documenting: saying things such as "always try to explain yourself in code."
|
|
35
|
+
|
|
36
|
+
He suggests that the goal of every programmer should be to write code so clean and expressive that code comments are unnecessary.
|
|
37
|
+
|
|
38
|
+
When a programmer writes a comment, it will usually mean that they have failed to write code that was expressive enough. At the extreme, he suggests, maybe a little rhetorically, that "comments are always failures".
|
|
39
|
+
|
|
40
|
+
#### The BORO documentation policy
|
|
41
|
+
|
|
42
|
+
To aim to write code so clean and expressive that code comments are unnecessary.
|
|
43
|
+
|
|
44
|
+
## Contributing
|
|
45
|
+
|
|
46
|
+
This package doesn't allow external contributors.
|
|
47
|
+
|
|
48
|
+
## Liability and Warranty
|
|
49
|
+
|
|
50
|
+
This code is provided as-is and without warranty.
|
|
51
|
+
|
|
52
|
+
Under no circumstances will the developers be liable for any incidental, consequential, or indirect damages including but not limited to lost or damaged data, revenue loss, economic loss, or commercial loss arising out of the use of this code.
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
57
|
+
|
|
58
|
+
## Acknowledgements
|
|
59
|
+
|
|
60
|
+
This work was developed initially by BORO Solutions (https://www.borosolutions.net/) and has been updated as part of the Information Management Framework to support the [National Digital Twin programme](https://www.cdbb.cam.ac.uk/what-we-do/national-digital-twin-programme), and funded by [Department for Business, Energy & Industrial Strategy](https://www.gov.uk/government/organisations/department-for-business-energy-and-industrial-strategy) through the Centre for the Protection of National Infrastructure.
|
|
61
|
+
|
bnop-0.2.0/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# BNOP
|
|
2
|
+
|
|
3
|
+
BNOP is a reference library containing the code for the BNOP Domain (BORO Native Objects (Python)).
|
|
4
|
+
|
|
5
|
+
**This project is currently closed, but may be sporadically updated by the BORO Development Team in the future.**
|
|
6
|
+
|
|
7
|
+
## Execution
|
|
8
|
+
|
|
9
|
+
* This code is a library, so not to be run on its own.
|
|
10
|
+
|
|
11
|
+
## Usage Examples
|
|
12
|
+
|
|
13
|
+
For examples see usages in the following projects:
|
|
14
|
+
|
|
15
|
+
* https://github.com/boro-alpha/bclearer_boson_1_1.git
|
|
16
|
+
|
|
17
|
+
## Documentation
|
|
18
|
+
|
|
19
|
+
#### Background
|
|
20
|
+
|
|
21
|
+
The Agile Manifesto prefers “working software over comprehensive documentation”. Robert C. Martin, one of the original authors of the Agile Manifesto, is also the author of the book Clean Code.
|
|
22
|
+
|
|
23
|
+
In this book, he makes a strong case for code being self-documenting: saying things such as "always try to explain yourself in code."
|
|
24
|
+
|
|
25
|
+
He suggests that the goal of every programmer should be to write code so clean and expressive that code comments are unnecessary.
|
|
26
|
+
|
|
27
|
+
When a programmer writes a comment, it will usually mean that they have failed to write code that was expressive enough. At the extreme, he suggests, maybe a little rhetorically, that "comments are always failures".
|
|
28
|
+
|
|
29
|
+
#### The BORO documentation policy
|
|
30
|
+
|
|
31
|
+
To aim to write code so clean and expressive that code comments are unnecessary.
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
This package doesn't allow external contributors.
|
|
36
|
+
|
|
37
|
+
## Liability and Warranty
|
|
38
|
+
|
|
39
|
+
This code is provided as-is and without warranty.
|
|
40
|
+
|
|
41
|
+
Under no circumstances will the developers be liable for any incidental, consequential, or indirect damages including but not limited to lost or damaged data, revenue loss, economic loss, or commercial loss arising out of the use of this code.
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
46
|
+
|
|
47
|
+
## Acknowledgements
|
|
48
|
+
|
|
49
|
+
This work was developed initially by BORO Solutions (https://www.borosolutions.net/) and has been updated as part of the Information Management Framework to support the [National Digital Twin programme](https://www.cdbb.cam.ac.uk/what-we-do/national-digital-twin-programme), and funded by [Department for Business, Energy & Industrial Strategy](https://www.gov.uk/government/organisations/department-for-business-energy-and-industrial-strategy) through the Centre for the Protection of National Infrastructure.
|
|
File without changes
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
from bclearer_core.ckids.boro_object_ckids import (
|
|
2
|
+
BoroObjectCkIds,
|
|
3
|
+
)
|
|
4
|
+
from bclearer_core.ckids.place_number_type_ckids import (
|
|
5
|
+
PlaceNumberTypeCkIds,
|
|
6
|
+
)
|
|
7
|
+
from bclearer_orchestration_services.identification_services.uuid_service.uuid_helpers.uuid_factory import (
|
|
8
|
+
create_new_uuid,
|
|
9
|
+
)
|
|
10
|
+
from bnop.core.factories.bnop_element_factories import (
|
|
11
|
+
BnopElementFactories,
|
|
12
|
+
)
|
|
13
|
+
from bnop.core.factories.bnop_name_factories import (
|
|
14
|
+
BnopNameFactories,
|
|
15
|
+
)
|
|
16
|
+
from bnop.core.factories.bnop_object_factories import (
|
|
17
|
+
BnopObjectFactories,
|
|
18
|
+
)
|
|
19
|
+
from bnop.core.factories.bnop_placeabletype_factories import (
|
|
20
|
+
BnopPlaceableTypeFactories,
|
|
21
|
+
)
|
|
22
|
+
from bnop.core.factories.bnop_tuple_factories import (
|
|
23
|
+
BnopTupleFactories,
|
|
24
|
+
)
|
|
25
|
+
from bnop.core.factories.bnop_type_factories import (
|
|
26
|
+
BnopTypeFactories,
|
|
27
|
+
)
|
|
28
|
+
from bnop.core.factories.bnop_type_place_factories import (
|
|
29
|
+
BnopTypePlaceFactories,
|
|
30
|
+
)
|
|
31
|
+
from bnop.core.object_model.objects.bnop_names import (
|
|
32
|
+
BnopNames,
|
|
33
|
+
)
|
|
34
|
+
from bnop.core.object_model.objects.bnop_objects import (
|
|
35
|
+
BnopObjects,
|
|
36
|
+
)
|
|
37
|
+
from bnop.core.object_model.objects.places.bnop_placed_objects_dictionaries import (
|
|
38
|
+
BnopPlacedObjectsDictionaries,
|
|
39
|
+
)
|
|
40
|
+
from bnop.core.object_model.objects.places.bnop_placed_types_dictionaries import (
|
|
41
|
+
BnopPlacedTypesDictionaries,
|
|
42
|
+
)
|
|
43
|
+
from bnop.migrations.bnop_to_xml_migration.bnop_xml_write_orchestrator import (
|
|
44
|
+
orchestrate_xml_write,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class BnopFacades:
|
|
49
|
+
|
|
50
|
+
@staticmethod
|
|
51
|
+
def write_bnop_object_to_xml(
|
|
52
|
+
xml_file_path: str,
|
|
53
|
+
):
|
|
54
|
+
orchestrate_xml_write(
|
|
55
|
+
xml_file_path=xml_file_path
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
@staticmethod
|
|
59
|
+
def create_new_bnop_type(
|
|
60
|
+
owning_repository_uuid,
|
|
61
|
+
):
|
|
62
|
+
bnop_type = (
|
|
63
|
+
BnopTypeFactories.create(
|
|
64
|
+
create_new_uuid(),
|
|
65
|
+
owning_repository_uuid,
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
return bnop_type
|
|
70
|
+
|
|
71
|
+
@staticmethod
|
|
72
|
+
def create_bnop_object(
|
|
73
|
+
object_uuid,
|
|
74
|
+
owning_repository_uuid,
|
|
75
|
+
presentation_name=str(),
|
|
76
|
+
):
|
|
77
|
+
bnop_object = BnopObjectFactories.create(
|
|
78
|
+
object_uuid,
|
|
79
|
+
owning_repository_uuid,
|
|
80
|
+
presentation_name=presentation_name,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return bnop_object
|
|
84
|
+
|
|
85
|
+
@staticmethod
|
|
86
|
+
def create_bnop_type(
|
|
87
|
+
type_uuid,
|
|
88
|
+
owning_repository_uuid,
|
|
89
|
+
presentation_name=str(),
|
|
90
|
+
):
|
|
91
|
+
bnop_type = BnopTypeFactories.create(
|
|
92
|
+
type_uuid,
|
|
93
|
+
owning_repository_uuid,
|
|
94
|
+
presentation_name=presentation_name,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
return bnop_type
|
|
98
|
+
|
|
99
|
+
@staticmethod
|
|
100
|
+
def create_new_bnop_element(
|
|
101
|
+
owning_repository_uuid,
|
|
102
|
+
):
|
|
103
|
+
bnop_element = (
|
|
104
|
+
BnopElementFactories.create(
|
|
105
|
+
create_new_uuid(),
|
|
106
|
+
owning_repository_uuid,
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return bnop_element
|
|
111
|
+
|
|
112
|
+
@staticmethod
|
|
113
|
+
def create_bnop_element(
|
|
114
|
+
element_uuid,
|
|
115
|
+
owning_repository_uuid,
|
|
116
|
+
):
|
|
117
|
+
bnop_element = (
|
|
118
|
+
BnopElementFactories.create(
|
|
119
|
+
element_uuid,
|
|
120
|
+
owning_repository_uuid,
|
|
121
|
+
)
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
return bnop_element
|
|
125
|
+
|
|
126
|
+
@staticmethod
|
|
127
|
+
def create_new_bnop_name(
|
|
128
|
+
exemplar_representation,
|
|
129
|
+
owning_repository_uuid,
|
|
130
|
+
):
|
|
131
|
+
bnop_name = (
|
|
132
|
+
BnopNameFactories.create(
|
|
133
|
+
create_new_uuid(),
|
|
134
|
+
exemplar_representation,
|
|
135
|
+
owning_repository_uuid,
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
return bnop_name
|
|
140
|
+
|
|
141
|
+
@staticmethod
|
|
142
|
+
def create_bnop_name(
|
|
143
|
+
name_uuid,
|
|
144
|
+
exemplar_representation,
|
|
145
|
+
owning_repository_uuid,
|
|
146
|
+
presentation_name=str(),
|
|
147
|
+
):
|
|
148
|
+
bnop_name = BnopNameFactories.create(
|
|
149
|
+
name_uuid,
|
|
150
|
+
exemplar_representation,
|
|
151
|
+
owning_repository_uuid,
|
|
152
|
+
presentation_name=presentation_name,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
return bnop_name
|
|
156
|
+
|
|
157
|
+
@staticmethod
|
|
158
|
+
def create_new_bnop_tuple_from_two_placed_objects(
|
|
159
|
+
placed1_object,
|
|
160
|
+
placed2_object,
|
|
161
|
+
immutable_minor_composition_couple_type_boro_object_ckid,
|
|
162
|
+
owning_repository_uuid,
|
|
163
|
+
):
|
|
164
|
+
tuple_placed_objects_dictionary = (
|
|
165
|
+
BnopPlacedObjectsDictionaries()
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
tuple_placed_objects_dictionary.add_tuple_placed_object_to_dictionary(
|
|
169
|
+
PlaceNumberTypeCkIds.PlaceNumberOnes,
|
|
170
|
+
placed1_object,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
tuple_placed_objects_dictionary.add_tuple_placed_object_to_dictionary(
|
|
174
|
+
PlaceNumberTypeCkIds.PlaceNumberTwos,
|
|
175
|
+
placed2_object,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
bnop_tuple = BnopTupleFactories.create(
|
|
179
|
+
create_new_uuid(),
|
|
180
|
+
tuple_placed_objects_dictionary,
|
|
181
|
+
immutable_minor_composition_couple_type_boro_object_ckid,
|
|
182
|
+
owning_repository_uuid,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
return bnop_tuple
|
|
186
|
+
|
|
187
|
+
@staticmethod
|
|
188
|
+
def create_bnop_tuple_from_two_placed_objects(
|
|
189
|
+
tuple_uuid,
|
|
190
|
+
placed1_object: BnopObjects,
|
|
191
|
+
placed2_object: BnopObjects,
|
|
192
|
+
immutable_minor_composition_couple_type_boro_object_ckid: BoroObjectCkIds,
|
|
193
|
+
owning_repository_uuid,
|
|
194
|
+
):
|
|
195
|
+
tuple_placed_objects_dictionary = (
|
|
196
|
+
BnopPlacedObjectsDictionaries()
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
tuple_placed_objects_dictionary.add_tuple_placed_object_to_dictionary(
|
|
200
|
+
PlaceNumberTypeCkIds.PlaceNumberOnes,
|
|
201
|
+
placed1_object,
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
tuple_placed_objects_dictionary.add_tuple_placed_object_to_dictionary(
|
|
205
|
+
PlaceNumberTypeCkIds.PlaceNumberTwos,
|
|
206
|
+
placed2_object,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
bnop_tuple = BnopTupleFactories.create(
|
|
210
|
+
tuple_uuid,
|
|
211
|
+
tuple_placed_objects_dictionary,
|
|
212
|
+
immutable_minor_composition_couple_type_boro_object_ckid,
|
|
213
|
+
owning_repository_uuid,
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
if (
|
|
217
|
+
immutable_minor_composition_couple_type_boro_object_ckid
|
|
218
|
+
== BoroObjectCkIds.SuperSubTypes
|
|
219
|
+
):
|
|
220
|
+
placed2_object.supertypes.add(
|
|
221
|
+
placed1_object
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
placed1_object.subtypes.add(
|
|
225
|
+
placed2_object
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
if (
|
|
229
|
+
immutable_minor_composition_couple_type_boro_object_ckid
|
|
230
|
+
== BoroObjectCkIds.NamedBy
|
|
231
|
+
):
|
|
232
|
+
placed1_object.is_named_bys.add(
|
|
233
|
+
placed2_object
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
placed2_object.names.add(
|
|
237
|
+
placed1_object
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
if (
|
|
241
|
+
immutable_minor_composition_couple_type_boro_object_ckid
|
|
242
|
+
== BoroObjectCkIds.TypesInstances
|
|
243
|
+
):
|
|
244
|
+
placed2_object.types.add(
|
|
245
|
+
placed1_object
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
placed1_object.instances.add(
|
|
249
|
+
placed2_object
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
if (
|
|
253
|
+
type(placed2_object)
|
|
254
|
+
is BnopNames
|
|
255
|
+
):
|
|
256
|
+
placed2_object.naming_spaces.add(
|
|
257
|
+
placed1_object
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
return bnop_tuple
|
|
261
|
+
|
|
262
|
+
@staticmethod
|
|
263
|
+
def create_bnop_placeabletype(
|
|
264
|
+
placeabletype_uuid,
|
|
265
|
+
owning_repository_uuid,
|
|
266
|
+
presentation_name=str(),
|
|
267
|
+
):
|
|
268
|
+
placeable_type_placed_type_dictionary = (
|
|
269
|
+
BnopPlacedTypesDictionaries()
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
bnop_placeabletype = BnopPlaceableTypeFactories.create(
|
|
273
|
+
placeabletype_uuid,
|
|
274
|
+
placeable_type_placed_type_dictionary,
|
|
275
|
+
owning_repository_uuid,
|
|
276
|
+
presentation_name=presentation_name,
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
return bnop_placeabletype
|
|
280
|
+
|
|
281
|
+
@staticmethod
|
|
282
|
+
def create_bnop_type_place(
|
|
283
|
+
type_place_uuid,
|
|
284
|
+
placing_type,
|
|
285
|
+
placed_type,
|
|
286
|
+
type_place_ckid,
|
|
287
|
+
owning_repository_uuid,
|
|
288
|
+
):
|
|
289
|
+
bnop_type_place = BnopTypePlaceFactories.create(
|
|
290
|
+
type_place_uuid,
|
|
291
|
+
placing_type,
|
|
292
|
+
placed_type,
|
|
293
|
+
type_place_ckid,
|
|
294
|
+
owning_repository_uuid,
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
return bnop_type_place
|
|
298
|
+
|
|
299
|
+
@staticmethod
|
|
300
|
+
def __add_placed_type_to_placeabletype(
|
|
301
|
+
placed_type,
|
|
302
|
+
place_number_ckid,
|
|
303
|
+
placeable_type,
|
|
304
|
+
):
|
|
305
|
+
placeable_type.placeable_type_placed_types_dictionary[
|
|
306
|
+
place_number_ckid
|
|
307
|
+
] = placed_type
|
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import shelve
|
|
2
|
+
|
|
3
|
+
from bnop.core.object_model.objects.bnop_objects import (
|
|
4
|
+
BnopObjects,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def write_bnop(full_filename: str):
|
|
9
|
+
bnop_shelf = shelve.open(
|
|
10
|
+
full_filename
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
bnop_shelf.clear_xml_model_branches()
|
|
14
|
+
|
|
15
|
+
for (
|
|
16
|
+
key,
|
|
17
|
+
value,
|
|
18
|
+
) in (
|
|
19
|
+
BnopObjects.registry_keyed_on_uuid.items()
|
|
20
|
+
):
|
|
21
|
+
bnop_shelf[key] = value
|
|
22
|
+
|
|
23
|
+
bnop_shelf.close()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def read_bnop(full_filename: str):
|
|
27
|
+
bnop_shelf = shelve.open(
|
|
28
|
+
full_filename
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
for (
|
|
32
|
+
key,
|
|
33
|
+
value,
|
|
34
|
+
) in bnop_shelf.items():
|
|
35
|
+
print(
|
|
36
|
+
"Key: "
|
|
37
|
+
+ key
|
|
38
|
+
+ " - Type: "
|
|
39
|
+
+ str(type(value).__name__)
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
bnop_shelf.close()
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from bnop.core.object_model.objects.bnop_elements import (
|
|
2
|
+
BnopElements,
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BnopElementFactories:
|
|
7
|
+
|
|
8
|
+
@staticmethod
|
|
9
|
+
def create(
|
|
10
|
+
uuid, owning_repository_uuid
|
|
11
|
+
):
|
|
12
|
+
bnop_element = BnopElements(
|
|
13
|
+
uuid, owning_repository_uuid
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
return bnop_element
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from bnop.core.object_model.objects.bnop_names import (
|
|
2
|
+
BnopNames,
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BnopNameFactories:
|
|
7
|
+
|
|
8
|
+
@staticmethod
|
|
9
|
+
def create(
|
|
10
|
+
uuid,
|
|
11
|
+
exemplar_representation,
|
|
12
|
+
owning_repository_uuid,
|
|
13
|
+
presentation_name=str(),
|
|
14
|
+
):
|
|
15
|
+
bnop_name = BnopNames(
|
|
16
|
+
uuid,
|
|
17
|
+
exemplar_representation,
|
|
18
|
+
owning_repository_uuid,
|
|
19
|
+
presentation_name=presentation_name,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
return bnop_name
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from bclearer_core.ckids.boro_object_ckids import (
|
|
2
|
+
BoroObjectCkIds,
|
|
3
|
+
)
|
|
4
|
+
from bnop.core.object_model.objects.bnop_objects import (
|
|
5
|
+
BnopObjects,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BnopObjectFactories:
|
|
10
|
+
def __init__(self):
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def create(
|
|
15
|
+
uuid,
|
|
16
|
+
owning_repository_uuid,
|
|
17
|
+
presentation_name=str(),
|
|
18
|
+
):
|
|
19
|
+
bnop_object = BnopObjects(
|
|
20
|
+
uuid,
|
|
21
|
+
owning_repository_uuid,
|
|
22
|
+
presentation_name=presentation_name,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
bnop_object.add_to_registry_keyed_on_ckid_type(
|
|
26
|
+
BoroObjectCkIds.Objects
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
return bnop_object
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from bnop.core.object_model.objects.bnop_placeable_types import (
|
|
2
|
+
BnopPlaceableTypes,
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BnopPlaceableTypeFactories:
|
|
7
|
+
|
|
8
|
+
@staticmethod
|
|
9
|
+
def create(
|
|
10
|
+
uuid,
|
|
11
|
+
placeable_type_placed_types_dictionary,
|
|
12
|
+
owning_repository_uuid,
|
|
13
|
+
presentation_name=str(),
|
|
14
|
+
):
|
|
15
|
+
bnop_placeabletype = BnopPlaceableTypes(
|
|
16
|
+
uuid,
|
|
17
|
+
placeable_type_placed_types_dictionary,
|
|
18
|
+
owning_repository_uuid,
|
|
19
|
+
presentation_name=presentation_name,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
return bnop_placeabletype
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from bclearer_core.ckids.boro_object_ckids import (
|
|
2
|
+
BoroObjectCkIds,
|
|
3
|
+
)
|
|
4
|
+
from bnop.core.object_model.objects.bnop_tuples import (
|
|
5
|
+
BnopTuples,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BnopTupleFactories:
|
|
10
|
+
|
|
11
|
+
@staticmethod
|
|
12
|
+
def create(
|
|
13
|
+
uuid,
|
|
14
|
+
tuple_placed_objects_dictionary,
|
|
15
|
+
immutable_minor_composition_couple_type_boro_object_ckid: BoroObjectCkIds,
|
|
16
|
+
owning_repository_uuid,
|
|
17
|
+
):
|
|
18
|
+
bnop_tuple = BnopTuples(
|
|
19
|
+
uuid,
|
|
20
|
+
tuple_placed_objects_dictionary,
|
|
21
|
+
immutable_minor_composition_couple_type_boro_object_ckid,
|
|
22
|
+
owning_repository_uuid,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
return bnop_tuple
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from bnop.core.factories.bnop_object_factories import (
|
|
2
|
+
BnopObjectFactories,
|
|
3
|
+
)
|
|
4
|
+
from bnop.core.object_model.objects.bnop_types import (
|
|
5
|
+
BnopTypes,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BnopTypeFactories(
|
|
10
|
+
BnopObjectFactories
|
|
11
|
+
):
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
@staticmethod
|
|
15
|
+
def create(
|
|
16
|
+
uuid,
|
|
17
|
+
owning_repository_uuid,
|
|
18
|
+
presentation_name=str(),
|
|
19
|
+
):
|
|
20
|
+
bnop_type = BnopTypes(
|
|
21
|
+
uuid,
|
|
22
|
+
owning_repository_uuid,
|
|
23
|
+
presentation_name=presentation_name,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
return bnop_type
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from bnop.core.object_model.objects.bnop_type_places import (
|
|
2
|
+
BnopTypePlaces,
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BnopTypePlaceFactories:
|
|
7
|
+
|
|
8
|
+
@staticmethod
|
|
9
|
+
def create(
|
|
10
|
+
uuid,
|
|
11
|
+
placing_type,
|
|
12
|
+
placed_type,
|
|
13
|
+
type_place_ckid,
|
|
14
|
+
owning_repository_uuid,
|
|
15
|
+
):
|
|
16
|
+
bnop_type_place = (
|
|
17
|
+
BnopTypePlaces(
|
|
18
|
+
uuid,
|
|
19
|
+
placing_type,
|
|
20
|
+
placed_type,
|
|
21
|
+
type_place_ckid,
|
|
22
|
+
owning_repository_uuid,
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
return bnop_type_place
|
|
File without changes
|
|
File without changes
|