Menu

#43 Prevent wrongly ordered negated ordinary predicates.

open
nobody
None
5
2008-02-24
2008-02-24
baz bishop
No

Rule-safety restrictions are relaxed slightly (by default) to allow variables that occur only in negated predicates, e.g. ?Y in the following:

p(X) :- q(X), not r(X, Y).

However, it is also possible to evaluate this rule in this order:

p(X) :- not r(X, Y), q(X)

which will produce different results.

Impose the restriction in the rule compiler such that negated predicates can not be compiled (i.e. must be saved to later in the rule) if the negated predicate contains variable that also appear in elsewhere in the rule.

However, care must be taken. First it must be decided what this rule means:

p(X) :- q(X), not r(Y), not s(Y)

which is considered a safe rule, but the meaning of "not r(Y), not s(Y)" is unclear. Does it mean: remove those all tuples produced by q(X) if any tuples exist in r() or s()

Or does it mean: remove those all tuples produced by q(X) if there are any tuples that exist in both r() and s(), i.e. a join across r(Y) and s(Y).

Discussion


Log in to post a comment.

MongoDB Logo MongoDB