Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/kleene

crates/kleene-datalog/src/datalog_macro.md

Datalog rules written as text in Rust, turned at build time into the builder calls of [Program] (no parser at run time). The result is the same Program, with the same typed [Rel] handles, as the builder makes; rules of the macro and of the builder mix in one program.

Two forms

Every builder call that can fail is made in turn; the first error is returned (nothing is swallowed). What the macro can see is checked at build time and points at the token: an atom with the wrong number of terms, an unknown relation (in the first form), a rule for an input or a table of sets, a variable no positive atom binds, a wildcard in a head, negation or condition, a set number into a relation that is not a table of sets, malformed text.

Grammar

items     := item*
item      := decl | sets | rounds | rule
decl      := ("input" | "external" | "derived" | "counted") rel_decl ("," rel_decl)* "."
sets      := "sets" set_decl ("," set_decl)* "."
set_decl  := NAME "/" ARITY ["as" "string"] ["limit" INT]    ARITY >= 2, INT >= 1
rel_decl  := NAME "/" ARITY ["as" "string"]       the name in proofs: the string, else NAME
           | NAME ("." NAME)* "/" ARITY [types] "from" CAT [catname] ["or" "empty"]
catname   := "string" | "{" expr "}"              the catalog's name; expr gives a &str
types     := "(" TYPE ("," TYPE)* ")"             TYPE: u64 i64 f64 bool str
CAT       := NAME | "{" expr "}"                  a Catalog in scope
rounds    := "rounds" rel ":" ("keep" | "fresh") ("," rel ":" ("keep" | "fresh"))* "."
rule      := atom ":-" [aggregate ":"] literal ("," literal)* "."
aggregate := VAR "=" ("count" | "rank") "(" vars ")" ["by" "(" vars ")"]
           | VAR "=" "set" "(" vars ")" ["by" "(" vars ")"] "in" rel
           | VAR "=" "count" "(" ")" ["by" "(" vars ")"]
           | ("min" | "max" | "exactly_one") "(" vars ")" ["by" "(" vars ")"]
           | reduce ("," reduce)* ["by" "(" vars ")"]
reduce    := VAR "=" ("count" | "sum" | "avg" | "least" | "greatest") "(" vars ")"
literal   := atom | "!" atom | VAR "=" expr | expr OP expr | expr "in" expr ".." expr
           | term TEXT term | term "is" ["not"] "null"
           | expr "in" list | "!" "(" expr "in" list ")"
list      := "(" [member ("," member)* [","]] ")"    not followed by ".." or an operator
           | "{" expr "}"                            a whole Rust list: a slice, an array, a Vec
member    := literal constant | "{" expr "}" | Rust path
atom      := rel "(" [term ("," term)*] ")"         rel: NAME ("." NAME)* or "{" expr "}"
OP        := "==" | "!=" | "<" | "<=" | ">" | ">="
TEXT      := "starts" "with" | "ends" "with" | "contains"
expr      := term | "(" expr ")" | "-" expr | "!" expr | expr BINOP expr | FUNC "(" expr ("," expr)* ")"
BINOP     := "*" "/" "%"  then  "+" "-"  then  "<<" ">>"  then  "&"  then  "^"  then  "|"
FUNC      := "concat" | "substr" | "len"

Computed values

VAR = expr binds VAR to the value of expr (its variables bound by positive atoms or by computed values before it); where a positive atom binds VAR too it is an equality test. An expr may also stand on either side of a comparison and in each place of in (F & {MASK} != 0). The operators are Rust's, with Rust's precedence (tightest first as listed; unary - and ! tighter still; all left-associative): F & M != 0 is (F & M) != 0. At the start of a literal !name(..) is a negated atom; another ! starts an expression. See [compute] and [Compute] for the values: the value takes the type of the column its variable is bound to (else of its operands); an integer is computed exactly over signed and unsigned operands (a constant is an unsigned number); for an unsigned variable a value below 0 or over 64 bits, a division or remainder by 0, a shift of 64 or more, or a null operand gives no row; for a signed one each gives a null. ! of an expression of unsigned operands flips 64 bits.

Strings made by a rule

