Skip to content

Commit

Permalink
Keep edge provenance (#94)
Browse files Browse the repository at this point in the history
* Update kgx.py

* Update kgx.py

* Update kgx.py

can't delete edge keys while looping over them.

* just collect then update

* Update requirements.txt (#93)
  • Loading branch information
YaphetKG authored Jan 4, 2024
1 parent 3cfe3f5 commit 21889ed
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dags/roger/models/kgx.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,13 @@ def merge(self):
edges['subject'] + edges['predicate'] +
edges['object'] +
edges.get("biolink:primary_knowledge_source", ""))
keys_to_del = set()
for key in edges:
if key.startswith('biolink:'):
keys_to_del.add(key)
for k in keys_to_del:
edges[k.replace('biolink:', '')] = edges[k]
del edges[k]
stream.write(json.dumps(edges).decode('utf-8') + '\n')

write_merge_metric['edges_writing_time'] = time.time() - start_edge_jsonl
Expand Down

0 comments on commit 21889ed

Please sign in to comment.