Re: [rules-users] Weird classloader problem
I had similar problem and it was solved in 6.0.0.CR5. 2013/11/18 Alexander Herwix > Hey guys, > > using Drools 6 RC4. I have a simple rule which should cast an object into > a specialized object (if it is indeed a specialization) and insert that > into the session. > > rule "Obj is SpecialObject" > salience 201 > when > > $mainObj : MainObj(obj.class == SpecialObject.class, $obj : obj) > then > System.out.println("Obj is SpecialObj"); > > SpecialObj specialObj = (SpecialObj) $obj; > insert(specialObj); > end > > This rule doesn't even compile and I get a nasty error: > NoClassDefFoundError: com/iterranux/droolsjbpmHumanTask/domain/team__I > (wrong name: com/iterranux/droolsjbpmHumanTask/domain/Team__I). > > I mean it looks like the Class is present, but somehow it's lowercased > somewhere. It's weird I can use some other obj but this doesn't work. > Anyone seen something like this before? Maybe some other way to do what I > want to do? I tried to declare a trait and don that obj with that but same > result. > > Another question would be if it is really necessary to insert the object > as a new fact, or could I access the nested property directly in a rule and > typecast it there somehow? > > Cheers, Alex > > Error java.lang.RuntimeException: Reloading agent exited via exception, > please raise a jira > | Error at > org.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:104) > | Error at > sun.instrument.TransformerManager.transform(TransformerManager.java:188) > | Error at > sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424) > | Error at java.lang.ClassLoader.defineClass1(Native Method) > | Error at java.lang.ClassLoader.defineClass(ClassLoader.java:791) > | Error at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) > | Error at > java.net.URLClassLoader.defineClass(URLClassLoader.java:449) > | Error at > java.net.URLClassLoader.access$100(URLClassLoader.java:71) > | Error at java.net.URLClassLoader$1.run(URLClassLoader.java:361) > | Error at java.net.URLClassLoader$1.run(URLClassLoader.java:355) > | Error at java.security.AccessController.doPrivileged(Native > Method) > | Error at > java.net.URLClassLoader.findClass(URLClassLoader.java:354) > | Error at java.lang.ClassLoader.loadClass(ClassLoader.java:423) > | Error at > groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:648) > | Error at > groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:758) > | Error at > groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:746) > | Error at java.lang.Class.forName0(Native Method) > | Error at java.lang.Class.forName(Class.java:266) > | Error at > org.drools.core.common.ProjectClassLoader.loadClass(ProjectClassLoader.java:80) > | Error at java.lang.ClassLoader.loadClass(ClassLoader.java:356) > | Error at java.lang.Class.forName0(Native Method) > | Error at java.lang.Class.forName(Class.java:266) > | Error at > org.mvel2.ParserConfiguration.checkForDynamicImport(ParserConfiguration.java:163) > | Error at > org.mvel2.ParserConfiguration.hasImport(ParserConfiguration.java:191) > | Error at > org.mvel2.ParserContext.hasImport(ParserContext.java:360) > | Error at > org.mvel2.compiler.AbstractParser.createPropertyToken(AbstractParser.java:1341) > | Error at > org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:846) > | Error at > org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:128) > | Error at > org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62) > | Error at org.mvel2.MVEL.analyze(MVEL.java:680) > | Error at > org.mvel2.compiler.PropertyVerifier.getMethod(PropertyVerifier.java:536) > | Error at > org.mvel2.compiler.PropertyVerifier.analyze(PropertyVerifier.java:120) > | Error at > org.mvel2.compiler.ExpressionCompiler.verify(ExpressionCompiler.java:381) > | Error at > org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:273) > | Error at > org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62) > | Error at org.mvel2.MVEL.analyze(MVEL.java:680) > | Error at org.mvel2.MVEL.analyze(MVEL.java:685) > | Error at > org.drools.compiler.rule.builder.dialect.mvel.MVELExprAnalyzer.analyzeExpression(MVELExprAnalyzer.java:114) > | Error at > org.drools.compiler.rule.builder.dialect.mvel.MVELDialect.analyzeBlock(MVELDialect.java:539) > | Error at > org.drools.compiler.rule.builder.dialect.mvel.MVELConsequenceBuilder.build(MVELConsequenceBuilder.java:130) > | Error at > org.drools.compiler.rule.builder.RuleBuilder.build(RuleBuilder.java:103) > | Error at > org.
Re: [rules-users] Kie API questions
Mark, thank you for the slides. I saw them already together with your youtube video before. I like the new KIE API, but Unfortunately it is still little bit unclear for me. For example I don't know answer for my question 2. "config.setOption(PropertySpecificOption.ALWAYS);". And the documentation is using old api on most places. I also didn't found how to use verifier with KIE API I understand that Drools 6 is not in final stage and will wait until there will be more documentation available. Thank you for your answer, Martin 2013/10/11 Wolfgang Laun > On 11/10/2013, Mark Proctor wrote: > > We go over kie api and conf here, starting at slide 96. Slide 109 shows > > kie-scanner in use. > > http://www.slideshare.net/MarkProctor/ireland-augam2013 > > Gotcha - you're saying, documentation is on the slide...?! > ;-) > -W > > > > > > Mark > > On 11 Oct 2013, at 11:05, Martin Minka wrote: > > > >> are there somewhere examples how to: > >> > >> 1. use KieScanner > >> 2. how to configure following code found on > >> > http://docs.jboss.org/drools/release/6.0.0.CR4/drools-expert-docs/html_single/index.html > >> with KIE API > >> > >> KnowledgeBuilderConfiguration config = > >> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(); > >> config.setOption(PropertySpecificOption.ALWAYS); > >> KnowledgeBuilder kbuilder = > >> KnowledgeBuilderFactory.newKnowledgeBuilder(config); > >> thank you, > >> Martin > >> ___ > >> rules-users mailing list > >> rules-users@lists.jboss.org > >> https://lists.jboss.org/mailman/listinfo/rules-users > > > > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Kie API questions
are there somewhere examples how to: 1. use KieScanner 2. how to configure following code found on http://docs.jboss.org/drools/release/6.0.0.CR4/drools-expert-docs/html_single/index.htmlwith KIE API KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(); config.setOption(PropertySpecificOption.ALWAYS); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(config); thank you, Martin ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 5.6
I am trying 5.6.0-SNAPSHOT, but getting message "Resolve error obtaining dependencies: Failed to read artifact descriptor for org.drools:drools-compiler:jar:5.6.0-SNAPSHOT". Could it be, that this file is corrupted in maven ? thank you, Martin 2013/9/18 Jonathan Knehr > Tried with the 5.6 snapshot just now. > > Same/similar issues. > > NPEs in RightTupleIndexHashTable. > ClassCastExceptions from many of the InternalReadAccessor generated > bytecode classes. > NPEs in MvelContraint class. > > I'm replaying the exact same series of events that I did for the 5.5 run. > > Could you point me to where you think the origin of the corruption occurs? > I have breakpoints where the exceptions are thrown, but this is long after > the data structure was originally corrupted. It would help me try my hand > at debugging the issue for you further. > > Thanks in advance!! > Jonathan > > On Sep 18, 2013, at 1:19 PM, Davide Sottara wrote: > > > Did you try to run the code with 5.6.0-SNAPSHOT? It's now available from > > RHT maven repositories.. > > the official release is still waiting for the fix of a few more bugs, > > but the tuple index one should have > > already been fixed. If not, it would be critical to include it in the > > final version > > Thanks > > Davide > > > > On 09/18/2013 09:16 AM, Jonathan Knehr wrote: > >> When is 5.6 going to be officially released? > >> > >> There are many critically buggy things going on in 5.5 where the entire > RightTupleIndex is getting very corrupted. I still haven't been able to > produce a standalone unit test, but the issue always involves rules with > "exists" and "not" in combination with complex retractions. Never does it > happen with a few events, but when you run the scenarios over and over > again millions of times, eventually the index becomes so corrupt that > almost every single activation throws NPEs in MVEL, in the generated byte > code, and in the rete data structures themselves to the point where all > rule firing stops working. > >> ___ > >> rules-users mailing list > >> rules-users@lists.jboss.org > >> https://lists.jboss.org/mailman/listinfo/rules-users > > > > ___ > > rules-users mailing list > > rules-users@lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/rules-users > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] classloader problem in Drools 6.0.0.CR1 and CR2 (working in Beta5)
this works today with 6.0.0-SNAPSHOT thank you for fixing it, Martin -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-classloader-problem-in-Drools-6-0-0-CR1-and-CR2-working-in-Beta5-tp4025726p4025837.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools 6 Spring JTA Persistence
If you don't mind, I am also interested to share opinions and work. Martin 2013/9/4 Alexander Herwix > Hey Markus, > > that sounds really interesting! I would love to know your opinion on how > to integrate grails and drools in the best way. If we have similar ideas > and goals for the plugin that would be really good way to proceed. Maybe we > can set up a talk in irc or the like? I'm currently working on this full > time so just hit me up on my mail address to set something up. > > Cheers, Alex > > Am 04.09.2013 um 19:44 schrieb Markus Schneider < > markus.schneide...@gmail.com>: > > Hi Alex, > > I'm developing a Grails Drools Plugin, too. At the moment I'm working on > an ECA (Event Correlation & Analysis) solution so my current focus is on > expert & fusion. But jBPM is also an important module that I'll need in the > future. > Maybe we can come togehter and create one feature rich grails plugin. > Let me know if you're interested. > > Cheers > > -markus > > > > > > 2013/9/4 Alexander Herwix > >> Hey Martin, >> >> haven't looked at your code yet, but I have Drools 6 CR1 and 2 running in >> grails though without local HT and JTA persistence. It was pretty straight >> forward, just included the dependencies and pruned duplicate entries (check >> the dependency report). >> >> If I get the plugin working I would be glad to share a demo project. >> However, I think that a fully fledged release of the plugin to grails >> central would take some more time. >> >> Cheers, Alex >> >> Am 03.09.2013 um 21:23 schrieb Martin Minka : >> >> Alex, >> I am sorry, I don't have solution for your problem, but maybe I will work >> soon on same issue. >> Are you using Drools 6.0.0.CR2 ? If yes, where you able to overcome this >> problem >> http://drools.46999.n3.nabble.com/rules-users-classloader-problem-in-Drools-6-0-0-CR1-and-CR2-working-in-Beta5-td4025726.html? >> >> Do you mind to share your plugin code with community ? >> >> Best regards, >> Martin >> >> >> >> 2013/9/3 Alexander Herwix >> >>> Hey guys, >>> >>> I'm working on a Grails plugin for Drools/Jbpm 6 and I have trouble to >>> get persistence working in a user friendly way. It would be awesome if >>> someone with a better understanding of drools and especially drools spring >>> integration could help me to figure this out :) >>> >>> I have considered multiple approaches: >>> >>> - Use a spring LocalContainerEntityManagerFactoryBean with a local >>> JpaTransactionManager to configure a KieEnvironment via Spring. >>> >>> I basically got this working, but this doesn't provide real integration >>> with Grails, as there are 2 seperate local TransactionManagers involved - >>> limiting the ability to integrate drools in the grails app. >>> >>> - Use JTA-Transactions. >>> >>> As I want the plugin to be as user friendly as possible I would like to >>> keep using the default tomcat container for development. There is the >>> Atomikos Plugin for Grails which configures Grails to work with JTA. This >>> works pretty nicely and should suffice for the development environment. >>> >>> My problem is integrating the Atomikos backed JTATransactionManager with >>> the drools 6 spring environment configuration as I have not much experience >>> with JTA. I have looked at the Tests for Kie-Spring and looked at as much >>> documentation as I could find, but I can't seem to figure this out. >>> >>> This is what I use to configure the environment via spring (in Grails >>> groovy syntax) >>> >>> jbpmGlobals(MapGlobalResolver) >>> >>> dacceptor(ClassObjectMarshallingStrategyAcceptor,['*.*']) >>> >>> kie.kstore(id:'kiestore') >>> >>> kie.environment(id: 'jbpmEnv'){ >>> kie.'entity-manager-factory'(ref:'entityManagerFactory') >>> >>> kie.globals(ref:'jbpmGlobals') >>> >>> kie.'object-marshalling-strategies'(){ >>> kie.'jpa-placeholder-resolver-strategy'() >>> >>> kie.'serializable-placeholder-resolver-strategy'('strategy-acceptor-ref':"dacceptor") >>> } >>> } >>> //Tried to wrap my JtaTransactionManager with Ki
Re: [rules-users] Drools 6 Spring JTA Persistence
Alex, I am sorry, I don't have solution for your problem, but maybe I will work soon on same issue. Are you using Drools 6.0.0.CR2 ? If yes, where you able to overcome this problem http://drools.46999.n3.nabble.com/rules-users-classloader-problem-in-Drools-6-0-0-CR1-and-CR2-working-in-Beta5-td4025726.html? Do you mind to share your plugin code with community ? Best regards, Martin 2013/9/3 Alexander Herwix > Hey guys, > > I'm working on a Grails plugin for Drools/Jbpm 6 and I have trouble to get > persistence working in a user friendly way. It would be awesome if someone > with a better understanding of drools and especially drools spring > integration could help me to figure this out :) > > I have considered multiple approaches: > > - Use a spring LocalContainerEntityManagerFactoryBean with a local > JpaTransactionManager to configure a KieEnvironment via Spring. > > I basically got this working, but this doesn't provide real integration > with Grails, as there are 2 seperate local TransactionManagers involved - > limiting the ability to integrate drools in the grails app. > > - Use JTA-Transactions. > > As I want the plugin to be as user friendly as possible I would like to > keep using the default tomcat container for development. There is the > Atomikos Plugin for Grails which configures Grails to work with JTA. This > works pretty nicely and should suffice for the development environment. > > My problem is integrating the Atomikos backed JTATransactionManager with > the drools 6 spring environment configuration as I have not much experience > with JTA. I have looked at the Tests for Kie-Spring and looked at as much > documentation as I could find, but I can't seem to figure this out. > > This is what I use to configure the environment via spring (in Grails > groovy syntax) > > jbpmGlobals(MapGlobalResolver) > > dacceptor(ClassObjectMarshallingStrategyAcceptor,['*.*']) > > kie.kstore(id:'kiestore') > > kie.environment(id: 'jbpmEnv'){ > kie.'entity-manager-factory'(ref:'entityManagerFactory') > > kie.globals(ref:'jbpmGlobals') > > kie.'object-marshalling-strategies'(){ > kie.'jpa-placeholder-resolver-strategy'() > > kie.'serializable-placeholder-resolver-strategy'('strategy-acceptor-ref':"dacceptor") > } > } > //Tried to wrap my JtaTransactionManager with KieSpringTransactionManager > jbpmTransactionManager(KieSpringTransactionManager, > ref('transactionManager')) > > > the environment value for transactionManager cannot be set here, because > the parser expects a JpaTransactionManager. I tried to add the > transactionManager manually to the environment and found the > KieSpringTransactionManager, which looked like it could help me somehow, > but in the end, there is always the default implementation of the > JtaTransactionManager used which can't find the transactionManager that I > configured. > > Error: > NamingException occurred when processing request: [GET] /bpm/test/testJbpm > Cannot create resource instance. Stacktrace follows: > javax.naming.NamingException: Cannot create resource instance > at > org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:116) > at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321) > at org.apache.naming.NamingContext.lookup(NamingContext.java:843) > at org.apache.naming.NamingContext.lookup(NamingContext.java:154) > at org.apache.naming.NamingContext.lookup(NamingContext.java:831) > at org.apache.naming.NamingContext.lookup(NamingContext.java:168) > at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158) > at javax.naming.InitialContext.lookup(InitialContext.java:411) > at > org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:122) > at > org.drools.persistence.jta.JtaTransactionManager.(JtaTransactionManager.java:69) > at > org.drools.persistence.SingleSessionCommandService.initTransactionManager(SingleSessionCommandService.java:325) > at > org.drools.persistence.SingleSessionCommandService.(SingleSessionCommandService.java:114) > at > org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:129) > at > org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newKieSession(KnowledgeStoreServiceImpl.java:67) > at > org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newKieSession(KnowledgeStoreServiceImpl.java:36) > at bpm.TestController.testJbpm(TestController.groovy:119) > at > grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:200) > at > grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > at java.lang.Thread.run(Thread.java:722) > > > I would be glad about any input. > > Cheers, Alex > > > _
[rules-users] do I have to use temporary variable to overcome data casting issue ?
I continue to play with the code attached to https://issues.jboss.org/browse/DROOLS-136 in src.zip. Updated invoice.drl is attached in this mail. I changed the rule "calculate totalPrice per item" to MVEL and trying to calculate and set totalPrice with one liner: ((DataItemPrice)$v).setTotalPrice(((DataItemPrice)$v).getQty()*((DataItemPrice)$v).getUnitPrice()); but that fails with message: java.lang.IllegalArgumentException: object is not an instance of declaring class On the other hand using temporary variable of type Double will work. Here is the complete rule which works up to the comment "// THIS IS DOESN'T WORK": rule "calculate totalPrice per item" salience -10 no-loop when $q:Message(id=="item", answered==true, value instanceof DataItemPrice, $v:value ) then System.out.println("setting totalPrice on item: " + ((DataItemPrice)$v).getName()); System.out.println("qty*unitPrice=" + ((DataItemPrice)$v).getQty()*((DataItemPrice)$v).getUnitPrice()); *Double d = ((DataItemPrice)$v).getQty()*((DataItemPrice)$v).getUnitPrice(); ((DataItemPrice)$v).setTotalPrice(d); *System.out.println("setting via temporary variable worked"); // THIS IS DOESN'T WORK * ((DataItemPrice)$v).setTotalPrice(((DataItemPrice)$v).getQty()*((DataItemPrice)$v).getUnitPrice()); * System.out.println("setting directly works ???"); update($q); end Am I again wrongly hoping that MVEL will simplify data types casting ? Or should I fail a bug ? invoice.drl Description: Binary data ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] is property type casting into variable supported ?
I filled bug https://issues.jboss.org/browse/DROOLS-136 because the way I tried to use # symbol hangs Drools. I would like to ask the group if following type casting is supported in Drools in Java or in MVEL: rule "calculate totalPrice per item" salience -10 no-loop dialect "java" when $q:Message(id=="item", answered==true, $v:value#DataItemPrice) then System.out.println("this works: " + ((DataItemPrice)$v).getName()); // will this also work ? at least in MVEL System.out.println("will this work ?: " + $v.getName()); end thank you, Martin Minka ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] keep only one, retract all other
thank you for help. my summary for 5.5.0.Final: 1. *Esteban's suggestion works*, but of course requires more activations 2. Wolfgang's suggestion to *use java dialect* works 3. it looks like there is *no way to achieve the same with mvel* dialect sincerely, Martin 2012/11/30 Esteban Aliverti > rule "Remove all but one" > when > $f1: Fact(id == "aaa") > $f2: Fact(id == "aaa", this != $f1) > then > retract($f2); > end > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] keep only one, retract all other
I was using ArrayList before and I don't think this is the real problem. collect() will return object compatible with List interface so it is valid to use size() and get() methods on $removeUs. I have helper method myhelper.log() with accepts any object and * myhelper.log($removeUs.get(i))* works for me, unfortunately *retract($removeUs.get(i)) *doesn't work with error: Error: unable to resolve method using strict-mode: org.drools.spi.KnowledgeHelper.drools()] [Near : {... drools.retract($removeUs }] It looks like it is not even compiled. 2012/11/30 Wolfgang Laun > On 30/11/2012, Martin Minka wrote: > > Thank you for the tip. What solution would you suggest to solve my > problem > > ? > > Look into the javadoc of java.util to find any class implementing List :-) > -W > > > > > Martin > > > > > > 2012/11/30 Wolfgang Laun > > > >> You cannot use an interfact (List) to instantiate an object, which > >> is happening due to the collect. > >> --W > >> > >> On 30/11/2012, Martin Minka wrote: > >> > I want to keep only 1 fact with id=="". But this is not working: > >> > > >> > rule "leave only one" > >> > when > >> > $removeUs : java.util.List(size>1) > >> > from collect(Fact(id=="") > >> > then > >> > size = $removeUs.size(); > >> > for (int i=1; i < size; i++) { > >> > retract($removeUs.get(i)); > >> > } > >> > end > >> > > >> ___ > >> rules-users mailing list > >> rules-users@lists.jboss.org > >> https://lists.jboss.org/mailman/listinfo/rules-users > >> > > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] keep only one, retract all other
Thank you for the tip. What solution would you suggest to solve my problem ? Martin 2012/11/30 Wolfgang Laun > You cannot use an interfact (List) to instantiate an object, which > is happening due to the collect. > --W > > On 30/11/2012, Martin Minka wrote: > > I want to keep only 1 fact with id=="". But this is not working: > > > > rule "leave only one" > > when > > $removeUs : java.util.List(size>1) > > from collect(Fact(id=="") > > then > > size = $removeUs.size(); > > for (int i=1; i < size; i++) { > > retract($removeUs.get(i)); > > } > > end > > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] keep only one, retract all other
I want to keep only 1 fact with id=="". But this is not working: rule "leave only one" when $removeUs : java.util.List(size>1) from collect(Fact(id=="") then size = $removeUs.size(); for (int i=1; i < size; i++) { retract($removeUs.get(i)); } end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users