def __init__(self, backend: Backend, output_atoms: OutputTable, facts: Iterable[Fact] = None): self._backend = backend self._map = {} for atom, sym in output_atoms.items(): assert atom not in self._map self._map[atom] = self._backend.add_atom(sym) if facts is not None: for fact in facts: backend.add_rule([backend.add_atom(fact.symbol)])
def _add_to_backend_rule(stm: Rule, backend: Backend) -> None: ''' Add a rule to the backend. ''' backend.add_rule(stm.head, stm.body, stm.choice)