[rules-users] enums
Hello, If have an input object Inputobject which contains an enum Parameter which contains all allowed parameters of InputObject: The entries for the parameters are stored in a map: private HashMapParameter, String stringParameters; If I try: io: InputObject ( stringParameters[InputObject.Parameter.ParameterName] == something) I got the error =Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule Compilation error Kind Regards Thomas ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Filter incorrect abbreviations
Hello Droolers, I'm a Drools novice and I'm stuck with a basic rule problem. In my domain I use a list of abbreviations to describe the conditions of a system. Before I can check the state of my system I have to verify all applied abbreviations. The List of abbreviations is not a fixed list it's more like a combination of chars, combined in different ways on fixed positions. This is a small cutout: A cutout of possible chars at Position 1: A B C D F H A cutout of possible chars at Position 2: - A C s n b A cutout of possible chars at Position 3: - A B E F M A cutout of possible chars at Position 4: - H L O R U Now it is allowed to combine the following abbreviations: (another small cutout) A--O A--R A--UA--L BAAO BAAR BAAUBAAL but it is not allowed to combine this: AA** B-** (* stands for all possible chars on a position) Now I have 2 basic Questions: 1) How can I pick abbreviations that are NOT allowed? I think it's easy to say: rule Rule 1 when a : Abbreviation( pos1 == 'A', pos2 == '-', pos3 == '-', pos4 == 'O' ) then # do something positiv end But how can I pick up all the wrong combinations without hardcoding them? This would end up in a never-ending story. 2) Upgrading the Rule 1 from my 1st Question I'm looking for a way to make the Rules more generic. I don't want to hardcode all possible abbreviation combinations. How can I realise something like this VERY INFORMAL notation: rule Rule 2 when a : Abbreviation( pos1 == 'A', pos2 == ['-','D','H'], pos3 == '-', pos4 == ['O', 'R', 'U', 'L'] ) # If abbreviation looks like A--O, AD-O, AD-U, AH-R, etc. everything is fine. # It's time for Rule 2 to do something positiv then # do something positiv end Rule 2 should find all the abbreviations that are build up according to a set of allowed char combinations. OR rule Rule 3 when a : Abbreviation( pos1 == 'A', pos2 != ['-','D','H'], pos3 != '-', pos4 != ['O', 'R', 'U', 'L'] ) # If abbreviation looks like AA-O, AB-U, A-AO, A--K, etc. something is wrong. # It's time for RULE 3 to announce something negative then # announce something negative end Rule 3 should filter all the abbreviations that are violating a set of allowed char combinations. Thanx 2 all droolers in advance. Pete ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Function import problem in BRMS
Hi All, I am still a novice in using jboss BRMS web based tool, i have a question regarding static function imports. I have added rule file using technical rule-text editor. Any function imports added to this file gives validation errors, with error message unknown:4:0 mismatched token and there is no option to add import function in package header. How am i suppose to use static function imports from a helper class when BRMS web based tool is used? Thanks a lot. Poornima. -- regards, * Poornima P S Openstream Technologies (India) Private Limited #13, 30th cross, Thilak Nagar Main Road, Jayanagar (E), Bangalore - 560 041 Tel: +91-80-26545713 Extn:215 Fax: +91-80-26657928 * www.openstream.com http://www.openstream.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] enums
I don't understand the structure, could you post more source please? --I Am 28.07.2008 um 13:43 schrieb thomas kukofka: =Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] enums
Try a simple rule that just checks for any InputObject to make sure you have the class imported correctly. Rule x when InputObject() then end thomas kukofka wrote: Hello, If have an input object Inputobject which contains an enum Parameter which contains all allowed parameters of InputObject: The entries for the parameters are stored in a map: private HashMapParameter, String stringParameters; If I try: io: InputObject ( stringParameters[InputObject.Parameter.ParameterName] == something) I got the error =Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule Compilation error Kind Regards Thomas ___ 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] enums
Hi, I tried this. No problem at all. I can use enums also like this: io: InputObject(type == InputObject.Parameter.PARAMETERNAME) Only this causes the error: private HashMapParameter, String stringParameters; public HashMapParameter, String getStringParameters() { return stringParameters; } public void setStringParameters(HashMapParameter, String stringParameters) { this.stringParameters = stringParameters; } * io: InputObject ( stringParameters[InputObject.Parameter.ParameterName] ==* *something) -** Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule ** Compilation error** * If I use String instead of Parameter it works again: private HashMapString, String stringParameters; * io: InputObject ( stringParameters[somestring] ==* *something) * Thomas *Scott Reed* sreed at avacoda.com rules-users%40lists.jboss.org?Subject=%5Brules-users%5D%20enumsIn-Reply-To=d8ac9d7f0807280443j5c9edd90u2112c0e05a3c375f%40mail.gmail.com *Mon Jul 28 09:10:48 EDT 2008* Try a simple rule that just checks for any InputObject to make sure you have the class imported correctly. Rule x when InputObject() then end thomas kukofka wrote: * Hello, ** ** If have an input object Inputobject which contains an enum Parameter which contains all allowed parameters of InputObject: ** ** ** The entries for the parameters are stored in a map: ** private HashMapParameter, String stringParameters; ** ** If I try: ** io: InputObject ( stringParameters[InputObject.Parameter.ParameterName] == ** ** ** something) ** ** I got the error ** =Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule ** Compilation error ** ** Kind Regards ** Thomas* ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] database access via JDBC
You can use any technology you like to get data from outside the Working Memory using the from keyword. Look at the documentation for more details. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of thomas kukofka Sent: 28 July 2008 14:01 To: Rules Users List Subject: [rules-users] database access via JDBC Hello, is it possible to access a database from within the rule file via JDBC? I only read about access via Hibernate. Is there any JDBC example? regards Tom ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] query or global
what are disadvantages and advantages of the following possibillities to to get access to working memory facts from outside: Is there a reason why you want to use something other than queries? I would suggest to use queries _unless_ you have a definitive requirement that requires something else. Queries are easy and you get constraints for free. Everything else is just work. ;-) If you need to use logicals, you also have to implement an event listener in your facts to track them properly. Cheers --I Am 28.07.2008 um 15:15 schrieb thomas kukofka: Hello again, what are disadvantages and advantages of the following possibillities to to get access to working memory facts from outside: - -uses a query: in drl: query queryname ... end in java code queryResults results = workingMemory.getQueryResults( queryname ); - -use globals that store facts: global java.util.HashMap service rule XY when f: FactX () then ResultFact resultFact = new ResultFact(); service.put(f.getName(), resultFact); insert(resultFact); end kind regards tom ___ 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] Measuring Drools Memory Usage
Hi, Has anyone attempted to measure the incremental memory usage of using Drools? Anyone cares to share their methodology? I am currently following the following methodology: 1. Prevent garbage collection from happening by using large Xms Xmx (1024m in my case), a NewRatio of 2 (I am sure other sizes will work as well) and verbogegc enabled to confirm that no garbage collection is happening. 2. Use Runtime.freeMemory before and after fireAllRules and measuring the difference. The problem with my methods so far has been that after a positive memory usage (indicating you are using memory), subsequent use case (the same one) incurs zero memory usage which is very strange. So I guess my question is 2 fold: anyone care to share their methodology, and can anyone see what's wrong with mine? Thanks, Roger ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] enums
Thomas, This is beyond my level of expertise. I hope someone else here can help you. It looks like a bug. Sorry, Scott thomas kukofka wrote: Hi, I tried this. No problem at all. I can use enums also like this: io: InputObject(type == InputObject.Parameter.PARAMETERNAME) Only this causes the error: private HashMapParameter, String stringParameters; public HashMapParameter, String getStringParameters() { return stringParameters; } public void setStringParameters(HashMapParameter, String stringParameters) { this.stringParameters = stringParameters; } / io: InputObject ( stringParameters[InputObject.Parameter.ParameterName] ==/ /something) -// Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule // Compilation error// / If I use String instead of Parameter it works again: private HashMapString, String stringParameters; / io: InputObject ( stringParameters[somestring] ==/ /something) / Thomas *Scott Reed* sreed at avacoda.com mailto:rules-users%40lists.jboss.org?Subject=%5Brules-users%5D%20enumsIn-Reply-To=d8ac9d7f0807280443j5c9edd90u2112c0e05a3c375f%40mail.gmail.com /Mon Jul 28 09:10:48 EDT 2008/ Try a simple rule that just checks for any InputObject to make sure you have the class imported correctly. Rule x when InputObject() then end thomas kukofka wrote: / Hello, // // If have an input object Inputobject which contains an enum Parameter which contains all allowed parameters of InputObject: // // // The entries for the parameters are stored in a map: // private HashMapParameter, String stringParameters; // // If I try: // io: InputObject ( stringParameters[InputObject.Parameter.ParameterName] == // // // something) // // I got the error // =Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule // Compilation error // // Kind Regards // Thomas/ ___ 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