translation from Datalog to SQL -
i still thinking on how translate recursivity of datalog program sql, such as
p(x,y) <- q(x,y). q(x,y) <- p(x,z), a(y).
where a/1
edb predicate. this, there co-dependency between p
, q
. longer queries, how solve problem?
moreover, there system implement translation? if there is, may know system or paper may refer?
if adopt approach of "tabling" previous conclusions , forward-chain reasoning on these infer new conclusions, no recursive "depth" required.
bear in mind datalog requires restrictions on rules , variable assure finite termination , hence finitely many conclusions. variables must have finite range of possible values, example.
let's assume example refers constants rather variables:
p(x,y) <- q(x,y). q(x,y) <- p(x,z), a(y).
one wrinkle want a/1
implemented extended stored procedure or external code. propose tabling results of calling a
on possible arguments (finitely many). these after among conclusions (provable statements) of system.
once done forward-chaining inference proceeds iteratively rather recursively. @ each step consider each rule, applying premises (right-hand sides) obtained (tabled) conclusions if produces new conclusion. if no rule produces new conclusion in current step, halt. proof procedure complete.
in example proofs stop after a
facts adduced, because there no conclusions sufficient apply either rule new conclusions.
Comments
Post a Comment