Queue code in the Dedalus Paper

26 views
Skip to first unread message

Rajiv Abraham

unread,
Mar 27, 2020, 5:37:23 PM3/27/20
to Bloom Language
Hi,

I would be grateful if someone could explain the queue code from the Dedalus paper[1]. Pasting the relevant piece below:

```
priority_queue(‘bob’, ‘bash’, 200)@123;
priority_queue(‘eve’, ‘ls’, 1)@123;
priority_queue(‘alice’, ‘ssh’, 204)@123;
priority_queue(‘bob’, ‘ssh’, 205)@123;

..
In the program below, we define a table m_priority_queue that serves as a queue to feed priority queue. The queue must persist across timesteps because it may take multiple timesteps to drain it. At each timestep, for each value of A, a single tuple is projected into priority_queue and deleted (atomic with the projection) from m_priority_queue, changing the value of the aggregate calculated at the subsequent step:

persist[m_priority_queue_pos, m_priority_queue_neg, 3]
omin(A, min) ← m_priority_queue(A, _, C);
priority_queue(A, B, C)@next ← m_priority_queue(A, B, C), omin(A, C);
m_priority_queue_neg(A, B, C) ← m_priority_queue(A, B, C), omin(A, C);
```

Question:
- How is a table `m_priority_queue` defined? Is there a concept of `table` that I'm missing or is it the same as defining a rule or fact? If it's defined by a rule, I thought there would be some rule above where `m_priority_queue` is at the head? 
- Would it be a fact?  If a table is defined by the `persist` macro then by it's example below, there should be some fact representing it?

```
Example 3. Consider the following Dedalus0 program and ground facts:
p_pos(A, B) ← p(A, B); p_pos(A, B)@next ← p_pos(A, B), ¬p_neg(A, B);

p(1,2)@101; p(1,3)@102; p neg(1,2)@300;
```

In the example above, `p` seems similar to `m_priority_queue` but there are `p` facts inserted so it makes sense. I'm having a block visualizing `m_priority_queue` facts.


Thanks for the excellent paper,
Rajiv


Reply all
Reply to author
Forward
0 new messages