S = concat(A, "-", B) joins two or more strings, P = substr(S, I, N) is the N characters of S from place I (from 0), P = substr(S, I) those to the end, L = len(S) the number of characters; a call binds tighter than every operator and its arguments are expressions (substr(S, I + 1, N), len(S) > 3, concat(A, B) == C). In an expression, concat(..), substr(..) and len(..) are these functions, not Rust calls; len(S) alone as a literal is an atom of a relation len. Lengths and places count characters (Unicode scalar values), so no cut splits one; a cut past the end gives the shorter piece ("" from a place past the end), a negative place or length no value. A string argument is a str variable or a string constant (a quoted literal there is a string; a number there is refused when the rule is added); the value of concat and substr is a str, of len its variable's type (u64 unless its column says otherwise). A null string gives no value: a null str, no row for a u64. See [Func]. A string made that equals a string read is that string (it joins its column); ordered comparisons and the output order of made strings go by their bytes. Refused: a concat inside a recursion (its strings could grow for ever; substr and len are fine there) and a least or greatest by a made string.

Rust reads 0xF. as a hexadecimal float and refuses it before the macro sees it: a hex or binary literal that ends a rule is written braced (T = INFO & {0xF}.) or with a space before the .; a decimal one (F & 4 != 0.) needs neither.

Inputs by name from a catalog

input sym.info/2 from cat. is [Program::input_from]::<2>(&cat, "sym.info"): an input of the catalog's name, width and column types ([Catalog::relation]), given its source by [Inputs::bind]. cat is a [Catalog] in scope (a local, or any Rust expression in braces: from {&self.cat}). The rules write the name as declared (sym.info(S, T)); the handle and the Rels field are the name with _ for . (sym_info). A catalog name that is no dotted path of identifiers (pet@id, E@row) is quoted after the catalog, with a local name before: input pet_id/2 from cat "pet@id".. The name may also be a Rust expression in braces that gives a &str, so a name kept as a constant is checked by the compiler: input site_iid/2 from cat {names::SITE_IID}. (a constant, a path, a local, {&s} of a String). With a name given, quoted or in braces, the name before it is one identifier. or empty at the end makes the input EMPTY where the catalog lacks the name ([Program::input_or_empty]), so a rule decides what a missing table means: input inst_mir/2 from cat or empty., input x/2 (u64, i64) from cat {NAME} or empty. (the types given, all u64 when none are; where the catalog has the name its types must be those; a column the catalog refuses stays an error, with why). Column types in the text, (u64, str), are checked against the catalog's (an error names both); without them the catalog's types are taken. A name the catalog lacks or refuses, or another width, is the invocation's error, as any builder call's. The relation shows in proofs by the catalog's name, so as does not go with from. GQL names labels and properties in its own text and needs none of this.

Terms: variables, constants, _

Conditions read like the builder's helpers: X != Y is [ne], X < {lo} is [lt], X in Lo..Hi is [within] (Lo <= X < Hi). A string test reads as GQL writes it: N starts with "parse" is [starts_with], N ends with "expr" [ends_with], N contains "ex" [contains] ([text] with a [TextOp]); the tested value is a string variable, the pattern a string literal or a string [Term] of the caller ({suffix}, made by [Program::str]); a null is not true. Aggregates read like Plan::show_rule prints them: fan(F, N) :- N = count(G) by (F): calls(F, G). is [Aggregate::count]([f], [g], n); min(A) by (S): is [Aggregate::min_by], max is [Aggregate::max_by], exactly_one(X) by (S): is [Aggregate::exactly_one], pos(G, K, N) :- N = rank(K) by (G): item(G, K). is [Aggregate::rank]([g], [k], n) (N the number of distinct keys of the group before K, from 0); without by the whole body is one group. rounds ev: keep, od: fresh. is [Program::rounds] with [Part::Keep] and [Part::Fresh]. X is null is [is_null], X is not null [is_not_null].

