mirror of
https://github.com/morluto/rea.git
synced 2026-11-13 18:22:42 +00:00
fix(javascript): preserve candidate trace ambiguity
This commit is contained in:
1 parent
b3939ea9ff
commit
8678b57b5e
3 files changed
+35
No files matched your search
@@ -102,6 +102,11 @@ export const queryJavaScriptSemanticGraph = (
|
||||
traversal.nodeIds,
|
||||
input,
|
||||
);
|
||||
const candidateRelations = relevantCandidateRelationCount(
|
||||
graph,
|
||||
traversal.nodeIds,
|
||||
input,
|
||||
);
|
||||
const expectedMatches = expectedMatchesFor(
|
||||
retainedNodes,
|
||||
retainedRelations,
|
||||
@@ -115,6 +120,7 @@ export const queryJavaScriptSemanticGraph = (
|
||||
hasExpectation: input.expected !== null,
|
||||
frontier,
|
||||
unknowns: relevantUnknowns,
|
||||
candidateRelations,
|
||||
});
|
||||
const nextOffset = offset + pageRelations.length;
|
||||
const nextCursor =
|
||||
@@ -543,6 +549,24 @@ const relevantUnknownFrontiers = (
|
||||
);
|
||||
};
|
||||
|
||||
const relevantCandidateRelationCount = (
|
||||
graph: JavaScriptSemanticGraph,
|
||||
nodeIds: ReadonlySet<string>,
|
||||
input: JavaScriptSemanticQueryInput,
|
||||
): number => {
|
||||
const allowed =
|
||||
input.allowed_relations === undefined
|
||||
? null
|
||||
: new Set(input.allowed_relations);
|
||||
return graph.relations.filter(
|
||||
(relation) =>
|
||||
relation.resolution === "candidate" &&
|
||||
(allowed === null || allowed.has(relation.relation)) &&
|
||||
(nodeIds.has(relation.source_node_id) ||
|
||||
nodeIds.has(relation.target_node_id)),
|
||||
).length;
|
||||
};
|
||||
|
||||
const expectedMatchesFor = (
|
||||
nodes: readonly JavaScriptSemanticGraphNode[],
|
||||
relations: readonly JavaScriptSemanticGraphRelation[],
|
||||
|
||||
Reference in new issue
Block a user