def add_to_backend(self, backend: Backend, mapping: Optional[AtomMap] = None) -> 'Program': ''' Add the program to the given backend with an optional mapping. Note that the output table cannot be added to the backend for technical reasons. This has to be taken care of by the user. See for example the `Remapping` class, which provides functionality for this. Parameters ---------- backend The backend. mapping A mapping function to remap literals. Returns ------- A reference to self. See Also -------- add_to_backend ''' _add_stms_to_backend(self.shows, backend, mapping) _add_stms_to_backend(self.facts, backend, mapping) _add_stms_to_backend(self.rules, backend, mapping) _add_stms_to_backend(self.weight_rules, backend, mapping) _add_stms_to_backend(self.heuristics, backend, mapping) _add_stms_to_backend(self.edges, backend, mapping) _add_stms_to_backend(self.minimizes, backend, mapping) _add_stms_to_backend(self.externals, backend, mapping) if self.projects is not None: if self.projects: _add_stms_to_backend(self.projects, backend, mapping) else: backend.add_project([]) backend.add_assume([ _remap_lit(lit, mapping) if mapping else lit for lit in self.assumptions ]) return self
def _add_to_backend_project(stm: Project, backend: Backend): ''' Add a project statement to the backend. ''' backend.add_project([stm.atom])