I have actually done this in the java rule engine jrule, as an experiment. I can readd the code if you are interested.
Regards S