Hi, Am 04.12.2013 18:33, schrieb Sebastian: > Hi, > > I'm highly interested in ruta, and its potential applications in industrial > applications. Right know I'm trying to create a simple toy condition > extension that is simply a case insensitive INLIST condition. It is > completely based on the InListCondition class, I also declared an > implementation of the IRutaConditionExtension interface. > > With primitve types everything seems to work great, except when the > condition is used with a variable : > > STRINGLIST MonthsList = {"january", ...}; > DECLARE Month; > ANY{INSENSITIVEINLIST(MonthsList) -> MARK(Month)}; > > I get a class cast exception when the condition is being created, because > MonthsList is a SimpleTypeExpression and I'm expecting a > StringListExpression. > > Am I doing something wrong ? I suppose there is a way to resolve the > variable to the actual list, but I missed it somehow. >
It's hard to say what went wrong. My first guess would be that there is a problem in your extension. I just verified that INLIST works at all (I haven't used it myself for a long time). The example works with INLIST: STRINGLIST MonthsList = {"january"}; DECLARE Month; ANY{INLIST(MonthsList) -> MARK(Month)}; Can you post the stacktrace of the exception? Or can you send me the source code of your extension (in case you do not want to post it on a public mailing list)? Anyways, the usage of INLIST makes only sense if you want to work on dynamic dictionaries that may change during rule execution. Have you taken a look at the MARKFAST or TRIE action? http://uima.apache.org/d/ruta-current/tools.ruta.book.html#ugr.tools.ruta.language.actions.markfast They already have options for case-insensitivity and are overall faster and more powerful. Best, Peter PS: You can, of course, also post a feature request on JIRA for adding a case-insensitivity to the INLIST condition :-) > Any ideas on how that could be done? > > Regards > > Sebastian >