A value is one of a list: K in (1, 2, 3) is [one_of] over a [Program::list] (the core's Cond::OneOf); !(K in (1, 2)) is [not_one_of]. The left side is bound elsewhere (the literal filters; it binds nothing) and may be any expr (T & {0xF} in (1, 2)). The members are literals (N in ("memcpy", "memmove")), coded for the left side's type as constants are; Rust values in braces, raw as in an atom (K in ({names::code::term::VIRTUAL}, {names::code::term::FN_POINTER}, 0)); or a whole Rust list in braces (N in {named::CODEGEN_CALLEES} with a &[&str], K in {LIST} with a &[u32], [u64; N], a Vec), shown by its path in the rule's text and proofs. After in, a ( ) or { } group followed by .. or an operator is the first end of a range (A in (LO + 1)..HI, A in {lo}..{hi}), any other is a list: X in (1) is a list of one, a trailing comma is allowed, () and an empty slice are a list no value is in (the literal is false; its negation true for a value that is not null). A null is in no list and not out of one: neither form holds for it. A string that no column holds never matches (no error). One Rust value alone (K in {X} with a u64 or a &str) is a build error: write K = {X}, or K in ({X}) for a list of one. Refused by name: a member of the wrong type (list member 2: a string compared with a u64 value), a Rust integer for a string (list member 1: a Rust integer for a str value), a variable as a member, a negated range (!(A in LO..HI)). A proof shows the value and the list: 5 in (1, 2, 5) [holds], 7 not in (1, 2) [holds], "memcpy" in named::CODEGEN_CALLEES = ("memcpy", "memmove", ..) [holds]. On a property with an index, a list (not negated) is one lookup per member.

use kleene_datalog::{Program, Type, datalog};
const KINDS: &[u32] = &[3, 4];
const NAMES: &[&str] = &["memcpy", "memmove"];
let mut p = Program::new();
let item = p.input_typed("item", [Type::U64, Type::U64]);
let name = p.input_typed("name", [Type::U64, Type::Str]);
let (a, b, c) = (p.derived::<1>("a"), p.derived::<1>("b"), p.derived::<1>("c"));
datalog!(&mut p =>
    a(I) :- item(I, K), K in (1, {KINDS[0]}, 7).
    b(I) :- name(I, N), N in {NAMES}.
    c(I) :- item(I, K), !(K & {0xF} in {KINDS}).
)
.unwrap();

Value reductions are [Aggregate::many]: stats(W, N, S, A, L, H) :- N = count(), S = sum(X), A = avg(X), L = least(X), H = greatest(X) by (W): sale(W, X). gives [Reduce::count], [Reduce::sum], [Reduce::avg], [Reduce::min], [Reduce::max] over each group's bindings, each skipping its nulls (a group with no value gets a null, a count 0). In a list, count() counts the bindings and count(X) the distinct values of X ([Reduce::count_of], distinct), as N = count(X) alone does. One reduction alone is the same, except N = count(X) ([Aggregate::count]), N = rank(K) and N = count() (the bag count below). least and greatest are values; min (W) and max (W) (no result variable) stay the binding with the least or greatest key, the head taking its values. The builder's [Program::fold] sums the same values but gives no fact for a group of only nulls.

The bag count: counted two/3. declares a derived relation with a count per row, its last column ([Program::derived_counted]); two(A, C, N) :- N = count() by (A, C): e(A, B), e(B, C). is [Program::count_rule] (the number of the body's distinct bindings per head row, a counted body atom's count multiplying, several such rules adding up). Its head is the by variables, then the count.

A number for each distinct set

sets state/2 limit 1000. is [Program::sets]: a table of sets, read as the relation state(N, X). Its first column is a set's number (u64, from 0), the rest is one element (ARITY = 1 + the element's columns; all u64 in the text, other types by [Program::sets_typed] and the form datalog!(p => ..)). limit is the most sets it may number, 1000000 (DEFAULT_SET_LIMIT) when not written.

N = set(X) by (K) in state: is [Aggregate::set_number]([k], [x], n, state.id()): the body's distinct X of one key K are its set, and N is that set's number in state. Equal sets get the same number, also across rules: several rules may number into one table. A key with no binding gets no fact (there is no empty set); without by all bindings are one set. A binding with a null in a set(..) column is skipped (as rank skips a null key); a null by value is a value of its own. No rule has the table as its head.

Without recursion through the table the rules run as a stratum of their own; no rounds line is needed. A rule that reads the table, directly or through other relations, is recursion through it: one rounds line lists the relations of the recursion, every head numbered into the table, and the table; without it the plan is refused, and the error names the line (rounds first: keep, step: keep, state: keep.). A head is keep when a key's set is whole the first time the key has rows; fresh if a key's set can grow from round to round (the key then holds the number of its set as of the last round). The table is always keep. A kept head computes only the keys that gained a row, when its rule reads only kept parts and negates none; else every key each round.

