# eseguo nuovamente if parseError: if not DEBUG: print "Vuoi attivare la modalita' debug del parser? (si/no)" risposta = raw_input() if risposta.lower() == "si": parsedItems = clipsparser.parseFile(filepath, True) else: return else: return if DEBUG: clipsparser.debug_parsed(parsedItems) rete = ReteNetwork() DM = ConsoleDebugMonitor() DM.linkToEventManager(EventManager) RR = ReteRenderer() RR.linkToEventManager(EventManager) parseQueue = [] parsedModuleCache = {} stats_defrule = 0 stats_deffacts = 0 stats_facts = 0 stats_modules = 0
from icse.Variable import Variable from icse.rete.ReteNetwork import ReteNetwork from icse.predicates.Predicate import NccPredicate, PositivePredicate,\ NegativePredicate, TestPredicate from icse.rete.NetworkXGraphWrapper import NetworkXGraphWrapper from icse.predicates.NotEq import NotEq from icse.predicates.Great import Gt from icse.functions.Addition import Addition from icse.Function import Function from icse.actions.Printout import Printout if __name__ == '__main__': rete = ReteNetwork() ''' (defrule r1 (A =(+ 1 1) B) => ) ''' p = Production(name="r1:", lhs=[ (PositivePredicate, [(Eq, 'A'), (Variable, 'var')]), (PositivePredicate, [(Eq, 'A'), (Function.withFunction(Addition), [(Eq, 1), (Variable, 'var')]), (Eq, "B")]), ], rhs=[ (Printout, ["t", (Variable, 'A'), "il mio testo", "crlf"]) ],