Re: [rules-users] Manage dynamically rules in KnowledgeBase
https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/DynamicRulesTest.java On 23 Jul 2013, at 17:26, tiahdomoina rabarijaonadomo...@gmail.com wrote: Hello :) How can I manage dynamically rules in KnowledgeBase ? I mean remove, add or update rules without rebuilding a new KnowledgeBase or a new KnowledgeSession. Is it possible ? I tried with a basic example: KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource(rule.DRL), ResourceType.DRL); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); // insertion of facts ksession.fireAllRules(); kbase.removeRule(package, myRule); ksession.fireAllRules(); But the rules don't seem to be fired the second time. I also tried to create a new session but the result is the same. I don't wanna use a KnowledgeAgent because the modification of the rules is not very frequent. But when there is one, it has to be applied immediately and shouldn't wait for the interval of time of the scan. If anyone has an idea :) Thank you ! -- View this message in context: http://drools.46999.n3.nabble.com/Manage-dynamically-rules-in-KnowledgeBase-tp4025108.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Manage dynamically rules in KnowledgeBase
Thanks :) I will take a look at it now ! -- View this message in context: http://drools.46999.n3.nabble.com/Manage-dynamically-rules-in-KnowledgeBase-tp4025108p4025111.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
[rules-users] Pattern matching rules
I was just wondering if there is a pattern matcher available in drools. Below is a sample rule Action Movies dialect java when ui : UserInfo(likes contains Action) then List sw = new ArrayList(); sw.add(Die Hard); sw.add(The Avengers); ui.setRecs(sw); end the rule strictly checks for word Action but if the likes list contains Action Movies the rule won't get processed. Is there a pattern matching ability or a like search for a String/list containing strings? -- View this message in context: http://drools.46999.n3.nabble.com/Pattern-matching-rules-tp4025112.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] Pattern matching rules
yeah you can use the matches operator and write your own regular expression there. Cheers On Wed, Jul 24, 2013 at 10:47 AM, rganesh84 ganesh_...@infosys.com wrote: I was just wondering if there is a pattern matcher available in drools. Below is a sample rule Action Movies dialect java when ui : UserInfo(likes contains Action) then List sw = new ArrayList(); sw.add(Die Hard); sw.add(The Avengers); ui.setRecs(sw); end the rule strictly checks for word Action but if the likes list contains Action Movies the rule won't get processed. Is there a pattern matching ability or a like search for a String/list containing strings? -- View this message in context: http://drools.46999.n3.nabble.com/Pattern-matching-rules-tp4025112.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 -- - MyJourney @ http://salaboy.com http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Manage dynamically rules in KnowledgeBase
Thanks for the link, it definitely helped me I was wondering about 2 things : 1- With the knowledgeBuilder, you can check if there is an error with the method getErrors(). So you can remove immediately the resource which caused the error. Is there anything like that for the KnowledgeBase to check after adding a new KnowledgePackage in it ? 2- If I want to remove a rule, I have to update all facts. But for my application, I have 20 000 facts, is there any specific way to manage it ? -- View this message in context: http://drools.46999.n3.nabble.com/Manage-dynamically-rules-in-KnowledgeBase-tp4025108p4025114.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] Pattern matching rules
I think that OP is looking for a higher order function operator, i.e., applying pattern matching to all elements of a list returning true if there is a match. Cf. Perl's grep( /Action/, @likes ) It's not too difficult to implement such an operator. Also, a simple DRL function would do the trick (pseudocode): boolean function containsMatching( Pattern regex, List list ) for elem in list if elem =~ regex then return true end end return false end -W On 24/07/2013, Mauricio Salatino sala...@gmail.com wrote: yeah you can use the matches operator and write your own regular expression there. Cheers On Wed, Jul 24, 2013 at 10:47 AM, rganesh84 ganesh_...@infosys.com wrote: I was just wondering if there is a pattern matcher available in drools. Below is a sample rule Action Movies dialect java when ui : UserInfo(likes contains Action) then List sw = new ArrayList(); sw.add(Die Hard); sw.add(The Avengers); ui.setRecs(sw); end the rule strictly checks for word Action but if the likes list contains Action Movies the rule won't get processed. Is there a pattern matching ability or a like search for a String/list containing strings? -- View this message in context: http://drools.46999.n3.nabble.com/Pattern-matching-rules-tp4025112.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 -- - MyJourney @ http://salaboy.com http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] uninformative rule parsing/compiling error - org.drools.rule.Rule cannot be cast to org.drools.rule.Query
Dear rules users, I am currently writing my own Drools-server since I wanted more control than the drools-execution server (and it never worked very well here) where I can send rules/facts over JMS/AQMP/STOMP. Rules which are sent are saved on the server-side in DRL files that are monitored. That way, I can debug easily by changing the sent files. However, when I sent the following code, the agent does not provide me with an error message at all and hangs: / //rule TrackerRemote.TrackerUpdate// //when// //message:TrackerRemote.TrackerUpdate()// //then// //System.out.println(Tracker: + message);// //end/ at first I thought it was because TrackerRemote.TrackerUpdate is not in that package anymore and thus unknown so I tried to send the rule listed below which gives me the nice and expected error: Unable to resolve ObjectType 'NotExistingType' : [Rule name='Foo'] /rule Foo// //when // //NotExistingType( bloe == test)// //then// //System.out.println(this should not work);// //end/ when I compile the rule myself with a KnowledgeBuilder: KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); InputStream is = new ByteArrayInputStream(drlstring.getBytes()); kbuilder.add( ResourceFactory.newInputStreamResource(is),ResourceType.DRL ); I receive the error: org.drools.rule.Rule cannot be cast to org.drools.rule.Query which I think doesn't tell me anything about the mistake I made in my rule, is this a Drools bug and should I post this somewhere? Kind Regards, De Rooms Brecht Full Stack: java.lang.ClassCastException: org.drools.rule.Rule cannot be cast to org.drools.rule.Query at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:175) at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:118) at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:67) at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:84) at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2706) at org.drools.compiler.PackageBuilder.compileRules(PackageBuilder.java:930) at org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:839) at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:831) at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:467) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:673) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:45) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34) at derooms.be.server.listeners.RulesListener.processMessage(RulesListener.java:33) at derooms.be.server.listeners.AbstractListener.onMessage(AbstractListener.java:35) at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1321) at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131) at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202) at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129) at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47) 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) ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] uninformative rule parsing/compiling error - org.drools.rule.Rule cannot be cast to org.drools.rule.Query
Two clarifications first: 1) Which version are you using? 2) Is TrackerUpdate a static class inside TrackerRemote? In case, could you post the exact import statements you are using? Thanks Davide On 07/24/2013 02:14 PM, De Rooms Brecht wrote: Dear rules users, I am currently writing my own Drools-server since I wanted more control than the drools-execution server (and it never worked very well here) where I can send rules/facts over JMS/AQMP/STOMP. Rules which are sent are saved on the server-side in DRL files that are monitored. That way, I can debug easily by changing the sent files. However, when I sent the following code, the agent does not provide me with an error message at all and hangs: / //rule TrackerRemote.TrackerUpdate// //when// //message:TrackerRemote.TrackerUpdate()// //then// //System.out.println(Tracker: + message);// //end/ at first I thought it was because TrackerRemote.TrackerUpdate is not in that package anymore and thus unknown so I tried to send the rule listed below which gives me the nice and expected error: Unable to resolve ObjectType 'NotExistingType' : [Rule name='Foo'] /rule Foo// //when // //NotExistingType( bloe == test)// //then// //System.out.println(this should not work);// //end/ when I compile the rule myself with a KnowledgeBuilder: KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); InputStream is = new ByteArrayInputStream(drlstring.getBytes()); kbuilder.add( ResourceFactory.newInputStreamResource(is),ResourceType.DRL ); I receive the error: org.drools.rule.Rule cannot be cast to org.drools.rule.Query which I think doesn't tell me anything about the mistake I made in my rule, is this a Drools bug and should I post this somewhere? Kind Regards, De Rooms Brecht Full Stack: java.lang.ClassCastException: org.drools.rule.Rule cannot be cast to org.drools.rule.Query at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:175) at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:118) at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:67) at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:84) at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2706) at org.drools.compiler.PackageBuilder.compileRules(PackageBuilder.java:930) at org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:839) at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:831) at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:467) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:673) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:45) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34) at derooms.be.server.listeners.RulesListener.processMessage(RulesListener.java:33) at derooms.be.server.listeners.AbstractListener.onMessage(AbstractListener.java:35) at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1321) at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131) at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202) at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129) at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47) 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) ___ 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] Manage dynamically rules in KnowledgeBase
On 24 Jul 2013, at 11:04, tiahdomoina rabarijaonadomo...@gmail.com wrote: Thanks for the link, it definitely helped me I was wondering about 2 things : 1- With the knowledgeBuilder, you can check if there is an error with the method getErrors(). So you can remove immediately the resource which caused the error. Is there anything like that for the KnowledgeBase to check after adding a new KnowledgePackage in it ? Once there is an error, you'll need to blow it all away and start again. We don't have safe recovery, sorry. 2- If I want to remove a rule, I have to update all facts. But for my application, I have 20 000 facts, is there any specific way to manage it ? You can remove a rule, while maintaining stateful sessions. So that should work fine. Mark -- View this message in context: http://drools.46999.n3.nabble.com/Manage-dynamically-rules-in-KnowledgeBase-tp4025108p4025114.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Manage dynamically rules in KnowledgeBase
Thank you Mark :) -- View this message in context: http://drools.46999.n3.nabble.com/Manage-dynamically-rules-in-KnowledgeBase-tp4025108p4025120.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] How to get version of an asset for perticular Package version using RESTEasy
The documentation says it's something like this: http://localhost:8080/drools-guvnor/rest/packages/{packageName}/assets/{assetName}/versions/{version} -- View this message in context: http://drools.46999.n3.nabble.com/How-to-get-version-of-an-asset-for-perticular-Package-version-using-RESTEasy-tp4025121p4025122.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] OptaPlanner: score corruption when using insertLogical with custom objects
Turns out this is a user problem in the equals and hashcode of FamilyStart, not a bug in Drools or OptaPlanner :) @Override public boolean equals(Object other) { if ((this == other)) return true; if (!(other instanceof FamilyStart)) return false; FamilyStart castOther = (FamilyStart) other; return new EqualsBuilder() .append(this.getTimeslot(), castOther.getTimeslot()) // == must be Family .append(this.getTimeslot(), castOther.getTimeslot()) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder() .append(getTimeslot()) // == must be Family .append(getTimeslot()) .toHashCode(); } On 19-07-13 11:56, Geoffrey De Smet wrote: Thanks. The zip looks good and isolated (= usable for me). I might look into it after PLANNER-160 is done next week. On 19-07-13 11:25, pvandenbrink wrote: Ok, I've created a small reproducer and attached it to this issue: https://issues.jboss.org/browse/PLANNER-182 -- View this message in context: http://drools.46999.n3.nabble.com/OptaPlanner-score-corruption-when-using-insertLogical-with-custom-objects-tp4024932p4025055.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 ___ 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] OptaPlanner: score corruption when using insertLogical with custom objects
ge0ffrey wrote Turns out this is a user problem in the equals and hashcode of FamilyStart, not a bug in Drools or OptaPlanner :) @Override public boolean equals(Object other) { if ((this == other)) return true; if (!(other instanceof FamilyStart)) return false; FamilyStart castOther = (FamilyStart) other; return new EqualsBuilder() .append(this.getTimeslot(), castOther.getTimeslot()) // == must be Family .append(this.getTimeslot(), castOther.getTimeslot()) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder() .append(getTimeslot()) // == must be Family .append(getTimeslot()) .toHashCode(); } Thanks for looking into it, and you're right. Looks like I made an error in the reproducer project, sorry... The original code didn't have this equals/hashcode problem. After fixing this in the reproducer, the example schedule works fine though, so I'll have to have another look to see if I can get it to reproduce again with another example dataset. -- View this message in context: http://drools.46999.n3.nabble.com/OptaPlanner-score-corruption-when-using-insertLogical-with-custom-objects-tp4024932p4025124.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] How to get version of an asset for perticular Package version using RESTEasy
agreed. but it will give version of an asset present in current package. say current package version is 5. then it will give asset version in package version 5. but here i want get the asset version that was present in earlier package version say 3. do we have any mechanism to achive this by resteasy or other means. On Jul 24, 2013 8:17 PM, rjr201 [via Drools] ml-node+s46999n4025122...@n3.nabble.com wrote: The documentation says it's something like this: http://localhost:8080/drools-guvnor/rest/packages/{packageName}/assets/{assetName}/versions/{version} -- If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/How-to-get-version-of-an-asset-for-perticular-Package-version-using-RESTEasy-tp4025121p4025122.html To unsubscribe from How to get version of an asset for perticular Package version using RESTEasy, click herehttp://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4025121code=YW1hcnZ5YXdoYXJlQGdtYWlsLmNvbXw0MDI1MTIxfDE4NDg5NTc4NjU= . NAMLhttp://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://drools.46999.n3.nabble.com/How-to-get-version-of-an-asset-for-perticular-Package-version-using-RESTEasy-tp4025121p4025125.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] How to get version of an asset for perticular Package version using RESTEasy
http://localhost:8080/drools-guvnor/rest/packages/{packageName}/versions -- lists all versions of package http://localhost:8080/drools-guvnor/rest/packages/{packageName}/versions/{version}/source -- gets the package version source http://localhost:8080/drools-guvnor/rest/packages/{packageName}/assets/{assetName}/versions - lists all versions of the sepcified asset http://localhost:8080/drools-guvnor/rest/packages/{packageName}/assets/{assetName}/versions/{version}/source - gets the sepcified assets version source -- View this message in context: http://drools.46999.n3.nabble.com/How-to-get-version-of-an-asset-for-perticular-Package-version-using-RESTEasy-tp4025121p4025126.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] How to set drools.dialect.mvel.strict = false?
Alright, I kinda found out the cause of the exception I am getting, however I am still struggling the reason behind the exception. So DRL_1, this works perfectly fine. package drools; import drools.ProposalLight; import function drools.DateUtil.compareDatesWithTime; rule Date Rule when $obj : ProposalLight(eval(compareDatesWithTime(endDateTime, -2, 6, \\))) then $obj.addFailedRule(Date Rule); end; DRL_2, this doesn't work. and throws [Error: unable to resolve method using strict-mode: myObject.eval(boolean)] [Near : {... (eval(compareDatesWithTime(star }] ... package drools; import drools.ProposalLight; import function drools.DateUtil.compareDatesWithTime; rule Date Rule when $obj : ProposalLight(*(*eval(compareDatesWithTime(endDateTime, -2, 6, \\))*)*) then $obj.addFailedRule(Date Rule); end; Notice that extra paranthesis around eval(). This is where Drools 5.5 throws exception. Can someone please explain why this extra paranthesis throws exception and how can I make it work. Thanks, Jeetendra. On Wed, Jun 5, 2013 at 1:27 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: The error message suggests that you have made a syntactic error in a rule which is not the one you have posted, or you have modified the rule too much to be of any help. Post again, taking great care not to omit anything or to change the cause of the problem. Also, indicate precisely the declaration of the function compareDatesWithTime(). -W On 04/06/2013, jeetendray jeet...@gmail.com wrote: Hi, Snippet of my DRL . rule Rev: Start Time 2 Hours in Future when $obj : eval(compareDatesWithTime(startDateTime, -2, 2, )) then $obj.addFailedRule(Rev: Start Time 2 Hours in Future); end This fails during compilation and throws error: org.drools.rule.InvalidRulePackage: Unable to Analyse Expression (eval(compareDatesWithTime(startDateTime, -2, 2, )) ): [Error: unable to resolve method using strict-mode: myObject.eval(boolean)] [Near : {... (eval(compareDatesWithTime(star }] ^ [Line: 6, Column: 2] : [Rule name='Proposal - Start time is after current + 2 hour'] I am using Drools 5.5 and I found the cause that my code runs in strict mode.. so If I set strict mode to false then this would work. Now I am not sure how to make it to false. Here's the code I am using: PackageBuilderConfiguration packageBuilderConfiguration = new PackageBuilderConfiguration(); PackageBuilder packageBuilder = new PackageBuilder(packageBuilderConfiguration); packageBuilder.addPackageFromDrl(drl.getCharacterStream()); Can someone please suggest me how to do that?? Thanks!!! -- View this message in context: http://drools.46999.n3.nabble.com/How-to-set-drools-dialect-mvel-strict-false-tp4024122.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 ___ 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] How to set drools.dialect.mvel.strict = false?
It shouldn't do, and could be a bug. Can you try 5.6.0.SNAPSOT and see if it is still a problem. Mark On 24 Jul 2013, at 18:22, Jeet Singh jeet...@gmail.com wrote: Alright, I kinda found out the cause of the exception I am getting, however I am still struggling the reason behind the exception. So DRL_1, this works perfectly fine. package drools; import drools.ProposalLight; import function drools.DateUtil.compareDatesWithTime; rule Date Rule when $obj : ProposalLight(eval(compareDatesWithTime(endDateTime, -2, 6, \\))) then $obj.addFailedRule(Date Rule); end; DRL_2, this doesn't work. and throws [Error: unable to resolve method using strict-mode: myObject.eval(boolean)] [Near : {... (eval(compareDatesWithTime(star }] ... package drools; import drools.ProposalLight; import function drools.DateUtil.compareDatesWithTime; rule Date Rule when $obj : ProposalLight((eval(compareDatesWithTime(endDateTime, -2, 6, \\ then $obj.addFailedRule(Date Rule); end; Notice that extra paranthesis around eval(). This is where Drools 5.5 throws exception. Can someone please explain why this extra paranthesis throws exception and how can I make it work. Thanks, Jeetendra. On Wed, Jun 5, 2013 at 1:27 AM, Wolfgang Laun wolfgang.l...@gmail.com wrote: The error message suggests that you have made a syntactic error in a rule which is not the one you have posted, or you have modified the rule too much to be of any help. Post again, taking great care not to omit anything or to change the cause of the problem. Also, indicate precisely the declaration of the function compareDatesWithTime(). -W On 04/06/2013, jeetendray jeet...@gmail.com wrote: Hi, Snippet of my DRL . rule Rev: Start Time 2 Hours in Future when $obj : eval(compareDatesWithTime(startDateTime, -2, 2, )) then $obj.addFailedRule(Rev: Start Time 2 Hours in Future); end This fails during compilation and throws error: org.drools.rule.InvalidRulePackage: Unable to Analyse Expression (eval(compareDatesWithTime(startDateTime, -2, 2, )) ): [Error: unable to resolve method using strict-mode: myObject.eval(boolean)] [Near : {... (eval(compareDatesWithTime(star }] ^ [Line: 6, Column: 2] : [Rule name='Proposal - Start time is after current + 2 hour'] I am using Drools 5.5 and I found the cause that my code runs in strict mode.. so If I set strict mode to false then this would work. Now I am not sure how to make it to false. Here's the code I am using: PackageBuilderConfiguration packageBuilderConfiguration = new PackageBuilderConfiguration(); PackageBuilder packageBuilder = new PackageBuilder(packageBuilderConfiguration); packageBuilder.addPackageFromDrl(drl.getCharacterStream()); Can someone please suggest me how to do that?? Thanks!!! -- View this message in context: http://drools.46999.n3.nabble.com/How-to-set-drools-dialect-mvel-strict-false-tp4024122.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 ___ 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] How to get version of an asset for perticular Package version using RESTEasy
this will not solve my problem. let me know if the question is not clear enough. -- View this message in context: http://drools.46999.n3.nabble.com/How-to-get-version-of-an-asset-for-perticular-Package-version-using-RESTEasy-tp4025121p4025132.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] How to set drools.dialect.mvel.strict = false?
@Mark: There's really no need to claim additional bugs ;-) @Jeetendra: Within a pattern (such as ProposalLight(...)) you may write bindings and constraints, which are boolean expressions. Older versions had a much more restricted syntax for constraints, and general (Java-style) expressions were only peremitted by enclosing them in eval(...). In 5.5.0, as soon as you open a parenthesis, you have to stick to plain old Java (or MVEL) syntax, and eval is a name like any other. Recognizing eval(...) as the legacy marker for introducing an expression has to be kept, but only at the outermost parenthesis nesting level of constraint expressions. See example #1 below: ### 1 ### function boolean positive(int a){ return a 0; } // legacy style constraint, use eval() to wrap boolean expression $msg: Message( eval(positive($msg.getText().length())) ) // modern style: boolean expression $msg: Message( positive($msg.getText().length()) ) // modern style: boolean expression with redundant parentheses $msg: Message( ( positive($msg.getText().length()) ) ) The next example demostrates that eval is a soft keyword, with recognition restricted to certain places: ### 2 ### function boolean eval(int a){ return a 0; } // Why not call a function eval? // modern style: boolean expression, parentheses required to bypass soft eval recognition $msg: Message( ( eval($msg.getText().length()) ) ) So, the answer to your question How can I make it work? is quite simple: add a declaration of a boolean function eval, like this: function boolean eval( boolean b ){ return b; } And, please, do not use terms like throws an exception when a simple syntax error is reported. -W On 25/07/2013, Mark Proctor mproc...@codehaus.org wrote: It shouldn't do, and could be a bug. Can you try 5.6.0.SNAPSOT and see if it is still a problem. Mark On 24 Jul 2013, at 18:22, Jeet Singh jeet...@gmail.com wrote: Alright, I kinda found out the cause of the exception I am getting, however I am still struggling the reason behind the exception. So DRL_1, this works perfectly fine. package drools; import drools.ProposalLight; import function drools.DateUtil.compareDatesWithTime; rule Date Rule when $obj : ProposalLight(eval(compareDatesWithTime(endDateTime, -2, 6, \\))) then $obj.addFailedRule(Date Rule); end; DRL_2, this doesn't work. and throws [Error: unable to resolve method using strict-mode: myObject.eval(boolean)] [Near : {... (eval(compareDatesWithTime(star }] ... package drools; import drools.ProposalLight; import function drools.DateUtil.compareDatesWithTime; rule Date Rule when $obj : ProposalLight((eval(compareDatesWithTime(endDateTime, -2, 6, \\ then $obj.addFailedRule(Date Rule); end; Notice that extra paranthesis around eval(). This is where Drools 5.5 throws exception. Can someone please explain why this extra paranthesis throws exception and how can I make it work. Thanks, Jeetendra. On Wed, Jun 5, 2013 at 1:27 AM, Wolfgang Laun wolfgang.l...@gmail.com wrote: The error message suggests that you have made a syntactic error in a rule which is not the one you have posted, or you have modified the rule too much to be of any help. Post again, taking great care not to omit anything or to change the cause of the problem. Also, indicate precisely the declaration of the function compareDatesWithTime(). -W On 04/06/2013, jeetendray jeet...@gmail.com wrote: Hi, Snippet of my DRL . rule Rev: Start Time 2 Hours in Future when $obj : eval(compareDatesWithTime(startDateTime, -2, 2, )) then $obj.addFailedRule(Rev: Start Time 2 Hours in Future); end This fails during compilation and throws error: org.drools.rule.InvalidRulePackage: Unable to Analyse Expression (eval(compareDatesWithTime(startDateTime, -2, 2, )) ): [Error: unable to resolve method using strict-mode: myObject.eval(boolean)] [Near : {... (eval(compareDatesWithTime(star }] ^ [Line: 6, Column: 2] : [Rule name='Proposal - Start time is after current + 2 hour'] I am using Drools 5.5 and I found the cause that my code runs in strict mode.. so If I set strict mode to false then this would work. Now I am not sure how to make it to false. Here's the code I am using: PackageBuilderConfiguration packageBuilderConfiguration = new PackageBuilderConfiguration(); PackageBuilder packageBuilder = new PackageBuilder(packageBuilderConfiguration); packageBuilder.addPackageFromDrl(drl.getCharacterStream()); Can someone please suggest me how to do that?? Thanks!!! -- View this message in context: http://drools.46999.n3.nabble.com/How-to-set-drools-dialect-mvel-strict-false-tp4024122.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list