Skip to content

Commit 0282805

Browse files
authored
Merge pull request #188 from Knowledge-Graph-Hub/187-build-fails-due-to-keyerror-broad_synonyms
Repair synonym column names in transform
2 parents db62434 + b88aa50 commit 0282805

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

kg_phenio/transform_utils/phenio/phenio_node_sources.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,28 @@
8484

8585
# Extend the class with additional attributes:
8686
# * subsets
87-
# * broad_synonyms
88-
# * exact_synonyms
89-
# * narrow_synonyms
90-
# * related_synonyms
87+
# * broad_synonym
88+
# * exact_synonym
89+
# * narrow_synonym
90+
# * related_synonym
9191
class NodeClass(base_class):
9292
"""Node class with additional attributes for subsets and synonyms."""
9393

9494
subsets: Optional[List[str]] = Field(
9595
default=None, description="""Subsets the node belongs to, defined by its source""")
96-
broad_synonyms: Optional[List[str]] = Field(
96+
broad_synonym: Optional[List[str]] = Field(
9797
default=None,
9898
description="""Broad synonyms for the node, defined by its source""",
9999
)
100-
exact_synonyms: Optional[List[str]] = Field(
100+
exact_synonym: Optional[List[str]] = Field(
101101
default=None,
102102
description="""Exact synonyms for the node, defined by its source""",
103103
)
104-
narrow_synonyms: Optional[List[str]] = Field(
104+
narrow_synonym: Optional[List[str]] = Field(
105105
default=None,
106106
description="""Narrow synonyms for the node, defined by its source""",
107107
)
108-
related_synonyms: Optional[List[str]] = Field(
108+
related_synonym: Optional[List[str]] = Field(
109109
default=None,
110110
description="""Related synonyms for the node, defined by its source""",
111111
)
@@ -140,15 +140,15 @@ class NodeClass(base_class):
140140
node.xref = xrefs
141141

142142
for synonym_type in ["broad", "exact", "narrow", "related"]:
143-
if row[f"{synonym_type}_synonyms"]:
144-
these_synonyms = (row[f"{synonym_type}_synonyms"]).split("|")
143+
if row[f"{synonym_type}_synonym"]:
144+
these_synonyms = (row[f"{synonym_type}_synonym"]).split("|")
145145
if synonym_type == "broad":
146-
node.broad_synonyms = these_synonyms
146+
node.broad_synonym = these_synonyms
147147
elif synonym_type == "exact":
148-
node.exact_synonyms = these_synonyms
148+
node.exact_synonym = these_synonyms
149149
elif synonym_type == "narrow":
150-
node.narrow_synonyms = these_synonyms
150+
node.narrow_synonym = these_synonyms
151151
elif synonym_type == "related":
152-
node.related_synonyms = these_synonyms
152+
node.related_synonym = these_synonyms
153153

154154
koza_app.write(node)

kg_phenio/transform_utils/phenio/phenio_node_sources.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ columns:
1717
- 'xref'
1818
- 'provided_by'
1919
- 'synonym'
20-
- 'broad_synonyms'
20+
- 'broad_synonym'
2121
- 'deprecated'
22-
- 'exact_synonyms'
22+
- 'exact_synonym'
2323
- 'iri'
24-
- 'narrow_synonyms'
24+
- 'narrow_synonym'
2525
- 'same_as'
26-
- 'related_synonyms'
26+
- 'related_synonym'
2727
- 'subsets'
2828

2929
node_properties:
@@ -38,9 +38,9 @@ node_properties:
3838
- 'iri'
3939
- 'same_as'
4040
- 'subsets'
41-
- 'broad_synonyms'
42-
- 'exact_synonyms'
43-
- 'narrow_synonyms'
44-
- 'related_synonyms'
41+
- 'broad_synonym'
42+
- 'exact_synonym'
43+
- 'narrow_synonym'
44+
- 'related_synonym'
4545

4646
transform_mode: 'flat'

0 commit comments

Comments
 (0)