Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate Discourse Context queries #293

Open
mdroidian opened this issue Nov 27, 2024 · 0 comments
Open

Duplicate Discourse Context queries #293

mdroidian opened this issue Nov 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mdroidian
Copy link
Collaborator

If a relation has multiple definitions

image

We are filtering them from all relations

relations
.flatMap((r) => {
const queries = [];
if (r.source === nodeType || r.source === "*") {
queries.push({
r,
complement: false,
});
}
if (r.destination === nodeType || r.destination === "*") {
queries.push({
r,
complement: true,
});
}
return queries;

But in the datalog translator we are doing this again when we build the query

const filteredRelations = discourseRelations
.map((r) =>
(r.label === label || ANY_RELATION_REGEX.test(label)) &&
doesDiscourseRelationMatchCondition(r, { source, target })
? { ...r, forward: true }
: doesDiscourseRelationMatchCondition(
{ source: r.destination, destination: r.source },
{ source, target }
) &&
(r.complement === label || ANY_RELATION_REGEX.test(label))
? { ...r, forward: false }
: undefined
)
.filter(
(
r
): r is ReturnType<typeof getDiscourseRelations>[number] & {
forward: boolean;
} => !!r
);
if (!filteredRelations.length) return [];
const andParts = filteredRelations.map(

Resulting in multiple duplicate queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant