From 46a5e4f8b16434263259a6dc5b0ea7f916173a9f Mon Sep 17 00:00:00 2001 From: tokebe <43009413+tokebe@users.noreply.github.com> Date: Tue, 6 Aug 2024 16:52:52 -0400 Subject: [PATCH] fix: handle undefined cases --- src/inferred_mode/inferred_mode.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/inferred_mode/inferred_mode.ts b/src/inferred_mode/inferred_mode.ts index e6bc1a8a..3054de0d 100644 --- a/src/inferred_mode/inferred_mode.ts +++ b/src/inferred_mode/inferred_mode.ts @@ -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: [] }] };