congress.datalog.nonrecursive module¶
-
class
congress.datalog.nonrecursive.
ActionTheory
(name=None, abbr=None, schema=None, theories=None, desc=None, owner=None)¶ Bases:
congress.datalog.nonrecursive.NonrecursiveRuleTheory
ActionTheory object.
Same as NonrecursiveRuleTheory except it has fewer constraints on the permitted rules. Still working out the details.
-
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.
-
-
class
congress.datalog.nonrecursive.
DatasourcePolicyTheory
(name=None, abbr=None, schema=None, theories=None, desc=None, owner=None)¶ Bases:
congress.datalog.nonrecursive.NonrecursiveRuleTheory
DatasourcePolicyTheory is identical to NonrecursiveRuleTheory, except that self.kind is base.DATASOURCE_POLICY_TYPE instead of base.NONRECURSIVE_POLICY_TYPE. DatasourcePolicyTheory uses a different self.kind so that the synchronizer knows not to synchronize policies of kind DatasourcePolicyTheory with the database listing of policies.
-
class
congress.datalog.nonrecursive.
MultiModuleNonrecursiveRuleTheory
(name=None, abbr=None, schema=None, theories=None, desc=None, owner=None)¶ Bases:
congress.datalog.nonrecursive.NonrecursiveRuleTheory
MultiModuleNonrecursiveRuleTheory object.
Same as NonrecursiveRuleTheory, except we allow rules with theories in the head. Intended for use with TopDownTheory’s INSTANCES method.
-
class
congress.datalog.nonrecursive.
NonrecursiveRuleTheory
(name=None, abbr=None, schema=None, theories=None, desc=None, owner=None)¶ Bases:
congress.datalog.nonrecursive.RuleHandlingMixin
,congress.datalog.topdown.TopDownTheory
A non-recursive collection of Rules.
-
arity
(table, modal=None)¶ Return the number of arguments TABLENAME takes.
- Parameters
table – can be either a string or a Tablename
- Returns
None if arity is unknown (if it does not occur in the head of a rule).
-
body
(formula)¶ Return formula body.
Given a FORMULA, return a list of things to push onto the top-down eval stack.
-
defined_tablenames
()¶ Returns list of table names defined in/written to this theory.
-
head
(formula)¶ 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.
-
-
class
congress.datalog.nonrecursive.
RuleHandlingMixin
¶ Bases:
object
-
content
(tablenames=None)¶
-
define
(rules)¶ Empties and then inserts RULES.
-
delete
(rule)¶
-
empty
(tablenames=None, invert=False)¶ Deletes contents of theory.
If provided, TABLENAMES causes only the removal of all rules that help define one of the tables in TABLENAMES. If INVERT is true, all rules defining anything other than a table in TABLENAMES is deleted.
-
initialize_tables
(tablenames, facts)¶ Event handler for (re)initializing a collection of tables
@facts must be an iterable containing compile.Fact objects.
-
insert
(rule)¶
-
policy
()¶
-
revert_schema
(schema_changes)¶
-
update
(events)¶ Apply EVENTS.
And return the list of EVENTS that actually changed the theory. Each event is the insert or delete of a policy statement.
-
update_rule_schema
(rule, is_insert)¶
-
update_would_cause_errors
(events)¶ Return a list of PolicyException.
Return a list of PolicyException if we were to apply the insert/deletes of policy statements dictated by EVENTS to the current policy.
-