RE: [rules-users] Rules with Lookup Tables...
I don't have the syntax at hand but Edson has previously posted about using from in similar circumstances. This would allow you to access a lookup table on a database as part of the LHS of a rule. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jdepaul Sent: 01 March 2007 19:35 To: rules-users@lists.jboss.org Subject: [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#a925682 5 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Using Java to write rules?
I wonder if it is possible to write rules and make queries toward the knowledge database of Jboss Rules using Java language itself. What I need is to to be able to access the rule engine's API. I do not want to use Drools language or XML. Thanks Vennlig hilsen/Best regards Nader Aeinehchi Sjefsarkitekt /Chief Architect EDB Business Partner Norge AS Telefon: +47 22 52 80 80, Direkte + 47 23 32 02 88, mobil: +47 41 44 29 57 E-post: [EMAIL PROTECTED] http://www.edb.com http://www.edb.com/ EDB - En sterk og nær IT-partner ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] need help to convert .drl files to XML
hi, how do i use xml tool and API's provided by JBOSS Rules to convert rule files (.drl) to xml files.I know schema definition for XML for representing the rules that already jboss has but i cant understand where i write my XML file and how to run that XML.I'm using Eclipse.Please help me.Its urgent. thanking you, Niloy - Heres a new way to find what you're looking for - Yahoo! Answers ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Using Java to write rules?
On 3/2/07, Aeinehchi Nader [EMAIL PROTECTED] wrote: I wonder if it is possible to write rules and make queries toward the knowledge database of Jboss Rules using Java language itself. What I need is to to be able to access the rule engine's API. I do not want to use Drools language or XML. Although I guess that it would be possible to make all those calls manually, I wonder what the advantage would be. The RHS of a rule is already Java code and the LHS provides a lot of Java functionality or can use eval() if neccessary. Also you can embed the DRL in your source or dynamically create new rules and add those using StringReader if need be: I'm currently working on a business project where new rules are assembled by the application: POC works like a charm. If that is not feasible, I'd probably take a look at the drools-decisiontables codebase which basically does a similar thing: replace DRL/XML syntax with a new interface (decision tables). Anyway, that's just my $0.02 ;) Best regards Marcus ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Rules with Lookup Tables...
On 3/2/07, Francisco Brum [EMAIL PROTECTED] wrote: I also need to make a rule with a lookup tables, and I have found that the new version of rules support 'from'. Another solution could be the the use of globals: http://labs.jboss.com/file-access/default/members/jbossrules/freezone/docs/3.0.5/html_single/index.html#d0e719 You could insert a global PartnerList and a global PortLocationList and evaluate on these. It somewhat depends on your situation: using FROM is definitely more powerful, globals are quicker to implement because you probably have this List object laying around already. Best regards Marcus ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] retracting a fact after all interested rules have fired??
Hi, I have a similar problem, in particular I need that before retracting facts, all the interested rules have fired. How do you solved it? 2007/2/8, Justine Hlista [EMAIL PROTECTED]: Need some instruction for retraction strategies. We have an application that receives messages about the status of various things in the system, and at the moment I am asserting these messages as facts. The rules are written against these messages. Various rules might be interested in various values in the message, and they all fire independently. The problem is that after all the existing rules that are interested in the message have fired, I want to retract the message. How do I ensure that all the interested rules have fired first?? At the moment, I am trying to use a salience value of -1 to make sure a simple cleanup rule fires last: rule cleanupMessage no-loop true salience -1 when msg : MyMessage() then retract(msg) end Does this sound like a reasonable solution? Is there a better one?? Thanks! ___ 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] Writing rules using java..
I am very new to rules engine. The requirement for our project is store and retrieve rules from the database.This makes the rules engine to directly interact with the Database, to do so is there any way that I can use the rules api to set the rules. For example something like Creating a rule. Rule rule = new Rule(name); Rule.setSaliance(1); Similarly I don't find any api's to set the conditions and the consequences. I did extensive googling but couldn't find the right answer.. I would appreaciate if some could help me with this scenario. Thanks in advance, Sandeep. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] Rules with Lookup Tables...
Previously Edson had suggested using the from CE. Here is the example from his previous posting rule Device not working (condition id = 4) when alertDefinition : AlertDefinition (conditionID== 4, eid : entityID) Power( value 1000 ) from dao.getPower( eid ) Temperature( deviceTemp 50, ambTemp 40 ) from dao.getTemperature(eid) then log(Triggered Device not working alert for + eid); end 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 --- Anstis, Michael (M.) [EMAIL PROTECTED] wrote: I don't have the syntax at hand but Edson has previously posted about using from in similar circumstances. This would allow you to access a lookup table on a database as part of the LHS of a rule. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jdepaul Sent: 01 March 2007 19:35 To: rules-users@lists.jboss.org Subject: [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#a925682 5 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 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] Writing rules using java..
I may not be understanding your requirements but would storing the rule definition file in the database help. So you have file with all your rules and you store it in the database. At execution time you load the rules file and hence rules from the database. Rahul --- Kolla, Sandeep [EMAIL PROTECTED] wrote: I am very new to rules engine. The requirement for our project is store and retrieve rules from the database.This makes the rules engine to directly interact with the Database, to do so is there any way that I can use the rules api to set the rules. For example something like Creating a rule. Rule rule = new Rule(name); Rule.setSaliance(1); Similarly I don't find any api's to set the conditions and the consequences. I did extensive googling but couldn't find the right answer.. I would appreaciate if some could help me with this scenario. Thanks in advance, Sandeep. ___ 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] confused again.... - why it selects all possible combinations? (D ROOLS 3.1M)
Hi, I finally got around to get my hands dirty. And I run into some problem. The results I'm getting are not the ones I expected to get :-). I have a rule: rule FC.93 when r1: Record( psc == 101, fundType == 1, $pa1: pa == 7111010, sa matches F1202[0-9] ) r2: Record( psc == 101, fundType == 1, pa == $pa1, sa matches F1202[0-9] ) then System.out.println( rule FC.93 has been activated ); System.out.println( r1: + r1 ); System.out.println( r2: + r2 ); System.out.println(); end and the following set of facts: 1:new Record(101, 0942, 1, 7111010, F12020) 2:new Record(101, 0942, 1, 7111010, F12022) 3:new Record(101, 0942, 1, 7111010, F12024) 4:new Record(101, 0942, 1, 7111020, F12020) 5:new Record(101, 0942, 1, 7111020, F12022) With the rule above I expected to get only tuples 1,2 1,3 2,3 Or the printout: rule FC.93 has been activated r1: pa = 7111010, sa = F12020 r2: pa = 7111010, sa = F12022 rule FC.93 has been activated r1: pa = 7111010, sa = F12020 r2: pa = 7111010, sa = F12024 rule FC.93 has been activated r1: pa = 7111010, sa = F12022 r2: pa = 7111010, sa = F12024 Ie, get only 3 activations of the rule. For some reason I'm getting all possible combinations (or is it permutations?...): rule FC.93 has been activated r1: pa = 7111010, sa = F12024 r2: pa = 7111010, sa = F12024 rule FC.93 has been activated r1: pa = 7111010, sa = F12022 r2: pa = 7111010, sa = F12024 rule FC.93 has been activated r1: pa = 7111010, sa = F12024 r2: pa = 7111010, sa = F12022 rule FC.93 has been activated r1: pa = 7111010, sa = F12020 r2: pa = 7111010, sa = F12024 rule FC.93 has been activated r1: pa = 7111010, sa = F12024 r2: pa = 7111010, sa = F12020 rule FC.93 has been activated r1: pa = 7111010, sa = F12022 r2: pa = 7111010, sa = F12022 rule FC.93 has been activated r1: pa = 7111010, sa = F12020 r2: pa = 7111010, sa = F12022 rule FC.93 has been activated r1: pa = 7111010, sa = F12022 r2: pa = 7111010, sa = F12020 rule FC.93 has been activated r1: pa = 7111010, sa = F12020 r2: pa = 7111010, sa = F12020 I recall Edson mentioned that DROOLS would not select the same two facts in the tuple, but that what seems to be happening I think I must be doing smth wrong. How the rule should be modified to achieve the result I expect? Also, for some reason regex F1202\\d doesn't return any matches as well, while, supposedly the same pattern F1202[0-9] does... Thanks. Any hints are very appreciated! Vlad PS: I'm using DROOLS 3.1M on JDK 1.5.0_11 under the 3.1M Eclipse plugin. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Eclipse reports ExceptionInInitializer
Eclipse is reporting an ExceptionInInitializer in my DRL file. Does anyone have an idea what might be causing this? Thanks in advance, Scott ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Writing rules using java..
Just generate a drl from your model using a template langauge such velocity, freemarker or stringtemplate. you can generate and load the drl at runtime, this is what the decision table does. You can program agains the API yourself, but its quite complex, and certainly not recommended for a noobie. Mark Kolla, Sandeep wrote: Hi Rahul, Its not about storing the whole file into the database. I would have a Table representing the parameteres required to construct a rule. For example. Tables: *RuleSetTable:* Ruleset_id Ruleset_name *RuleTable:* Rule_id Rule_name Rule_saliance Rule_condition Rule_consequence Ruleset_id Now while loading the rules the application basically should read from the DB, and construct the rules, as everything required to construct the rules is avaliable in the tables. This requirement had come up because as the rules keep changing quite frequently, we don't want to bring down the application to load a new DRL file. Hope you understood what I want to achieve. Thanks much, Sandeep. ___ 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