Numbers are given at the moment a numbered head is computed (in a round, the heads in the order of the rounds line): the sets new at that moment, in rising order of their sorted members, numbered on from the count so far. The table grows at that moment, and the parts after it in the same round read it as it then is, so the table's place in the rounds line does not matter. The same facts give the same numbers on every run and at every thread count. A run that would give more sets than the limit stops with DatalogError::SetLimit (sets state: more than 1000 sets), with no part answer. A proof of a numbered fact shows the member rows of its key, each with its own proof, and the number ((set 1 of state, 3 members)); a row of the table shows the numbered fact that first gave its set ([set 1, first given by]).

A state machine from a graph with labelled and unlabelled edges (the subset construction): clo is the closure through the unlabelled edges eps, first numbers each start's set, step the set reached from a state P by the label A:

use kleene_datalog::datalog;
let (p, r) = datalog! {
    input edge/3, eps/2, start/2.
    sets state/2 limit 1000.
    derived clo/2, first/2, step/3.
    clo(X, X) :- start(_, X).
    clo(Z, Z) :- edge(_, _, Z).
    clo(X, Z) :- clo(X, Y), eps(Y, Z).
    first(K, N)   :- N = set(X) by (K)    in state: start(K, S), clo(S, X).
    step(P, A, N) :- N = set(Y) by (P, A) in state: state(P, X), edge(X, A, Z), clo(Z, Y).
    rounds first: keep, step: keep, state: keep.
}
.unwrap();
assert_eq!(p.set_limit(r.state.id()), Some(1000));
assert_eq!(p.rules().len(), 5);
assert_eq!(p.round_groups().len(), 1);

Examples

A new program:

use kleene_datalog::datalog;
let (p, r) = datalog! {
    input entry/1, calls/2.
    derived reach/1.
    reach(F) :- entry(F).
    reach(G) :- reach(F), calls(F, G).
}
.unwrap();
assert_eq!(p.rules().len(), 2);
assert_eq!(p.rules()[1].head.rel, r.reach.id());

Rules added to a program in hand, beside builder rules, on the handles the caller keeps:

use kleene_datalog::{Program, datalog, ne};
mod kind {
    pub const CALL: u64 = 3;
}
let mut p = Program::new();
let site = p.input::<3>("site"); // site(S, F, Kind)
let callee = p.input::<2>("callee");
let calls = p.derived::<2>("calls");
// the builder
let (s, f, g) = (p.var("S"), p.var("F"), p.var("G"));
let call = site.atom([s.into(), f.into(), kind::CALL.into()]);
p.rule(calls.at([f, g]), [call.into(), callee.at([s, g]).into(), ne(f, g)])
    .unwrap();
// the macro, on the same program and handles
let more = datalog!(&mut p =>
    derived leaf/1 as "r_leaf", fan/2.
    leaf(F) :- site(S, F, kind::CALL), !callee(S, F).
    fan(F, N) :- N = count(G) by (F): calls(F, G).
)
.unwrap();
assert_eq!(p.relation_info(more.leaf.id()).name, "r_leaf");
assert_eq!(p.rules().len(), 3);

Constants of every type, coded for the column they meet, and string tests:

use kleene_datalog::{Program, Term, Type, datalog};
const OLD: i64 = 60;
let mut p = Program::new();
let person = p.input_typed("person", [Type::Str, Type::I64, Type::F64, Type::Bool]);
let picked = p.derived_typed("picked", [Type::Str, Type::I64]);
datalog!(&mut p =>
    picked(N, -1) :- person(N, A, S, true), A in -5..18, S >= 1.5.
    picked(N, A)  :- person(N, A, S, B), A > {Term::int(OLD)}, S < -0.5, N != "ann".
    picked(N, 0)  :- person(N, A, S, B), N starts with "a", N contains "nn".
)
.unwrap();
assert_eq!(p.rules().len(), 3);

A relation of no column (ARITY 0) is a flag: it holds (its one empty row) or does not. A rule flag() :- body. makes it hold when the body has a binding; flag() and !flag() read it in a body; an input flag is given as a bool (Inputs::flag), and Output::holds tells whether a derived one holds. An aggregate or a fold cannot give one, and an external has at least one column.

