def build(self): """ Method for building a LogicLanguageServices :return: spf.mr.lambda_.logic_language_services.LogicLanguageServices """ conjunction_predicate = LogicalConstant.read('and:<t*,t>', self.type_repository) disjunction_predicate = LogicalConstant.read('or:<t*,t>', self.type_repository) negation_predicate = LogicalConstant.read('not:<t,t>', self.type_repository) index_increase_predicate = LogicalConstant.read('inc:<%s,%s>' % ( self.type_repository.get_index_type().get_name(), self.type_repository.get_index_type().get_name()), self.type_repository) true_constant = LogicalConstant.create('true:t', self.type_repository.get_truth_value_type()) false_constant = LogicalConstant.create('false:t', self.type_repository.get_truth_value_type()) if len(self.constants_files) == 0: ontology = None if self.ontology_closed: raise RuntimeError('Closed ontology requested, but no logical constants were provided.') else: constants = self.read_constants_from_files(self.constants_files, self.type_repository) constants.add(conjunction_predicate) constants.add(disjunction_predicate) constants.add(negation_predicate) constants.add(index_increase_predicate) constants.add(true_constant) constants.add(false_constant) ontology = Ontology(constants, self.ontology_closed) return LogicLanguageServices(self.type_repository, self.numeral_type_name, self.type_comparator, ontology, conjunction_predicate, disjunction_predicate, negation_predicate, index_increase_predicate, true_constant, false_constant, self.printer)
def visit_logical_constant(self, logical_constant): self.temp_return = LogicalConstant.create( LogicalConstant.make_name(self.anonymous_name, logical_constant.get_type()), logical_constant.get_type())