Skip to content

Commit

Permalink
fix: handle undefined cases
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Aug 6, 2024
1 parent 21792f8 commit 46a5e4f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/inferred_mode/inferred_mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,21 +316,21 @@ export default class InferredQueryHandler {
const specialHandling = [
Object.keys(result.node_bindings).length === 2, // Direct edge
// Predicate matches or is descendant
qEdge.predicates.some(
qEdge.predicates?.some(
(predicate) =>
predicate === boundEdge.predicate ||
biolink.getDescendantPredicates(predicate).includes(boundEdge.predicate),
),
) ?? false,
// All query qualifiers (if any) are accounted for (more is fine)
qEdge.qualifier_constraints.some(({ qualifier_set }) => {
qEdge.qualifier_constraints?.some(({ qualifier_set }) => {
return qualifier_set.every((queryQualifier) =>
boundEdge.qualifiers.some(
boundEdge.qualifiers?.some(
(qualifier) =>
queryQualifier.qualifier_type_id === qualifier.qualifier_type_id &&
queryQualifier.qualifier_value === qualifier.qualifier_value,
),
) ?? false,
);
}),
}) ?? false,
].every((test) => test);
if (specialHandling) {
translatedResult.analyses[0].edge_bindings = { [qEdgeID]: [{ id: boundEdgeID, attributes: [] }] };
Expand Down

0 comments on commit 46a5e4f

Please sign in to comment.