congress.datalog.database module

congress.datalog.database module

class congress.datalog.database.Database(name=None, abbr=None, theories=None, schema=None, desc=None, owner=None)

Bases: congress.datalog.topdown.TopDownTheory

class DBTuple(iterable, proofs=None)

Bases: object

match(atom, unifier)
class Proof(binding, rule)

Bases: object

class ProofCollection(proofs)

Bases: object

atom_to_internal(atom, proofs=None)
bi_unify(dbtuple, unifier1, atom, unifier2, theoryname)

THING1 is always a ground DBTuple and THING2 is always an ATOM.

body(thing)

Return formula body.

Given a FORMULA, return a list of things to push onto the top-down eval stack.

content(tablenames=None)

Return a sequence of Literals representing all the table data.

content_string()
defined_tablenames()

Returns list of table names defined in/written to this theory.

delete(atom, proofs=None)

Deletes ATOM from the DB. Returns changes.

delete_actual(atom, proofs=None)

Workhorse for deleting ATOM from the DB.

Along with the proofs that are no longer true.

explain(atom)

Return list of instances of QUERY that are true.

Same as select except stores instances of TABLENAMES that participated in each proof. If QUERY is an atom, returns list of rules with QUERY in the head and the stored instances of TABLENAMES in the body; if QUERY is a rule, the rules returned have QUERY’s head in the head and the stored instances of TABLENAMES in the body.

get_arity_self(tablename)
head(thing)

Given the output from head_index(), return the formula head.

Given a FORMULA, return the thing to unify against. Usually, FORMULA is a compile.Rule, but it could be anything returned by HEAD_INDEX.

head_index(table, match_literal=None)

Return head index.

This routine must return all the formulas pertinent for top-down evaluation when a literal with TABLE is at the top of the stack.

insert(atom, proofs=None)

Inserts ATOM into the DB. Returns changes.

insert_actual(atom, proofs=None)

Workhorse for inserting ATOM into the DB.

Along with proofs explaining how ATOM was computed from other tables.

is_noop(event)

Returns T if EVENT is a noop on the database.

modify(event)

Insert/Delete atom.

Inserts/deletes ATOM and returns a list of changes that were caused. That list contains either 0 or 1 Event.

policy()

Return the policy for this theory.

No policy in this theory; only data.

str2()
tablenames(body_only=False, include_builtin=False, include_modal=True)

Return all table names occurring in this theory.

update(events)

Applies all of EVENTS to the DB.

Each event is either an insert or a delete.

update_would_cause_errors(events)

Return a list of Policyxception.

Return a list of PolicyException if we were to apply the events EVENTS to the current policy.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.