[rules-users] Running on z/OS...
Is anyone running DROOLS on z/OS on a mainframe?! Any reason why it would NOT run on it?! James -- View this message in context: http://www.nabble.com/Running-on-z-OS...-tf3922593.html#a11122860 Sent from the drools - user 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] Running on z/OS...
Mark Proctor wrote: ...as long as you are running on a compliant jvm. The z/OS 1.8 has a 64Bit Java 1.5, but due to older applications there is also older Java 1.4.2 and 1.3.2 - so how does that sound?! Hopefully there is no need for anything higher than 1.5 at this point. -- View this message in context: http://www.nabble.com/Running-on-z-OS...-tf3922593.html#a11125578 Sent from the drools - user 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] Tracking non-matches...
I was hoping for some opinions on the following: Client will have many rules (about 1000) per RuleBase. The primary goal is to assert Facts and find Matches in one or more rules. The secondary goal may be to keep track of those Facts that did not produce Matches. I was wondering what the best solution may be in this case?! The benefit in keeping track of the non-matches would be periodic analysis of the non-matches to discover patterns and perhaps provide some proactive monitoring and notification. An additional benefit may be to spot a trend and setup additional rules to reduce the number of non-matches. So I would need to not only spot the no-match condition, I also need to persist the no-match event in the database for tracking and later reporting. One way I can see is to assert a new Match fact the instance a single rule is matched and then test for the presence/absence of the Match() fact. Efficiency and speed are paramount in our case, so I'm wondering if there is an alternate approach that would work here. Thanks, James -- View this message in context: http://www.nabble.com/Tracking-non-matches...-tf3596042.html#a10044235 Sent from the drools - user 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] RE: Tracking non-matches...
Thanks Michael - That should work just fine. Michael Rhoden wrote: Store all rules with a unique id (rule id) and keep dates of when rules were put in/out of production. Store your net matches in a database, after a run, and you can easily pull the delta to show what didn't match on a particular day. -- View this message in context: http://www.nabble.com/Tracking-non-matches...-tf3596042.html#a10048924 Sent from the drools - user 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] Dynamic property names...
I'm looking to modularize and re-use as many rule components and functions as possible. I wanted to ask about a concept of a Template in Drools - is there a notion of a Rule Template for LHS or RHS that I could user? I'm thinking of a RuleTemplate that a user customizes: they'd specify the field property and select a pre-defined Template - the Template would defined prescribed behavior and operation for that property. I.e. you specify the property name and the template will include the code to do mapping and object saving actions for you substituting field name where appropriate - anything like that available, or is that something that a custom front-end application would need to implement? I was intrigued when I noticed that one of the Drools IDE views had a button to Show/Hide Templates - not sure what that means in this case, but hopefully it's just what I'm after... hehe. Thanks, James -- View this message in context: http://www.nabble.com/Dynamic-property-names...-tf3532720.html#a9908782 Sent from the drools - user 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] Fetching Facts from WM...
Suppose my client code initially asserts two Facts into WorkingMemory instance: one Source object and one TargetOne object. As the rules get applied, some of the rules may assert additional Target facts into WM. How can I retrieve all of the Target facts (however many were created) from the WorkingMemory after fireAllRules() method was called (regardless of how many Target objects were created as a result)?! I will not know the concrete type of the target object types that were asserted into WM instance, as they can be as many as 7 class sub-types (TargetOne, TargetTwo, TargetThree), though they will all share a common super-class (com.mypackage.Target). Can someone show an example on how to fetch the resulting Target objects after fireAllRules() is called and filter out the Target objects? Thanks in advance - James -- View this message in context: http://www.nabble.com/Fetching-Facts-from-WM...-tf3550451.html#a9912199 Sent from the drools - user 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] Dynamic property names...
Hi all - I have the following challenge with data mapping. I'm trying to decide if DROOLS is the appropriate solution to this problem - please help me decide. I have a Source object and Target object. Both objects have the same field names - the goal is to map data across from Source object to Target object by apply a set of rules to object's fields. More than one rule may need to be activated for each field. Results of previous mapping operation may affect later mapping operations further 'downstream' - so it's important to process fields in a specific sequence and for each field evaluate rules in a specific order - (not sure, can rule Salience accomplish both?) About the rules: There may be several rules in affect for each field - which must be executed in specific order top to bottom. Rules should be applied until the target field is mapped - until the target field is non-blank. Same rule may be applied to more than one field from the Source object. Rules will be maintain by a Customer Service Reps and will change periodically. I would envision the rule setup to be something like this: Rule Setup variables when $source : SOURCE (rec_type == PARTNER, $s_loc : location, $s_op : operator, $s_wo : workorder) $target : TARGET ($t_loc : location, $t_op : operator, $t_wo : workorder) then do nothing end # Simple mapping for Location field... rule Location when $target($t_loc == ) // if blank then $target.setLocation($s_loc); modify($target); end # Simple mapping for Operator field... rule Operator when $target($t_op == ) // if blank... then $target.setLocation($s_op); modify($target); end ... rules continue for the rest of the fields... There are about 150-200 fields to map. Some rules will define simple straight across mappings, other rules will need to fetch values from objects from DB (using 'from' keyword). Here are some questions: 1) Opinion please: Would the outlined approach work in this case given the number of fields to process and the required sequence for processing. Seems that rule management may be a bit difficult... 2) Is there a way to define functions that could take field names, and then apply common operations using dynamic field names - i.e. function simple_map(fieldName) would source data from Source.fieldName and map it to Tartget.fieldName - this would require that get/set methods be dynamic - is that possible? 3) Is there another approach that would be better suited in this case that you'd recommend? Thanks, James -- View this message in context: http://www.nabble.com/Dynamic-property-names...-tf3532720.html#a9859805 Sent from the drools - user 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] RE: RE: RE: Struggling with Rule syntax - please help...
Perfect! This is exactly what I needed - for me the key was understanding that CodesList must extend java.util.ArrayList object... it all fell into place from there... Thanks very much Michael for all your help - here's my sample rule definition which I've successfully tested in a test harness: rule This rule works! no-loop when $MILT_CUSTNO : LookupListDOM ( name == MILT_CUSTNO ) // extends ArrayList $MILT_SHPRNO : LookupListDOM ( name == MILT_SHPRNO ) // extends ArrayList $gateIN : GATE_IN( CUSTOMER_REFERENCE_NUMBER matches ^HX.*, ACTIVITY_LOCATION matches ^US.*, $sh_code : SH_CODE, $fo_code : FO_CODE, ( ( $MILT_CUSTNO.contains($sh_code) ) || ( $MILT_SHPRNO.contains($fo_code) ) ) ) then System.out.println(Matched Customer Rule! About to inovke Service...); //myService.sendNotification($event, Constants.CUSTOMER_MATCH); end Thanks again for helping me resolve this important issue. Regards, James Anstis, Michael (M.) wrote: Something like this? ... rule doing something when Customer( $custCode : customer_code ) $codes1 : Codes1List() $codes2 : Codes2List() $codes3 : Codes3List() SHIPMENT_MOVE( customer_code == $custCode, $sc : ship_code, $dc : deliver_code, $pc : port_code, ( $codes1.containts($sc) || $codes2.containts($dc) || $codes3.containts($pc) ) ) then // do something End -- View this message in context: http://www.nabble.com/Struggling-with-Rule-syntax---please-help...-tf3408727.html#a9722263 Sent from the drools - user 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] Changing rules at runtime
I don't have an application in PROD yet, I'm just working on a Proof of Concept with Drools 3.1.0M1 and Spring 1.2.8 but I have a similar situation as you in that I'll need to periodically reload Rules without restarting the App. This is what I've discover will work for us - not sure in your case, but here it is: I have objects called EventRuleBase objects which basically wrap RuleBase objects. Each instance of EventRuleBase object is tied to a resource (*.drl file on the file system for now, but in the future it may come from a DB). I then have a notion of RuleBaseManager object which is in charge of managing the collection of EventRuleBase objects. I use Spring to initialize and load all EventRuleBase objects individually and then register themselves with the RuleBaseManager object which records their instances in HashMap. The RuleBaseManager implements several methods: getWorkingMemory(...) and ruleChange(newEventRuleBase). The RuleBaseManager is a Singleton and the EventRuleBase objects are NOT singletons In my testing, I've discovered that when it's time to reload rules (some type of triggering mechanism must invoke this), I can ask Spring for a new instance of the EventRuleBase object by name (i.e. appContext.getBean(LOAD_rulebase) - it will fetch a brand new object which it will automatically reload from the underlying Resource (on the filesystem) - note that singleton=false bean configuration in Spring config is key for this. I can then hand the new instance of the new EventRuleBase object to the ruleChange(newEventRuleBase) method which it will then synchronize and 'swap-in' the new object into the HashMap it maintains. The clients that invoke subsequent getNewWorkingMemory() methods on the new EventRuleBase object will then start getting references to new object with NEW rules. I figured I'll need to protect the integrity of the hashmap using the JDK 1.5 implementation of ConcurrentHashMap which is very much possible using Spring 2.x - check out the documentation. Hope this helps. Regards - James' Carlos Henriquez wrote: We want to change rules at runtime without redeploying the whole application. -- View this message in context: http://www.nabble.com/Changing-rules-at-runtime-tf3392187.html#a9593359 Sent from the drools - user 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] Struggling with Rule syntax - please help...
I'm having trouble figuring out syntax for my rules - could someone please steer me in the right direction - it's been a frustrating few days and no luck. I need to check existence of various attributes from the SHIPMENT_MOVE fact against a list of values (same list) I fetch from the DB... Get $valuesList from a DAO - then... If SHIPMENT_MOVE.customer_code = abc and SHIPMENT_MOVE.reference_code exists in $valuesList OR SHIPMENT_MOVE.customer_code = abc and SHIPMENT_MOVE.shipping_code exists in $valuesList OR SHIPMENT_MOVE.customer_code = abc and SHIPMENT_MOVE.partner_code exists in $valuesList I have the following rule working fine: $shipment SHIPMENT_MOVE(customer_code = abc) LookupTableResult ( resultValue == 1 ) from lookupDAO.getLookup(...) But I'm having real problems with writing a rule like this: when SHIPMENT_MOVE(customer_code == abc, $list contains ship_code) OR SHIPMENT_MOVE(customer_code == abc, $list contains deliver_code) OR SHIPMENT_MOVE(customer_code == abc, $list contains port_code) Your guidance will be appreciated - Thanks, James P.S. I'm using Drools 3.1.0M1 -- View this message in context: http://www.nabble.com/Struggling-with-Rule-syntax---please-help...-tf3408727.html#a9495940 Sent from the drools - user 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] RE: Rules with Lookup Tables...
I have configured 3.1.0M1 on my local machine with the corresponding IDE... now I need help with the rule syntax. I have configured a DAO which will return an ArrayList of values representing a list of values from the lookup table - I tried this, but I'm having problems...: rule GATE-IN Match // This rule should match IF: // CUSTOMER_REFERENCE_NUMBER starts with 'HX', and // ACTIVITY_LOCATION starts with US // SH_CODE exists in lookup table idenfied by key MILT.CUSTNO when $GateIN : RKEM_Move (CUSTOMER_REFERENCE_NUMBER matches ^HX.*, ACTIVITY_LOCATION matches ^US.*, $list : (from lookupDAO.getLookupValues(MILT.CUSTNO)) contains $GateIN.getSH_CODE() ) then System.out.println(Matched 001695568GP GATE-IN Match Rule - about to inovke Service...); end Anstis, Michael (M.) wrote: I don't have the syntax at hand but Edson has previously posted about using from in similar circumstances. -- View this message in context: http://www.nabble.com/Rules-with-Lookup-Tables...-tf3329159.html#a9360008 Sent from the drools - user 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] RE: Rules with Lookup Tables...
I need to clarify myself: I intend to try out the from Conditional Expression. I understand that it is only available in Drools versions higher than 3.0.5 (which is what I have today). Can you please tell me the best location (preferably Maven2 repository) where I can get the proper version of Drools engine that will support the from keyword that I'm after? THanks, James The from CE (conditional expression) is not available in the current released jboss rules version (3.0.5) and you probably have to use the nightly build to use it. -Rahul ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- View this message in context: http://www.nabble.com/Rules-with-Lookup-Tables...-tf3329159.html#a9339593 Sent from the drools - user 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] Rules with Lookup Tables...
I need to evaluate a set of Rules with some of the operators comparing values from Facts against a changing Lookup Table - for instance: Some Partners may have several lookup tables defined like this: NISSAN has partner_ids = {, , , 6} and port_locations = {ABC, EFG, GEE, FDD...} - these values are stored in the database and need to be evaluated at run-time. I suppose one way I could do this is to write a rule like this (sorry, syntax probably off a bit)...: rule partner and port match when $shipment: Shipment(customerName== NISSAN, partnerID== || customerName==NISSAN, partnerID== || customerName==NISSAN, parternID==) || customerName==NISSAN, portLocation==ABC || customerName==NISSAN, portLocation==EFG || customerName==NISSAN, partLocation==FDD) then System.out.println(Found the right one!); end Trouble is that the values in these lookup tables change frequently, so I would like to create a rule that references a lookup table that does a DB lookup to evaluate the values at run-time - something like this: rule partner and port with lookup-table when $shipment: Shipment(customerName== NISSAN, partnerID in $(partner_ids ) ) -- db lookup here || customerName==NISSAN, portLocation in $(port_locations)) -- db lookup here then System.out.println(Found the right one!); end I know this is probably a stretch in this case - just wondering if anyone else was able to solve such a problem?! If so, how - Thanks, James -- View this message in context: http://www.nabble.com/Rules-with-Lookup-Tables...-tf3329159.html#a9256825 Sent from the drools - user 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] Example of contains operator...
Ok thanks - that worked when partnerList was an ArrayList, how would I code my contains condition if the parternList was a HashMap!? Michael Neale wrote: contains works on the Collection interface. So if parnerList is a ArrayList of String, then you could do: parnerList contains 2900 -- View this message in context: http://www.nabble.com/Example-of-contains-operator...-tf3202978.html#a8944919 Sent from the drools - user 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] Example of contains operator...
That worked just fine - thanks very much for clarification - I'm starting to understand how that works now... example is worth a thousand lines of documentation text... :) Marcus Ilgner wrote: You could write an accessor in your model called getPartnerListKeys() which returns getPartnerList().keySet() and then use (partnerListKeys contains 2900) in your rule. -- View this message in context: http://www.nabble.com/Example-of-contains-operator...-tf3202978.html#a8947081 Sent from the drools - user 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] Short-circuit rules by group?!
I have several rules defined in groups by Customer, so I have number of rules for Walmart, some rules for NIKE, more rules for SomeCustomer... When one of the rules matches for a given customer I need to send an event notification. I need to make sure that I send only ONE event notification per Customer (regardless of how many rules were matched), thus after finding the very first match in the Walmart group, I'd like to activate a rule, and then short-circuit and Skip to the next group of rules for NIKE - to see if any of the matches are found in the next group. I've implemented this functionality using a Match object, which I assert into WorkingMemory whenever I find a match for customer, then all my rules check for absence of Match for given customer... This works, but I wonder if there is a better way to do it - using Agenda Groups, maybe - once I find ONE match for Walmart, skip to the next Agenda Group?! Could someone comment on this? THanks, James -- View this message in context: http://www.nabble.com/Short-circuit-rules-by-group-%21-tf3222142.html#a8949165 Sent from the drools - user 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 inovke a Service...
I've done a little research since my first post and have been experimenting with the AgendaEventListener interface... I can register a component in WorkingMemory that will 'listen' and be notified afterEventFired event - this could be a good place from which to invoke my serivce, however, the problem I'm having is that the event delivered doesn't seem to pass the original Fact that caused the Event to fire, only the rule that got activated is sent... How could I get the Fact that caused this event to fire from that event object? James -- View this message in context: http://www.nabble.com/How-to-inovke-a-Service...-tf3189882.html#a8872876 Sent from the drools - user mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users