[rules-users] Prevent DSL From replacing certain parts of text
I am utilizing a dsl with a dslr. In my DSL I have a condition work Customer which maps to a string value. Is there way to prevent the dsl from replacing this work in certain cases? For example ruleT1 when Object(value==Customer Help) then ... end When I run the DSL obviously Customer will be replaced. Any thoughts on a way to prevent this?(I know I could change on of the values from lower to upper case and it would work but I am hoping for another way) -- View this message in context: http://drools.46999.n3.nabble.com/Prevent-DSL-From-replacing-certain-parts-of-text-tp3953109.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] Rule to load facts with pagination
I agree with Wolfgang that we need more information, but here's two general pieces of advice: 1) If the object loading involves little or no business logic then do it from java. (i.e. it's load 1 objects and go) 2) It's usually more efficient to dispose of a session than to remove all objects from a session's working memory and reuse it. So if that fits your needs it's the best route. And if objects can be arbitrarily divided up in that way the problem is highly parallel, and you can take advantage of that by running the sessions in multiple threads/hosts. --- On Mon, 4/30/12, Wolfgang Laun wolfgang.l...@gmail.com wrote: From: Wolfgang Laun wolfgang.l...@gmail.com Subject: Re: [rules-users] Rule to load facts with pagination To: Rules Users List rules-users@lists.jboss.org Date: Monday, April 30, 2012, 2:44 PM Chances are high that you aren't asking the right question but based on the meagre information you provide I can't even propose a better question. Consider not only loading but also unloading. Does the logic for loading the next bunch of facts warrant rules? -W On 30/04/2012, mariofox mario...@gmail.com wrote: Hi. I'm running drools in a project with millions of facts to process. My memory doesn't allow me to load all of my facts, so I have to load N objects at once, then start over with next N objects, and so on. Is it a good idea to let Drools to manage Pagination? I mean, create rules in Drools with the purpose of loading facts?, or should I have to do this by executing a Drools session from java in a loop?. My main goal is performance. Thanks! -- View this message in context: http://drools.46999.n3.nabble.com/Rule-to-load-facts-with-pagination-tp3951591.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] Rule to load facts with pagination
Not sure if I am right but I believe he has a memory restriction which forces him not to be able to load a full result set from a query and then feed this objects into the engine as facts. Unless you have some complicated logic I would probably do the loading logic outside of the rules. Feed X number of your objects into your session, fire the rules in the session, then dispose of the session and start all over for the next X objects. laune wrote Chances are high that you aren't asking the right question but based on the meagre information you provide I can't even propose a better question. Consider not only loading but also unloading. Does the logic for loading the next bunch of facts warrant rules? -W On 30/04/2012, mariofox lt;mariofox@gt; wrote: Hi. I'm running drools in a project with millions of facts to process. My memory doesn't allow me to load all of my facts, so I have to load N objects at once, then start over with next N objects, and so on. Is it a good idea to let Drools to manage Pagination? I mean, create rules in Drools with the purpose of loading facts?, or should I have to do this by executing a Drools session from java in a loop?. My main goal is performance. Thanks! -- View this message in context: http://drools.46999.n3.nabble.com/Rule-to-load-facts-with-pagination-tp3951591.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@.jboss https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@.jboss https://lists.jboss.org/mailman/listinfo/rules-users -- View this message in context: http://drools.46999.n3.nabble.com/Rule-to-load-facts-with-pagination-tp3951591p3953288.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] Existing StateFulKnowledgeSession not taking the changes in the Guvnor
HI figured out the mistake.. I was not starting the following serives ResourceFactory.getResourceChangeNotifierService().start(); ResourceFactory.getResourceChangeScannerService().start(); Everything works fine now. Thanks On Tue, May 1, 2012 at 6:35 PM, sumatheja sumath...@gmail.com wrote: Hi All, I have a problem refreshing the sateful knowledge session whenever there is a change in the rules assets int he guvnor. Below is my code used for configuration StatefulKnowledgeSession ksession = null; KnowledgeAgentConfiguration kconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration(); KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); config.setOption( EventProcessingOption.STREAM ); KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( config ); kconf.setProperty(drools.agent.newInstance , false); KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(MyAgent1,kbase, kconf); kagent.applyChangeSet(ResourceFactory.newUrlResource( http://127.0.0.1:8380/drools-guvnor/LDIChangeSet.xml;)); kbase = kagent.getKnowledgeBase(); ksession = kbase.newStatefulKnowledgeSession(); I've a session where I've inserted thousands of facts. Whenever there is change in the rule base Do I need to reinsert all the facts using the new knowledgeBase? Any help would be appreciated. Thanks in advance. -- cheers Sumatheja Dasararaju -- cheers Sumatheja Dasararaju ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Getting Error while using Drools 5.3.0
Hi, Sorry for the delay in reply. Thanks for pointing out the typo.I corrected that and redepolyed my application.However,this time, I am seeing the following error: org.drools.rule.InvalidRulePackage: Evaluator '' does not support type 'ValueType = 'String' : [Rule name='VIN required for newer vehicles'] Here is my .dslr file: rule Set Time To Live when there is a restoration request then set quote process time to live to: 3 add additional action check state regulation for vintage car restoration end #validation rule Year is required no-loop true when request does not contain model year then set reason of rejection to year is required reject request end #additional action rule VIN required for newer vehicles no-loop true when request contains no VIN and the car was built after year 1982 then ask the customer to provide VIN end Here is my .dsl file: [condition][]there is a restoration request=info: CarRulesInfo() [consequence][]set quote process time to live to: {value}=info.setTimeToLive({value}); [condition][]request does not contain model year=info: CarRulesInfo(quoteRequest.year == null ) [consequence][]reject request=info.setValid( false ); [condition][]request contains no VIN and the car was built after year {value}=info: CarRulesInfo(quoteRequest.VIN == null, quoteRequest.modelYear 1982 ) [consequence][]ask the customer to provide VIN=info.setAdditionalActions(Ask customer to provide VIN number); [consequence][]set reason of rejection to {value}=info.setReasonOfRejection({value}); [consequence][]add additional action {value}=info.setAdditionalActions({value}); and here is my java class: public class QuoteRequest { private Contact contact; private Address address; private String make; private String model; private String style; private String year; private String VIN; private String condition; private String description; private String zip; private ListLink links = new ArrayListLink(); public static void printForMe() { System.out.println(printing for you); } public Contact getContact() { return contact; } public void setContact(Contact contact) { this.contact = contact; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } public String getMake() { return make; } public void setMake(String make) { this.make = make; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public String getStyle() { return style; } public void setStyle(String style) { this.style = style; } public String getYear() { return returnString(year); } public Integer getModelYear() { Integer modelYear = (getYear() == null) ? null : Integer.parseInt(year); return modelYear; } public void setYear(String year) { this.year = year; } public String getVIN() { return returnString(VIN); } public void setVIN(String vin) { VIN = vin; } public String getCondition() { return condition; } public void setCondition(String condition) { this.condition = condition; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public ListLink getLinks() { return links; } public void setLinks(ListLink links) { this.links = links; } private String returnString(String s) { return (s == null || s.isEmpty()) ? null : s; } } Not sure why I am getting this error.Any suggestions? Thanks. -- View this message in context: http://drools.46999.n3.nabble.com/Getting-Error-while-using-Drools-5-3-0-tp3936714p3954007.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