Skip to content

Commit

Permalink
Readd city term processing and don't add duplicate xref edges
Browse files Browse the repository at this point in the history
  • Loading branch information
nanglo123 committed Oct 1, 2024
1 parent 30875a7 commit 7346375
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mira/dkg/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,7 @@ def _get_edge_name(curie_: str, strict: bool = False) -> str:
if xref.value.prefix in obograph.PROVENANCE_PREFIXES:
# Don't add provenance information as xrefs
continue
edges.append(
(
xref_edge_info = (
node.curie,
xref.value.curie,
"xref",
Expand All @@ -1122,7 +1121,8 @@ def _get_edge_name(curie_: str, strict: bool = False) -> str:
graph_id,
version or "",
)
)
if xref_edge_info not in edges:
edges.append(xref_edge_info)
if xref.value.curie not in nodes:
node_sources[node.replaced_by].add(prefix)
nodes[xref.value.curie] = NodeInfo(
Expand Down
1 change: 1 addition & 0 deletions mira/dkg/resources/geonames.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def get_cities(code_to_country, code_to_admin1, code_to_admin2, *, minimum_popul
cols = ["geonames_id", "name", "synonyms", "country_code", "admin1",
"admin2", "population"]
for identifier, name, synonyms, country, admin1, admin2, population in (cities_df[cols].values):
terms[identifier] = term = Term.from_triple("geonames", identifier,name)
if synonyms and not isinstance(synonyms, float):
for synoynm in synonyms:
term.append_synonym(synoynm)
Expand Down

0 comments on commit 7346375

Please sign in to comment.