use kleene_datalog::datalog;
let (p, r) = datalog! {
    input t/1, s/1, open/0.
    derived has/0, none/0, shut/1.
    has() :- t(X).
    none() :- s(X), !has().
    shut(X) :- s(X), !open().
}
.unwrap();
assert_eq!(p.rules()[1].negated[0].rel, r.has.id());
assert_eq!(p.relation_info(r.has.id()).arity, 0);

Computed values and expressions in conditions:

use kleene_datalog::datalog;
const MASK: u64 = 4;
let (p, _) = datalog! {
    input st/2, ix/2, sym_info/2, line_flags/2, line/2.
    derived off/2, stype/2, ended/1, next/2.
    off(S, O)   :- st(S, LO), ix(S, I), O = LO + I.
    stype(S, T) :- sym_info(S, INFO), T = INFO & {0xF}.
    ended(L)    :- line_flags(L, F), F & {MASK} != 0.
    next(A, A1) :- line(R, A), R1 = R + 1, line(R1, A1).
}
.unwrap();
assert_eq!(p.rules().len(), 4);
assert_eq!(p.rules()[0].computes.len(), 1);

Value reductions, null tests and the bag count:

use kleene_datalog::{Program, Type, datalog};
let mut p = Program::new();
let sale = p.input_typed("sale", [Type::Str, Type::I64]);
let stats = p.derived_typed("stats", [Type::Str, Type::U64, Type::I64, Type::F64, Type::I64]);
let total = p.derived_typed("total", [Type::Str, Type::I64]);
let unknown = p.derived_typed("unknown", [Type::Str]);
let r = datalog!(&mut p =>
    input e/2.
    counted two/3.
    stats(W, N, S, A, H) :- N = count(), S = sum(X), A = avg(X), H = greatest(X) by (W): sale(W, X).
    total(W, S) :- S = sum(X) by (W): sale(W, X).
    unknown(W) :- sale(W, X), X is null.
    two(A, C, N) :- N = count() by (A, C): e(A, B), e(B, C).
)
.unwrap();
assert!(p.is_counted(r.two.id()));
assert_eq!(p.rules().len(), 4);

Strings made by a rule:

use kleene_datalog::{Program, Type, datalog};
let mut p = Program::new();
let word = p.input_typed("word", [Type::U64, Type::Str]);
let label = p.derived_typed("label", [Type::U64, Type::Str]);
let size = p.derived_typed("size", [Type::U64, Type::U64]);
datalog!(&mut p =>
    label(I, S) :- word(I, A), word(I, B), S = concat(A, "-", substr(B, 0, 3)).
    size(I, L)  :- word(I, A), L = len(A), len(A) > 2.
)
.unwrap();
assert_eq!(p.rules().len(), 2);

Every feature, and the name a relation shows in a proof:

use kleene_datalog::datalog;
const LIMIT: u64 = 100;
let lo = 4u32;
let (p, r) = datalog! {
    input edge/3 as "e", start/1.
    external near/2.
    derived reach/1, far/2, best/2, only/2, odd/1, even/1.
    reach(X) :- start(X).
    reach(Y) :- reach(X), edge(X, Y, _).
    far(X, W) :- edge(X, _, W), W >= {LIMIT}, W in lo..1000, !near(X, W).
    best(X, Y) :- min(W) by (X): edge(X, Y, W), reach(Y).
    only(X, Y) :- exactly_one(Y) by (X): edge(X, Y, _).
    even(X) :- start(X).
    odd(Y) :- even(X), edge(X, Y, _), !even(Y).
    even(Y) :- odd(X), edge(X, Y, _), !odd(Y).
    rounds even: keep, odd: keep.
}
.unwrap();
assert!(kleene_datalog::plan(&p).is_ok());
assert_eq!(p.relation_info(r.edge.id()).name, "e");
assert_eq!(p.rules().len(), 8);
assert_eq!(p.round_groups().len(), 1);

An input read from a catalog by name:

