karmaresearch / vlog

Apache License 2.0
55 stars 9 forks source link

Incomplete Derivation from a Datalog Rule Set #62

Closed smennicke closed 3 years ago

smennicke commented 3 years ago

Consider the following program:

edb.conf:

EDB0_predname=t
EDB0_type=INMEMORY
EDB0_param0=.
EDB0_param1=t

t.csv:

1,a,3
3,b,4
3,c,4

rules:

q(Y,X) :- t(X,b,Y)
p(X,Z) :- t(X,a,Y), t(Y,c,Z)
r(X,Z) :- q(Y,Z), p(X,Y)

After running ./vlog mat --edb edb.conf --storemat_path . --storemat_format csv --decompressmat 1 --rules rules I can see all predicates being materialized, especially r:

1,3

which is the expected result. If, however, I change the last rule by switching the order of the body atoms, i.e., rules1:

q(Y,X) :- t(X,b,Y)
p(X,Z) :- t(X,a,Y), t(Y,c,Z)
r(X,Z) :- p(X,Y), q(Y,Z)

the call ./vlog mat --edb edb.conf --storemat_path . --storemat_format csv --decompressmat 1 --rules rules1, yields no materialization of r, whereas it should produce the same as before.

I have tested this case with and without debug mode from commit ee8267a.

CerielJacobs commented 3 years ago

I think I fixed this issue. @smennicke can you please check?

smennicke commented 3 years ago

Yes, I think it is fixed now. I have checked with the original example as well as a similar one. Thank you!