congress.datalog.materialized module

congress.datalog.materialized module

class congress.datalog.materialized.DeltaRule(trigger, head, body, original)

Bases: object

Rule describing how updates to data sources change table.

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

Return the set of tablenames occurring in this delta rule.

variables()

Return the set of variables occurring in this delta rule.

class congress.datalog.materialized.DeltaRuleTheory(name=None, abbr=None, theories=None)

Bases: congress.datalog.base.Theory

A collection of DeltaRules. Not useful by itself as a policy.

base_tables()
classmethod compute_delta_rules(formulas)

Return list of DeltaRules computed from formulas.

Assuming FORMULAS has no self-joins, return a list of DeltaRules derived from those FORMULAS.

delete(rule)

Delete a compile.Rule from theory.

Assumes that COMPUTE_DELTA_RULES is deterministic. Returns True iff the theory changed.

delete_delta(delta)

Delete the DeltaRule DELTA from the theory.

classmethod eliminate_self_joins(formulas)

Remove self joins.

Return new list of formulas that is equivalent to the list of formulas FORMULAS except that there are no self-joins.

get_arity_self(tablename)
insert(rule)

Insert a compile.Rule into the theory.

Return True iff the theory changed.

insert_delta(delta)

Insert a delta rule.

is_known(x)
is_view(x)
modify(event)

Insert/delete the compile.Rule RULE into the theory.

Return list of changes (either the empty list or a list including just RULE).

policy()

Return a list of the policy statements in this theory.

rules_with_trigger(table)

Return the list of DeltaRules that trigger on the given TABLE.

class congress.datalog.materialized.MaterializedViewTheory(name=None, abbr=None, theories=None, schema=None, desc=None, owner=None)

Bases: congress.datalog.topdown.TopDownTheory

A theory that stores the table contents of views explicitly.

Relies on included theories to define the contents of those tables not defined by the rules of the theory. Recursive rules are allowed.

base_tables()

Get base tables.

Return the list of tables that are mentioned in the rules but for which there are no rules with those tables in the head.

content(tablenames=None)

Return a list of the contents of this theory.

Maybe rules and/or data. Note: do not change name to CONTENTS, as this is reserved for a dictionary of stuff used by TopDownTheory.

delete(formula)
enqueue(event)
enqueue_any(event)

Enqueue event.

Processing rules is a bit different than processing atoms in that they generate additional events that we want to process either before the rule is deleted or after it is inserted. PROCESS_QUEUE is similar but assumes that only the data will cause propagations (and ignores included theories).

explain(query, tablenames, find_all)

Returns a list of proofs if QUERY is true or None if else.

explain_aux(query, depth)
get_arity_self(tablename)
get_tracer()
insert(formula)
is_known(x)

Return True if this theory has any rule mentioning table X.

is_view(x)

Return True if the table X is defined by the theory.

modify(event)

Modifies contents of theory to insert/delete FORMULA.

Returns True iff the theory changed.

policy()

Return a list of the policy statements in this theory.

process_new_bindings(bindings, atom, insert, original_rule)

Process new bindings.

For each of BINDINGS, apply to ATOM, and enqueue it as an insert if INSERT is True and as a delete otherwise.

process_queue()

Data and rule propagation routine.

Returns list of events that were not noops

propagate(event)

Propagate event.

Computes and enqueue events generated by EVENT and the DELTA_RULES.

propagate_rule(event, delta_rule)

Propagate event and delta_rule.

Compute and enqueue new events generated by EVENT and DELTA_RULE.

set_tracer(tracer)
update(events)

Apply inserts/deletes described by EVENTS and return changes.

Does not check if EVENTS would cause errors.

update_would_cause_errors(events)

Return a list of PolicyException.

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.