use kleene_datalog::{Catalog, Program, Source, Type, datalog};
let mut cat = Catalog::new();
let ids: arrow_array::ArrayRef = std::sync::Arc::new(arrow_array::UInt64Array::from(vec![0, 1]));
let ages: arrow_array::ArrayRef = std::sync::Arc::new(arrow_array::Int64Array::from(vec![30, 40]));
cat.property("person", "age", Source::Columns(vec![ids.clone(), ids.clone()]));
cat.typed_property("person", "years", Source::Columns(vec![ids, ages]), Type::I64);
let mut p = Program::new();
let r = datalog!(&mut p =>
    input person.age/2 from cat, years/2 (u64, i64) from cat "person.years".
    derived same/1.
    same(P) :- person.age(P, A), years(P, _), A == 30.
)
.unwrap();
assert_eq!(p.relation_info(r.person_age.id()).name, "person.age");
assert_eq!(p.types(r.years.id()), [Type::U64, Type::I64]);

Build-time errors

An atom with the wrong number of terms:

use kleene_datalog::{Program, datalog};
let mut p = Program::new();
let calls = p.input::<2>("calls");
let reach = p.derived::<1>("reach");
datalog!(&mut p => reach(G) :- reach(F), calls(F, G, H).).unwrap();
let _ = kleene_datalog::datalog! {
    input calls/2. derived reach/1.
    reach(F, G) :- calls(F, G).
};

An uppercase constant written bare (it would be a variable):

use kleene_datalog::{Program, datalog};
const CALL: u64 = 3;
let mut p = Program::new();
let site = p.input::<2>("site");
let call = p.derived::<1>("call");
datalog!(&mut p => call(S) :- site(S, CALL).).unwrap();

An unknown relation:

let _ = kleene_datalog::datalog! {
    input calls/2. derived reach/1.
    reach(G) :- reach(F), call(F, G).
};
use kleene_datalog::{Program, datalog};
let mut p = Program::new();
let reach = p.derived::<1>("reach");
datalog!(&mut p => reach(G) :- reach(F), calls(F, G).).unwrap();

Malformed text: a missing :-, a missing ., an expression that is not a literal (no comparison, no VAR =):

let _ = kleene_datalog::datalog! { input e/2. derived r/1. r(X) e(X, Y). };
let _ = kleene_datalog::datalog! { input e/2. derived r/1. r(X) :- e(X, Y) };
let _ = kleene_datalog::datalog! { input e/2. derived r/1. r(X) :- e(X, Y), X + Y. };

A result variable for min (a value is least):

let _ = kleene_datalog::datalog! { input e/2. derived r/2. r(X, L) :- L = min(Y) by (X): e(X, Y). };

A rule for an input, and a head variable nothing binds:

let _ = kleene_datalog::datalog! { input e/2, s/1. s(X) :- e(X, Y). };
let _ = kleene_datalog::datalog! { input e/2. derived r/2. r(X, Z) :- e(X, Y). };

A list test: one Rust value as the whole list (write K = {X}), a variable as a member, a negated range:

use kleene_datalog::{Program, datalog};
const X: u64 = 3;
let mut p = Program::new();
let item = p.input::<2>("item");
let a = p.derived::<1>("a");
datalog!(&mut p => a(I) :- item(I, K), K in {X}.).unwrap();
let _ = kleene_datalog::datalog! { input e/2. derived r/1. r(X) :- e(X, Y), X in (1, Y). };
let _ = kleene_datalog::datalog! { input e/2. derived r/1. r(X) :- e(X, Y), !(X in 1..5). };

A table of sets: one of no element, limit 0, a set number without in NAME or into a relation that is not a table of sets, a rule with the table as its head:

let _ = kleene_datalog::datalog! { sets x/1. };
let _ = kleene_datalog::datalog! { sets x/2 limit 0. };
let _ = kleene_datalog::datalog! { input m/2. sets t/2. derived id/2. id(K, N) :- N = set(X) by (K): m(K, X). };
let _ = kleene_datalog::datalog! { input m/2. derived d/2, id/2. id(K, N) :- N = set(X) by (K) in d: m(K, X). };
let _ = kleene_datalog::datalog! { input m/2. sets t/2. t(K, X) :- m(K, X). };

An input read from a catalog: with as, a dotted name without from, types without from:

let cat = kleene_datalog::Catalog::new();
let _ = kleene_datalog::datalog! { input e/2 as "x" from cat. };
let _ = kleene_datalog::datalog! { input sym.info/2. };
let _ = kleene_datalog::datalog! { input e/2 (u64, i64). };
const NAME: &str = "sym.info";
let cat = kleene_datalog::Catalog::new();
let _ = kleene_datalog::datalog! { input sym.info/2 from cat {NAME}. };