otlmow-template 0.6__tar.gz → 0.8__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.
- {otlmow_template-0.6 → otlmow_template-0.8}/PKG-INFO +2 -2
- {otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template/SubsetTemplateCreator.py +24 -17
- {otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template.egg-info/PKG-INFO +2 -2
- {otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template.egg-info/requires.txt +1 -1
- {otlmow_template-0.6 → otlmow_template-0.8}/pyproject.toml +2 -2
- {otlmow_template-0.6 → otlmow_template-0.8}/LICENSE +0 -0
- {otlmow_template-0.6 → otlmow_template-0.8}/README.md +0 -0
- {otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template/CsvTemplateCreator.py +0 -0
- {otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template/ExcelTemplateCreator.py +0 -0
- {otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template/Exceptions/MissingTypeUriException.py +0 -0
- {otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template/__init__.py +0 -0
- {otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template.egg-info/SOURCES.txt +0 -0
- {otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template.egg-info/dependency_links.txt +0 -0
- {otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template.egg-info/top_level.txt +0 -0
- {otlmow_template-0.6 → otlmow_template-0.8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: otlmow_template
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8
|
|
4
4
|
Author-email: David Vlaminck <david.vlaminck@mow.vlaanderen.be>, Jasper Berton <jasperberton1@telenet.be>
|
|
5
5
|
License: GNU GENERAL PUBLIC LICENSE
|
|
6
6
|
Version 3, 29 June 2007
|
|
@@ -697,7 +697,7 @@ Classifier: Topic :: Software Development :: Quality Assurance
|
|
|
697
697
|
Requires-Python: >=3.9
|
|
698
698
|
Description-Content-Type: text/markdown
|
|
699
699
|
License-File: LICENSE
|
|
700
|
-
Requires-Dist: otlmow-converter>=
|
|
700
|
+
Requires-Dist: otlmow-converter>=1.7
|
|
701
701
|
Requires-Dist: otlmow-modelbuilder>=0.24
|
|
702
702
|
|
|
703
703
|
# OTLMOW-Template
|
|
@@ -41,15 +41,17 @@ class SubsetTemplateCreator:
|
|
|
41
41
|
return collector
|
|
42
42
|
|
|
43
43
|
def generate_template_from_subset(self, path_to_subset: Path, path_to_template_file_and_extension: Path,
|
|
44
|
-
ignore_relations: bool = True,
|
|
44
|
+
ignore_relations: bool = True, filter_attributes_by_subset: bool = True,
|
|
45
|
+
**kwargs):
|
|
45
46
|
tempdir = Path(tempfile.gettempdir()) / 'temp-otlmow'
|
|
46
47
|
if not tempdir.exists():
|
|
47
48
|
os.makedirs(tempdir)
|
|
48
49
|
test = ntpath.basename(path_to_template_file_and_extension)
|
|
49
50
|
temporary_path = Path(tempdir) / test
|
|
50
|
-
instantiated_attributes = self.generate_basic_template(
|
|
51
|
+
instantiated_attributes = (self.generate_basic_template(
|
|
51
52
|
path_to_subset=path_to_subset, temporary_path=temporary_path, ignore_relations=ignore_relations,
|
|
52
|
-
path_to_template_file_and_extension=path_to_template_file_and_extension,
|
|
53
|
+
path_to_template_file_and_extension=path_to_template_file_and_extension,
|
|
54
|
+
filter_attributes_by_subset=filter_attributes_by_subset, **kwargs))
|
|
53
55
|
extension = os.path.splitext(path_to_template_file_and_extension)[-1].lower()
|
|
54
56
|
if extension == '.xlsx':
|
|
55
57
|
self.alter_excel_template(path_to_template_file_and_extension=path_to_template_file_and_extension,
|
|
@@ -68,8 +70,9 @@ class SubsetTemplateCreator:
|
|
|
68
70
|
list_of_otl_objectUri = None
|
|
69
71
|
if kwargs is not None:
|
|
70
72
|
list_of_otl_objectUri = kwargs.get('list_of_otl_objectUri', None)
|
|
73
|
+
collector = self._load_collector_from_subset_path(path_to_subset=path_to_subset)
|
|
71
74
|
filtered_class_list = self.filters_classes_by_subset(
|
|
72
|
-
|
|
75
|
+
collector=collector, list_of_otl_objectUri=list_of_otl_objectUri)
|
|
73
76
|
otl_objects = []
|
|
74
77
|
amount_of_examples = kwargs.get('amount_of_examples', 0)
|
|
75
78
|
model_directory = None
|
|
@@ -77,25 +80,29 @@ class SubsetTemplateCreator:
|
|
|
77
80
|
model_directory = kwargs.get('model_directory', None)
|
|
78
81
|
relation_dict = get_hardcoded_relation_dict(model_directory=model_directory)
|
|
79
82
|
|
|
83
|
+
generate_dummy_records = 1
|
|
84
|
+
if amount_of_examples > 1:
|
|
85
|
+
generate_dummy_records = amount_of_examples
|
|
86
|
+
|
|
80
87
|
for class_object in [cl for cl in filtered_class_list if cl.abstract == 0]:
|
|
81
88
|
if ignore_relations and class_object.objectUri in relation_dict:
|
|
82
89
|
continue
|
|
83
|
-
|
|
84
|
-
if amount_of_examples != 0:
|
|
85
|
-
for _ in range(amount_of_examples):
|
|
86
|
-
instance = dynamic_create_instance_from_uri(class_object.objectUri, model_directory=model_directory)
|
|
87
|
-
if instance is None:
|
|
88
|
-
continue
|
|
89
|
-
instance.fill_with_dummy_data()
|
|
90
|
-
otl_objects.append(instance)
|
|
91
|
-
else:
|
|
90
|
+
for _ in range(generate_dummy_records):
|
|
92
91
|
instance = dynamic_create_instance_from_uri(class_object.objectUri, model_directory=model_directory)
|
|
93
92
|
if instance is None:
|
|
94
93
|
continue
|
|
95
|
-
|
|
94
|
+
attributen = collector.find_attributes_by_class(class_object)
|
|
95
|
+
for attribute_object in attributen:
|
|
96
|
+
attr = getattr(instance, '_' + attribute_object.name)
|
|
97
|
+
attr.fill_with_dummy_data()
|
|
98
|
+
try:
|
|
99
|
+
geo_attr = getattr(instance, '_geometry')
|
|
100
|
+
geo_attr.fill_with_dummy_data()
|
|
101
|
+
except AttributeError:
|
|
102
|
+
pass
|
|
96
103
|
otl_objects.append(instance)
|
|
97
104
|
|
|
98
|
-
|
|
105
|
+
DotnotationHelper.clear_list_of_list_attributes(instance)
|
|
99
106
|
|
|
100
107
|
converter = OtlmowConverter()
|
|
101
108
|
converter.from_objects_to_file(file_path=temporary_path,
|
|
@@ -150,11 +157,11 @@ class SubsetTemplateCreator:
|
|
|
150
157
|
[f.unlink() for f in Path(file_location).glob("*") if f.is_file()]
|
|
151
158
|
|
|
152
159
|
@classmethod
|
|
153
|
-
def filters_classes_by_subset(cls,
|
|
160
|
+
def filters_classes_by_subset(cls, collector: OSLOCollector,
|
|
161
|
+
list_of_otl_objectUri: [str] = None) -> list[OSLOClass]:
|
|
154
162
|
if list_of_otl_objectUri is None:
|
|
155
163
|
list_of_otl_objectUri = []
|
|
156
164
|
|
|
157
|
-
collector = cls._load_collector_from_subset_path(path_to_subset=path_to_subset)
|
|
158
165
|
if list_of_otl_objectUri == []:
|
|
159
166
|
return collector.classes
|
|
160
167
|
return [x for x in collector.classes if x.objectUri in list_of_otl_objectUri]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: otlmow_template
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8
|
|
4
4
|
Author-email: David Vlaminck <david.vlaminck@mow.vlaanderen.be>, Jasper Berton <jasperberton1@telenet.be>
|
|
5
5
|
License: GNU GENERAL PUBLIC LICENSE
|
|
6
6
|
Version 3, 29 June 2007
|
|
@@ -697,7 +697,7 @@ Classifier: Topic :: Software Development :: Quality Assurance
|
|
|
697
697
|
Requires-Python: >=3.9
|
|
698
698
|
Description-Content-Type: text/markdown
|
|
699
699
|
License-File: LICENSE
|
|
700
|
-
Requires-Dist: otlmow-converter>=
|
|
700
|
+
Requires-Dist: otlmow-converter>=1.7
|
|
701
701
|
Requires-Dist: otlmow-modelbuilder>=0.24
|
|
702
702
|
|
|
703
703
|
# OTLMOW-Template
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
otlmow-converter>=
|
|
1
|
+
otlmow-converter>=1.7
|
|
2
2
|
otlmow-modelbuilder>=0.24
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "otlmow_template"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.8"
|
|
8
8
|
authors = [{name = "David Vlaminck", email = "david.vlaminck@mow.vlaanderen.be"},
|
|
9
9
|
{name = "Jasper Berton", email = "jasperberton1@telenet.be"},]
|
|
10
10
|
readme = "README.md"
|
|
@@ -29,7 +29,7 @@ classifiers = [
|
|
|
29
29
|
]
|
|
30
30
|
requires-python = ">=3.9"
|
|
31
31
|
dependencies = [
|
|
32
|
-
'otlmow-converter >=
|
|
32
|
+
'otlmow-converter >= 1.7',
|
|
33
33
|
'otlmow-modelbuilder >= 0.24',
|
|
34
34
|
]
|
|
35
35
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{otlmow_template-0.6 → otlmow_template-0.8}/otlmow_template/Exceptions/MissingTypeUriException.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|