Skip to content

Datalog rule bodies silently ignore ["not-exists", …] — rules derive as if the negation weren't there #1786

Closed

Description

@aaj3f

The JSON-LD query docs present ["not-exists", {…}] as a
where-clause pattern, and datalog rule bodies are documented as "FQL where".
In query position not-exists works; inside a RULE body (query-time rules,
stored f:rule, and cross-ledger f:rulesSource) it is silently ignored —
no error, the rule simply fires as if the clause were absent.

Repro (fluree 4.1.6, local CLI, any ledger with three nodes typed
ex:Qualification where exactly two have ex:posture "own"):

{ "select": ["?q"], "where": {"@id": "?q", "ex:probe": true},
  "reasoning": "datalog",
  "rules": [{ "@context": {"ex": "http://example.org/"},
    "where": [ {"@id": "?q", "@type": "ex:Qualification"},
               ["not-exists", {"@id": "?q", "ex:posture": "own"}] ],
    "insert": {"@id": "?q", "ex:probe": true} }] }

Expected: only the node without posture "own". Actual: all three derive.
Multiple not-exists clauses behave the same. Positive patterns and
["filter", …] in the same body work correctly.

Expected behavior: either correlated negation support (with stratification
guard) or a LOUD rejection of not-exists in rule bodies. Silent dropping is
the worst outcome — derivations are wrong with no signal. (We hit this
compiling first-match rank semantics; workaround: closed-world complement
facts, viable only because our vocabulary is closed.)

Related: #1781/#1782/#1783 (same audit family, different subsystem).

Activity

  1. added
    bug
    P1
    area:transact
    on Sep 3, 2026
  2. added a commit that references this issue on Sep 29, 2026
    e4e1b43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1area:transactbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions