Skip to content

Commit cf62ec5

Browse files
committed
Update api.py
1 parent f90885d commit cf62ec5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/semra/api.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,9 @@ def prioritize(
566566
}
567567
# Gather all the references by CURIE
568568
curie_to_reference: dict[str, Reference] = {
569-
reference.curie: reference for mapping in mappings for reference in (mapping.subject, mapping.object)
569+
reference.curie: reference
570+
for mapping in mappings
571+
for reference in (mapping.subject, mapping.object)
570572
}
571573

572574
exact_mappings = len(mappings)
@@ -581,8 +583,7 @@ def prioritize(
581583
o = get_priority_reference(component_references, priority)
582584
if o is None:
583585
continue
584-
for s_curie in component:
585-
s = curie_to_reference[s_curie]
586+
for s in component_references:
586587
if s == o: # don't add self-edges
587588
continue
588589
if not graph.has_edge(s, o):
@@ -594,7 +595,7 @@ def prioritize(
594595
"that in a given component, it is a full clique (i.e., there are edges "
595596
"in both directions between all nodes)"
596597
)
597-
rv.append(mappings_by_subj_obj[s_curie, o.curie])
598+
rv.append(mappings_by_subj_obj[s.curie, o.curie])
598599

599600
# sort such that the mappings are ordered by object by priority order
600601
# then identifier of object, then subject prefix in alphabetical order

0 commit comments

Comments
 (0)