Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Aug 6, 2024
2 parents 3afe25f + 46a5e4f commit 7d66134
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
7 changes: 2 additions & 5 deletions src/edge_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,8 @@ export default class QueryEdgeManager {
const objectIDs = [record.object.original, record.object.curie, ...record.object.equivalentCuries];

// there must be at least a minimal intersection
const subjectMatch =
subjectIDs.some((curie) => execSubjectCuries.includes(curie)) || execSubjectCuries.length === 0;
const objectMatch = objectIDs.some((curie) => execObjectCuries.includes(curie)) || execObjectCuries.length === 0;

//if both ends match then keep record
const subjectMatch = subjectIDs.some((curie) => execSubjectCuries.includes(curie));
const objectMatch = objectIDs.some((curie) => execObjectCuries.includes(curie));

// Don't keep self-edges
const selfEdge = [...subjectIDs].some((curie) => objectIDs.includes(curie));
Expand Down
12 changes: 6 additions & 6 deletions src/inferred_mode/inferred_mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,21 +337,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 7d66134

Please sign in to comment.