Skip to content

Commit

Permalink
Merge pull request #259 from biolink/sssom
Browse files Browse the repository at this point in the history
Assign default category to nodes when incoming category is invalid
  • Loading branch information
deepakunni3 authored Feb 23, 2021
2 parents 14ea8c1 + edb5f5b commit d5bac10
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions kgx/transformers/sssom_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,15 @@ def load_edge(self, edge: Dict) -> None:
for k, v in edge.items():
if k in SSSOM_NODE_PROPERTY_MAPPING:
if k.startswith('subject'):
subject_node[SSSOM_NODE_PROPERTY_MAPPING[k]] = v
mapped_k = SSSOM_NODE_PROPERTY_MAPPING[k]
if mapped_k == 'category' and not PrefixManager.is_curie(v):
v = f"biolink:OntologyClass"
subject_node[mapped_k] = v
elif k.startswith('object'):
object_node[SSSOM_NODE_PROPERTY_MAPPING[k]] = v
mapped_k = SSSOM_NODE_PROPERTY_MAPPING[k]
if mapped_k == 'category' and not PrefixManager.is_curie(v):
v = f"biolink:OntologyClass"
object_node[mapped_k] = v
else:
log.info(f"Ignoring {k} {v}")
else:
Expand Down

0 comments on commit d5bac10

Please sign in to comment.