closurizer 0.7.1__py3-none-any.whl → 0.7.3__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.
- closurizer/closurizer.py +25 -8
- {closurizer-0.7.1.dist-info → closurizer-0.7.3.dist-info}/METADATA +1 -1
- closurizer-0.7.3.dist-info/RECORD +6 -0
- closurizer-0.7.1.dist-info/RECORD +0 -6
- {closurizer-0.7.1.dist-info → closurizer-0.7.3.dist-info}/WHEEL +0 -0
- {closurizer-0.7.1.dist-info → closurizer-0.7.3.dist-info}/entry_points.txt +0 -0
closurizer/closurizer.py
CHANGED
@@ -156,18 +156,35 @@ def add_closure(kg_archive: str,
|
|
156
156
|
"""
|
157
157
|
print(nodes_query)
|
158
158
|
|
159
|
+
|
159
160
|
if not dry_run:
|
160
|
-
|
161
|
-
db.
|
161
|
+
|
162
|
+
db.sql(edges_query)
|
163
|
+
|
164
|
+
edge_closure_replacements = [
|
165
|
+
f"""
|
166
|
+
list_aggregate({field}_closure, 'string_agg', '|') as {field}_closure,
|
167
|
+
list_aggregate({field}_closure_label, 'string_agg', '|') as {field}_closure_label
|
168
|
+
"""
|
169
|
+
for field in edge_fields
|
170
|
+
]
|
171
|
+
|
172
|
+
edge_closure_replacements = "REPLACE (\n" + ",\n".join(edge_closure_replacements) + ")\n"
|
173
|
+
|
174
|
+
edges_export_query = f"""
|
162
175
|
-- write denormalized_edges as tsv
|
163
|
-
copy (select * from denormalized_edges) to '{edges_output_file}' (header, delimiter '\t')
|
164
|
-
"""
|
165
|
-
|
166
|
-
db.
|
176
|
+
copy (select * {edge_closure_replacements} from denormalized_edges) to '{edges_output_file}' (header, delimiter '\t')
|
177
|
+
"""
|
178
|
+
print(edges_export_query)
|
179
|
+
db.sql(edges_export_query)
|
180
|
+
|
181
|
+
db.sql(nodes_query)
|
182
|
+
nodes_export_query = f"""
|
167
183
|
-- write denormalized_nodes as tsv
|
168
184
|
copy (select * from denormalized_nodes) to '{nodes_output_file}' (header, delimiter '\t')
|
169
|
-
"""
|
170
|
-
|
185
|
+
"""
|
186
|
+
print(nodes_export_query)
|
187
|
+
db.sql(nodes_export_query)
|
171
188
|
|
172
189
|
# Clean up extracted node & edge files
|
173
190
|
if os.path.exists(f"{node_file}"):
|
@@ -0,0 +1,6 @@
|
|
1
|
+
closurizer/cli.py,sha256=xTFscsxGDnaKoTNhn1FefRPPeldI5tZvvp3DygNai7Y,2069
|
2
|
+
closurizer/closurizer.py,sha256=rzxML6GSzVAeKdK1hq51ehvfIQ9zLYAa8YPH-IdRlJQ,7582
|
3
|
+
closurizer-0.7.3.dist-info/METADATA,sha256=VSX_LhgP-_enQvhA4e2wsxLsOEoQfQc8lZr9eDUwaOY,661
|
4
|
+
closurizer-0.7.3.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
5
|
+
closurizer-0.7.3.dist-info/entry_points.txt,sha256=MnAVu1lgP6DqDb3BZGNzVs2AnDMsp4sThi3ccWbONFo,50
|
6
|
+
closurizer-0.7.3.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
closurizer/cli.py,sha256=xTFscsxGDnaKoTNhn1FefRPPeldI5tZvvp3DygNai7Y,2069
|
2
|
-
closurizer/closurizer.py,sha256=DY3NnSaCOf3XYF_NFqS_TB3o9WZVnBviXlvI0saXlxg,7000
|
3
|
-
closurizer-0.7.1.dist-info/METADATA,sha256=S5ItMFYNZQZWBfF31M_fP9pS9LgNCFl_1QGbHU5cLKk,661
|
4
|
-
closurizer-0.7.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
5
|
-
closurizer-0.7.1.dist-info/entry_points.txt,sha256=MnAVu1lgP6DqDb3BZGNzVs2AnDMsp4sThi3ccWbONFo,50
|
6
|
-
closurizer-0.7.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|