Skip to content

Commit

Permalink
Remove inference of OC metadata properties when setting groups and la…
Browse files Browse the repository at this point in the history
…bels (#578)
  • Loading branch information
michaelnchin authored Mar 30, 2024
1 parent 028c4ff commit 272cedf
Show file tree
Hide file tree
Showing 2 changed files with 258 additions and 20 deletions.
14 changes: 7 additions & 7 deletions src/graph_notebook/network/opencypher/OCNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ def get_node_property_value(self, node: dict, props: dict, title, custom_propert
label = props[custom_property[0]][custom_property[1]]
else:
label = title
elif custom_property in [ID_KEY, 'id']:
elif custom_property == ID_KEY:
label = node[ID_KEY]
elif custom_property in [LABEL_KEY, 'label']:
elif custom_property == LABEL_KEY:
label = node[LABEL_KEY]
elif custom_property in [VERTEX_TYPE_KEY, 'type']:
elif custom_property == VERTEX_TYPE_KEY:
label = node[VERTEX_TYPE_KEY]
elif custom_property in props:
label = props[custom_property]
Expand Down Expand Up @@ -140,9 +140,9 @@ def parse_node(self, node: dict, path_index: int = -2):
group = depth_group
elif self.group_by_property == DEFAULT_RAW_GRP_KEY:
group = str(node)
elif self.group_by_property in [LABEL_KEY, 'labels'] and len(node[LABEL_KEY]) > 0:
elif self.group_by_property == LABEL_KEY and len(node[LABEL_KEY]) > 0:
group = node[LABEL_KEY][0]
elif self.group_by_property in [ID_KEY, 'id']:
elif self.group_by_property == ID_KEY:
group = node[ID_KEY]
elif self.group_by_property in node[PROPERTIES_KEY]:
group = node[PROPERTIES_KEY][self.group_by_property]
Expand All @@ -158,9 +158,9 @@ def parse_node(self, node: dict, path_index: int = -2):
group = depth_group
elif self.group_by_property[key] == DEFAULT_RAW_GRP_KEY:
group = str(node)
elif self.group_by_property[key] in [LABEL_KEY, 'labels']:
elif self.group_by_property[key] == LABEL_KEY:
group = node[LABEL_KEY][0]
elif self.group_by_property[key] in [ID_KEY, 'id']:
elif self.group_by_property[key] == ID_KEY:
group = node[ID_KEY]
else:
group = node[PROPERTIES_KEY][self.group_by_property[key]]
Expand Down
Loading

0 comments on commit 272cedf

Please sign in to comment.