I am working on a Java application which does some reasoning on basic terms of a language, trivially implemented as Composites (they are all internally generated, not parsed from text). Now I am in the need of applying a set of rewrite rules to the term language, an issue which is becoming really annoying to do by hand. After some research I found that Tom and possibly Stratego/XT may be alternatives to add term rewriting abilities to Java. Does anyone have some experience on them to suggest me which are the advantages and disadvantages of both? Does anyone know about any alternative? Given the size of the software the ability to rewrite terms implemented as POJO data structures is a requisite (I am close to a deadline and I do not want to replace the current term representation with another one, although I likely will in the future).
Share
Also exists termware: http://redmine.gradsoft.ua/projects/show/termware
Does not sure, that this is exactly what you want, but it can handle any java object in rule, i.e.
domain(examples, system(Invoicing,default, ruleset( # import general operations. import(general), # handle new invoice and set one to paid if possible. @class("ua.gradsoft.termwaredemos.invoicing.Invoice", $invoice) [ ! $invoice.isPayed() && $invoice.getCustomer().getAccountBalance() - $invoice.getAmount() + $invoice.getCustomer().getCreditLimit() > 0 ] -> true [ $invoice.getCustomer().decrementAccount($invoice.getAmount()) && $invoice.setPayed(true) ], # set credit limit in depend from summary payments. @class("ua.gradsoft.termwaredemos.invoicing.Customer", $customer) [ $customer.getAccountBalance() > 0 && $customer.getSummaryPayments() > 2000 ] -> true [ $customer.setCreditLimit(500) ] ), FirstTop) );Also you can =look at jess side.
http://www.jessrules.com/