Skip to content

Commit

Permalink
edits
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Oct 31, 2023
1 parent 756f062 commit ecd01f8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/hdmf/common/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,14 +686,14 @@ def add_ref(self, **kwargs):
# If so, just reuse the key.
key_exists = False
key_idx_matches = self.keys.which(key=key)
for row_idx in self.object_keys.which(objects_idx=object_field.idx):
key_idx = self.object_keys['keys_idx', row_idx]
# breakpoint()
if key_idx in key_idx_matches:
key_exists = True # Make sure we don't add the key.
# Automatically resolve the key for keys associated with
# the same object.
key = self.keys.row[key_idx]
if len(key_idx_matches)!=0:
for row_idx in self.object_keys.which(objects_idx=object_field.idx):
key_idx = self.object_keys['keys_idx', row_idx]
if key_idx in key_idx_matches:
key_exists = True # Make sure we don't add the key.
# Automatically resolve the key for keys associated with
# the same object.
key = self.keys.row[key_idx]

if not key_exists:
key = self._add_key(key)
Expand All @@ -702,11 +702,11 @@ def add_ref(self, **kwargs):
# When using a Key Object, we want to still check for whether the key
# has been used with the Object object. If not, add it to ObjectKeyTable.
# If so, do nothing and add_object_key remains False.
obj_key_exists = False
key_idx = key.idx
object_key_row_idx = self.object_keys.which(keys_idx=key_idx)
if len(object_key_row_idx)!=0:
# this means there exists rows where the key is in the ObjectKeyTable
obj_key_exists = False
for row_idx in object_key_row_idx:
obj_idx = self.object_keys['objects_idx', row_idx]
if obj_idx == object_field.idx:
Expand All @@ -721,11 +721,11 @@ def add_ref(self, **kwargs):

if check_entity_key:
# check for entity-key relationship in EntityKeyTable
entity_key_check = False
key_idx = key.idx
entity_key_row_idx = self.entity_keys.which(keys_idx=key_idx)
if len(entity_key_row_idx)!=0:
# this means there exists rows where the key is in the EntityKeyTable
entity_key_check = False
for row_idx in entity_key_row_idx:
entity_idx = self.entity_keys['entities_idx', row_idx]
if entity_idx == entity.idx:
Expand Down

0 comments on commit ecd01f8

Please sign in to comment.