Souffle query returning zero results

95 Views Asked by At

I am writing a Souffle query that operates on family relationships:

.decl Parent(x: symbol, y: symbol)
.input Parent

.decl Descendant(x: symbol, y: symbol)
.output Descendant
.printsize Descendant

Descendant(x, y) :- Parent(x, y).
Descendant(x, y) :- Parent(z, y), Descendant(x, z).

.decl Qslow(x: symbol)
.output Qslow
.printsize Qslow

Qslow(x) :- Descendant("Alice", x).

I have some facts in a TSV file Parent.facts:

"Alice" "john"
"john"  "mary"
"mary"  "elizabeth"
"Bob"   "charles"

And running souffle seems to generate the right output for the Descendant relation (three descendants for "Alice"):

hickory% souffle -F. -D. descendants.dl
Descendant      7
Qslow   0
hickory% 

However, Qslow produces zero results. I would instead expect three results. This makes me suspicious of the definition of Qslow, but I am not sure what the issue is. Am I doing something weird with symbol syntax? It looks like I am using the same syntax as in the docs.

If I try adding another clause to the conjunction, I still get zero results:

Qslow(x) :- Descendant(y, x), y="Alice".
1

There are 1 best solutions below

1
Bernhard Scholz On BEST ANSWER

You have specified the file Parent.facts in the wrong data format. It should be

john    mary
mary    elizabeth
Bob charles

without double quotes and tabs to separate elements of tuples. Only facts in the program use double-quotes.