Re: [rules-users] lock-on-active documentation

2009-03-15 Thread Wolfgang Laun
are not clear. Thank you for helping. Edson 2009/3/15 Wolfgang Laun wolfgang.l...@gmail.com From Drools-5.0.0, Expert, 7.8.1. Sentence numbers added by me: [1] when a ruleflow-group becomes active or an agenda-group receives the focus any rules that have lock-on-active set to try cannot

Re: [rules-users] Identify Rule on Attributes

2009-03-16 Thread Wolfgang Laun
On Mon, Mar 16, 2009 at 6:24 AM, Nikhil_dev k.nik...@verchaska.com wrote: As you guys have suggested to combine all the rule base into one then for example(one which i have already mentioned) i will combine Rule1 , rule 2 and rule3 into 1 rule base then, when i pass the variables to the

[rules-users] single binding for or CE flagged by compiler

2009-03-16 Thread Wolfgang Laun
As far as I know, this should work: package orel; import orel.Main.Trigger; rule ror1 when $t : (or Trigger(fa == 1) Trigger(fa == 2)) then System.out.println( fired + $t.getName() ); end This is what Drools-5.0.0 kbuilder.getErrors().toString() returns:

Re: [rules-users] single binding for or CE flagged by compiler

2009-03-16 Thread Wolfgang Laun
2009/3/16 Edson Tirelli tire...@post.com This is an old discussion. Single binding on or is a non-orthogonal special case on the language syntax that was introduced in the early days when we only had infix CEs. When we started to support prefix CE, the special case was not updated, and as

Re: [rules-users] Identify Rule on Attributes

2009-03-19 Thread Wolfgang Laun
It appears that you want to reason about travel bookings or some such thing. You are thinking of the various attributes as individual (abstract) things that have a designation (such as Adult Fare) and a value, with the intent to handle this with a set of facts, each of which has these two fields.

Re: [rules-users] forall over a collection

2009-03-20 Thread Wolfgang Laun
You don't need forall to solve your problem. The following rule prints all patient names which don't have problem 4711; omitting the 'not' prints those suffering from Colognitis. rule lookJoe when $patient: Patient() not ( Problem( code == 4711 ) from $patient.problemList )

Re: [rules-users] high cpu usage

2009-03-25 Thread Wolfgang Laun
The figures you gave just indicate that you have a good balance between I/O and CPU load. The increase between no rules and ~60 rules is to be expected as all the work is being done during fact insertion. Of course, adding more and more rules will, eventually, push the CPU load factor to the

Re: [rules-users] Writing rules using java from template

2009-03-31 Thread Wolfgang Laun
Could you describe the data you have in the DB and the types of your facts. Above all, do provide some examples. -W 2009/3/31 Meny Kobel meny.ko...@gmail.com Hi, Any updates regarding this subject? I have the same problem and can't find a solution. Like newbie I need to read varying rules

Re: [rules-users] Ensure all values in a list are unique?

2009-04-17 Thread Wolfgang Laun
Maybe I'm missing something but couldn't you simply create checkGroups as a SetStringand just compare its size() to $fact.Groups.size() ? rule check when $fact : StrColl( $gr : groups, eval( $gr.size() != (new HashSet( $gr )).size() ) ) then System.out.println( failed );

Re: [rules-users] Ensure all values in a list are unique?

2009-04-18 Thread Wolfgang Laun
(this != $group1, index == $index) then System.out.println($group2 + has a duplicate index ); end 2009/4/17 Wolfgang Laun wolfgang.l...@gmail.com Maybe I'm missing something but couldn't you simply create checkGroups as a SetStringand just compare its size() to $fact.Groups.size

Re: [rules-users] I want only first rule to be executed even more than one rule are fulfilling the LHS

2009-04-20 Thread Wolfgang Laun
The best way to do that would be to write the field constraints for testValue to check for exact ranges. You want, for instance to set percent to 15 if, and only if Test( testValue 50 = 80) As an alternative, write a function percent(int tv) computing the percent value and do rule RuleX

Re: [rules-users] == operator does not work on float and double type

2009-04-21 Thread Wolfgang Laun
The long answer to your question can be found in http://en.wikipedia.org/wiki/Floating_point. The short answer is that machine numbers for floats and doubles are approximations to almost all rational numbers, or, if you prefer, fractions. This is because most numbers have infinite binary

Re: [rules-users] Dynamic object structure Drools use case?

2009-04-21 Thread Wolfgang Laun
One thing that's not clear to me, but essential to a discussion of this problem: How do write (or even define) the rules if you don't know the actual properties the incoming Beans will have? -W 2009/4/21 Tina colemanseri...@gmail.com I'm trying to get a handle on whether Drools is the right

Re: [rules-users] need some advice in defining rules

2009-04-28 Thread Wolfgang Laun
Have you considered the simple fact that a month may have between four (full) and six (one or two fractional) weeks? Reminder objects ought to have a field identifying the week; if they have its easy to count them per week if they are simple facts in WM. Note that the identificaton of weeks by

Re: [rules-users] Retraction of facts based on time - any ideas please?

2009-05-03 Thread Wolfgang Laun
Create a single fact, say Clock, with a field time. Assuming that this value is updated once in a while, depending on the precision with which your time supervision should work, you may then write rules such as rule extract when Clock( $time : time ) e1 : Event (code == LOGON, status ==

Re: [rules-users] drl to pkg

2009-05-03 Thread Wolfgang Laun
This is what you might do: KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(); KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kBuilder.add( ResourceFactory.newFileResource( Movie.drl ), ResourceType.DRL );

Re: [rules-users] Debugging Drools when/then using breakpoints

2009-05-04 Thread Wolfgang Laun
There is no such thing as the point in flow of control where a rule's 'when' is executed. It is the foremost purpose of the Rete algorithm to avoid these straightforward evaluations of the LHS conditions as rule programmers see them in the rule text. Instead, LHSides are taken apart (by the rule

Re: [rules-users] Rule problem

2009-05-04 Thread Wolfgang Laun
I cannot reproduce your findings. Which bmi values cause the firing of two rules? Are you using exactly the same .drl file Greg sent? -W 2009/5/4 Femke De Backere femm...@gmail.com Thanks for the answer! But I sometimes get 2 rules that are correct, and that is impossible. I embedded Greg's

Re: [rules-users] Rule problem

2009-05-04 Thread Wolfgang Laun
heeft Wolfgang Laun het volgende geschreven: I cannot reproduce your findings. Which bmi values cause the firing of two rules? Are you using exactly the same .drl file Greg sent? -W 2009/5/4 Femke De Backere femm...@gmail.com Thanks for the answer! But I sometimes get 2 rules

Re: [rules-users] Rule problem

2009-05-05 Thread Wolfgang Laun
solved the problem by removing every double in the sample.drl. How van I fix the double problem if I really wanted to :)? In this case it is unnecassary but there must be a solution? Thanks for all the help! Femke Op 4-mei-09, om 21:48 heeft Wolfgang Laun het volgende geschreven: Don't use

Re: [rules-users] drools solver for 2d knapsack problem

2009-05-08 Thread Wolfgang Laun
Rectangles or simple polygons or worse? -W On Fri, May 8, 2009 at 9:02 AM, Olaf Raether o.raet...@epro.de wrote: Hey , i would like to use drools solver for a 2d knapsack problem. Has anyone expirience with that ? Is drools solver made for such a task ? Thank for hints Olaf Raether

Re: [rules-users] drools solver for 2d knapsack problem

2009-05-08 Thread Wolfgang Laun
problem more efficiently. -W On Fri, May 8, 2009 at 9:59 AM, Olaf Raether o.raet...@epro.de wrote: Rectangles within a Rectangle OR Wolfgang Laun-2 wrote: Rectangles or simple polygons or worse? -W On Fri, May 8, 2009 at 9:02 AM, Olaf Raether o.raet...@epro.de wrote: Hey

Re: [rules-users] drools solver for 2d knapsack problem

2009-05-08 Thread Wolfgang Laun
. And i have to put them on the truck. And the Business rules come into the play, cause the racks can only mounted in a special manner on the track. Any hint is welcome Wolfgang Laun-2 wrote: I've researched this, a long time ago (trying to find a solution for a problem from the worse

Re: [rules-users] NullPointerException with Wrapper objects

2009-05-13 Thread Wolfgang Laun
What about setting the field to 0 in the constructor of Salary? Or using float (not java.lang.Float)? -W 2009/5/13 Shabbir Dhari sdh...@hotmail.com I know this work around. But I have more than 50 rules using that attribute and it looks very ugly to put null on every rule and its not single

Re: [rules-users] NullPointerException with Wrapper objects

2009-05-13 Thread Wolfgang Laun
But you do control the insertion of your facts. Rather than cluttering rules with conditions dealing with irregular values, preprocess the object. And you should be able to log from there, just as well. -W 2009/5/13 Shabbir Dhari sdh...@hotmail.com I can not initialize property as need to log

Re: [rules-users] NullPointerException with Wrapper objects

2009-05-13 Thread Wolfgang Laun
Well, I hope you get paid for all the extra work ;-) Define, in your .drl file, function float safe( Float v ){ return v == null ? 0 : v; } and wrap all references to the dangerous field(s) in your LHS pattern expressions with this call, except, of course, in the rule where you fix and

Re: [rules-users] NullPointerException with Wrapper objects

2009-05-13 Thread Wolfgang Laun
2009/5/13 Shabbir Dhari sdh...@hotmail.com Thanks for all you efforts :) but what is the difference between calling function from every rule or putting null check. It's much easier to add. I give up. I am looking for other rule engines. As they must apparently (due to JavaBeans) be

Re: [rules-users] Re: Drools Flow Trigger process by ruleset

2009-05-13 Thread Wolfgang Laun
I think that the overloaded method for starting a process ksession.startProcess( String name, MapString,Object name2var ) is what you want. -W On Wed, May 13, 2009 at 4:17 PM, Brad Stone bst...@menloware.com wrote: Shannon Lal shannonlal2909 at gmail.com writes: Brad,Can you provide

Re: [rules-users] NullPointerException with Wrapper objects

2009-05-14 Thread Wolfgang Laun
All right, let's hope that business user is up to write the rules, even without null checks ;-) Seriously now: are they up to handling monetary units represented as floating point numbers? A recent thread has emphasized the problems arising from tests such as floatVal = floatConst, and I've been

Re: [rules-users] Comparing names

2009-05-14 Thread Wolfgang Laun
Assuming that your facts are structured as the indentation suggests, I would solve this using a technique you could call virtual field. So, if a fact object has fields String title ListPropGroup pgList and a PropGroup has fields String name ListString pList I would not try to get at

Re: [rules-users] Comparing names

2009-05-15 Thread Wolfgang Laun
of all names allNames; call fireAllRules; then in the DRL, for each Title compare Proprietor names (set) with allNames. How can I compare 2 sets like this in a DRL ? Ian Spence 2009/5/14 Wolfgang Laun wolfgang.l...@gmail.com Assuming that your facts are structured as the indentation suggests, I

Re: [rules-users] rule with low Salience is fired too early

2009-05-17 Thread Wolfgang Laun
For repeated changes of a fact (the Score thing, in your case) a stateful session should be used. Then, the update of your Score fact would be modify( s ){ setValue( s.getValue() + 4 ) // 4 or whatever } Repeated firing of the threshold rule is due to the Engine's reassessment of

Re: [rules-users] can drools support complex rules

2009-05-19 Thread Wolfgang Laun
Drools is very well equipped for handling large fact collections. As to the examples you cite, #1 and #2 are simple, as you apparently know. As for #3, check the documentation on the collect and accumulate patterns, which should satisfy you that it can be implemented without undue strain. (To wit:

Re: [rules-users] Class loading for facts used in rules

2009-05-21 Thread Wolfgang Laun
You are confusing several issues here. I take it that the ClassCastException is an error that occurs while you insert facts. At that time, all rule compiling has been done and the rulebase has been built. A ClassCastException is not a problem of some class or other being loaded (by Java's own

Re: [rules-users] Problems with ruleflow

2009-05-21 Thread Wolfgang Laun
There is an all too easily overlooked sentence in the Drools Flow User Guide in Section 3.2, whereas the code samples don't feature this call at all. -W 2009/5/21 David Sinclair dsincl...@chariotsolutions.com You are missing the kession.fireAllRules() after the

Re: [rules-users] can drools support complex rules (resetting of Accumulate?)

2009-05-21 Thread Wolfgang Laun
Well, it's definitely not forbidden to do a little computational work on the RHS, too. Bind the result to a variable: Number( $times : intValue 10 )... and, on the RHS, do for( int i = 1; i = $times % 10; i++ ) shout( alarm ); or whatever. -W On Thu, May 21, 2009 at 4:21 PM,

Re: [rules-users] fact granularity, performance, and other questions

2009-05-27 Thread Wolfgang Laun
I also think that the approach proposed by Greg of having a Message fact type and various Segment fact types would let you write efficient and maintainable rules. (The extreme splitting into Field facts has several drawbacks, as has been pointed out, and also: 'value' is always a string, so you

Re: [rules-users] Re: Drools performance issue

2009-06-01 Thread Wolfgang Laun
The first two patterns pair each driver assignment with each trip - which is quite a lot of work to do. (The infix and between the 2nd and 3rd pattern doesn't change this.) Also, the field restriction tripId in ($tid) is not the most efficient way. Try this: rule Assignment Check when $creVo:

Re: re[rules-users] move hardcoded values in DRL or have constants inside drl

2009-06-01 Thread Wolfgang Laun
But assigning a value to a global isn't straightforward - you can't do it in the declaration. You'll have to do it from the application (or use some dirty hack, in a start-up rule); either way it's separate from the declaration. IMHO, using a Java class with public static final is definitely

Re: [rules-users] RE: questions on guvnor and drools 5.0

2009-06-04 Thread Wolfgang Laun
On 6/4/09, Garner, Shawn garner.sh...@principal.com wrote: 2) How do you use the test scenarios with complex object structures? -eg Create a fact in working memory that has another Object in it which in turn has a list of Objects in it. -Seems like any Fact in working memory is

Re: [rules-users] Help creating a GUI for an example

2009-06-04 Thread Wolfgang Laun
I have a few idle days starting this weekend. I have some (real-world) experience doing 2D graphics with AWT, so I might qualify ;-) Send me the specs, please, unless you are already crowded by applications. -W On 6/3/09, Edson Tirelli tire...@post.com wrote: Hey people, To achieve a

Re: [rules-users] setFocus

2009-06-12 Thread Wolfgang Laun
For instance: ksession.getAgenda().getAgendaGroup( Group A ).setFocus(); -W 2009/6/12 Earnest Dyke earnied...@yahoo.com Converting a 4.0.7 project to 5.0.1 and StatefulKnowledgeSession does not have a .setFocus method like StatefulSession has. How do I accomplish the same function in

Re: [rules-users] Drools in the real world

2009-06-12 Thread Wolfgang Laun
The traffic on this list is quite substantial. Note that it is used if people run into a problem, not when they solve one. Judging Drools' industry usage from the traffic here is akin to saying that fine weather is tied to the Moon being full, which you don't see when it is new nor when the sky is

Re: [rules-users] Problem with parallel subflows

2009-06-13 Thread Wolfgang Laun
This sounds very much like the problem I ran into earlier this week. Kris has fixed it, on trunk. -W On 6/12/09, tom tom...@gmx.at wrote: Hi there! I am using drools 5.0 final. I tried to implement 2 subflows which are polling for database entries. More exactly: my application consists of 1

Re: [rules-users] Help -- Conditional Logic in DRL

2009-06-16 Thread Wolfgang Laun
Using a fact as a guard to block alternatives is tricky. For one thing, you cannot use a single global fact. (When would you reset this fact to the initial state so that the whole mechanism can work again for the next fact set to be processed by this rule set?) So, you might consider inserting a

Re: [rules-users] Compatibility of Drools for High Traffic events

2009-06-18 Thread Wolfgang Laun
I've been doing similar things in an ESME (direct SMSC connection) but without rules, as the conditions were much simpler, and just handling SMS messages themselves. I guess you'll base your decision on billing records, possibly in connection with subscriber data. Billing records might be a bit

Re: [rules-users] Drools Result

2009-06-20 Thread Wolfgang Laun
One good way of producing results from rules is indeed to create and insert an object as a fact. The idiom on the RHS is inser( new DroolsResult(...) ); The application could retrieve this with a query over all DroolsResult facts, and then retract the fact so that your WM is ready for another

Re: [rules-users] Compatibility of Drools for High Traffic events

2009-06-20 Thread Wolfgang Laun
:35 +0200, Wolfgang Laun wrote: I've been doing similar things in an ESME (direct SMSC connection) but without rules, as the conditions were much simpler, and just handling SMS messages themselves. I guess you'll base your decision on billing records, possibly in connection with subscriber

Re: [rules-users] Need help with setFocus

2009-06-24 Thread Wolfgang Laun
It's impossible to diagnose exactly what goes on without seeing the LHS patterns in detail. One possible reason for the rules rule[234] in groupX not firing the second time that group is given focus is that none of the objects participating in the LHS of the three rules has changed since the first

Re: [rules-users] firing explicit rules or agend-groups

2009-06-25 Thread Wolfgang Laun
The Expert User Guide, section 2.5.7.3., Agenda Filters, is probably what you are remembering. Also, see the javadoc on org.drools.runtime.rule, interface StatefulRuleSession, method void fireUntilHalt(AgendaFilter agendaFilter) etc. -W On 6/25/09, Chris Richmond crichm...@referentia.com wrote:

Re: [rules-users] How to retrieve the Rule names in the drools rule file

2009-06-30 Thread Wolfgang Laun
You might use the API to retrieve all rules in your KnowledgeBase KnowledgeBase kBase = ...; for( KnowledgePackage kp: kBase.getKnowledgePackages() ){ for( Rule r: kp.getRules() ){ String name = r.getName(); String purpose = r.getMetaAttribute( Purpose ); // or

Re: [rules-users] Drools 5 - how create Logger for Template File based rules?

2009-07-01 Thread Wolfgang Laun
You can use a KnowledgeBuilder with template-derived DRL-resources and set up your KnowledgeBase from its results the same way you do it with plain .drl-files. Obtain a StatefulKnaowledgeSession and pass this to the KnowledgeRuntimeLoggerFactory, as in your first code sample. -W On 6/30/09,

Re: [rules-users] Formula value assginment in LHS

2009-07-05 Thread Wolfgang Laun
While thinking this over, several things have come to my mind. (1) Obviously you are using double for representing monetary values. This is dangerous, as even simple calculations may result in values that are not acceptable due to accounting customs or tax laws. (2) The effort for checking is

Re: [rules-users] Drools 5 - how create Logger for Template File based rules?

2009-07-05 Thread Wolfgang Laun
rulesSession.fireAllRules(); /pre Wolfgang Laun-2 wrote: You can use a KnowledgeBuilder with template-derived DRL-resources and set up your KnowledgeBase from its results the same way you do it with plain .drl-files. Obtain a StatefulKnaowledgeSession and pass this to the KnowledgeRuntimeLoggerFactory

Re: [rules-users] Does evaluating two facts of same type in one when condition works?

2009-07-05 Thread Wolfgang Laun
The rule is capable of locating two different facts of type PlaceHolder because you wrote it that way: one is supposed to have a field value equal to 1, and the other one equal to 2. (Clearly, there cannot be one fact where value equals 1 and 2 at the same time.) Drools (and other rule-based

Re: [rules-users] How execute a Single rule from rule file or rule package

2009-07-05 Thread Wolfgang Laun
The concept of executing a rule isn't useful. Rules are written to fire whenever their conditions are met by some set of facts. So, if all of your rules fire, then all conditions are met. Consider the condition defining the single rule you want to fire. Can this condition be derived from one or

Re: [rules-users] Exists CE behaviour

2009-07-13 Thread Wolfgang Laun
Quite right, since not(not(Foo())) is equivalent to exists(Foo()). Martin, would you please submit a JIRA? -W On 7/13/09, Chivotario Martin chivota...@gmail.com wrote: Hi Visu, My understanding (also tested) is that activations are created no matter the knowledge base has the rule packages

Re: [rules-users] Exists CE behaviour

2009-07-13 Thread Wolfgang Laun
allows me to open this a a JIRA i would try to understand how to use it :D and would do so. Regards, Manuel. 2009/7/13 Wolfgang Laun wolfgang.l...@gmail.com Quite right, since not(not(Foo())) is equivalent to exists(Foo()). Martin, would you please submit a JIRA? -W On 7

Re: [rules-users] Exists CE behaviour

2009-07-13 Thread Wolfgang Laun
, because both rules are present :D. However, thanks for creating the issue ! Regards, Manuel. 2009/7/13 Wolfgang Laun wolfgang.l...@gmail.com https://jira.jboss.org/jira/browse/JBRULES-2206 created. Thanks for the code! -W On 7/13/09, Chivotario Martin chivota...@gmail.com wrote: Hi

Re: [rules-users] Comparing multiple accumulations

2009-07-14 Thread Wolfgang Laun
The second accumulate has amountInPence 0 but the values in your data are all positive. Therefore,... -W 2009/7/14 Richard Sherman rsherman...@hotmail.com: Thanks Wolfgang, Here's the extra information as requested. Firstly the When creating the email I was removing all references to rent

Re: [rules-users] Comparing multiple accumulations

2009-07-14 Thread Wolfgang Laun
For simplicity's sake, I'll only consider the first example, where all transactions with amount 0 are also Type 1. Let P be the sum of the positive values and N (0) the sum of the negative values over all transactions. Then $charges = P $adjustment = 29/336*N intValue = -P - N The last

Re: [rules-users] looking for more information on drools expert

2009-07-15 Thread Wolfgang Laun
2009/7/15 Edson Tirelli tire...@post.com:    Aldian,    Yes, this is the way to go: rule detect and set routers different from root for alarm 45 When    * All routers which index is different from 0 are raising the alarm 45    * There is an alarm $a of numero 45 raised by an equipement $e

Re: [rules-users] looking for more information on drools expert

2009-07-16 Thread Wolfgang Laun
accumulate is indeed complex; the simpler collect might be applicable as well in this case. rule all45_A when forall ( Equipment( parent == 0, $id : id ) Alarm( cause == 45, source == $id ) ) $alarms : ArrayList() from collect( Alarm( cause == 45, $source : source ) )

Re: [rules-users] Updating a Boolean object in the WM

2009-07-16 Thread Wolfgang Laun
Well, you can't change a Java object Boolean b; assigning another Boolean to b changes the object reference stored in b. Boolean has no setters. Notice that the CE when Boolean() always is true irrespective of the Boolean object that's in the WM. If writing a Java fact class

[rules-users] 3rd International Rules Challenge - Call for Submissions

2009-07-18 Thread Wolfgang Laun
[Our apologies if you receive duplicates of this posting] Call for Submissions 3rd International Rules Challenge at RuleML-2009 co-located with the Business Rules Forum November

Re: [rules-users] optimization on a lot of simple rules

2009-07-19 Thread Wolfgang Laun
It's difficult to suggest an optimized form for your rules 1-infinity, since we do not know what you want to achieve. The crude duplication of rules where only the constant to be matched with Product.id varies can, most likely, be avoided. -W On Sun, Jul 19, 2009 at 3:15 PM, nesta

Re: [rules-users] optimization on a lot of simple rules

2009-07-20 Thread Wolfgang Laun
, besides this, the price is affected by usage. I want to use Product.id to match the rules. As you mentioned The crude duplication of rules where only the constant to be matched with Product.id varies can, most likely, be avoided. How to avoid it in this scenario? Wolfgang Laun-2 wrote: It's

Re: [rules-users] Problem when using multiple rule files (Drools 5)

2009-07-23 Thread Wolfgang Laun
On 7/23/09, Olaf Raether o.raet...@epro.de wrote: The code looks like this: RuleBase ruleBase = RuleBaseFactory.newRuleBase(); for (int i = 0; i rules.length; i++) { Package pkg = getPackage(i); ruleBase.addPackage(pkg); } I'd expect to find Package pkg = rules[i]; or

Re: [rules-users] Problem when using multiple rule files (Drools 5)

2009-07-23 Thread Wolfgang Laun
()); } --- Hope this helps - to help me ! Wolfgang Laun-2 wrote: On 7/23/09, Olaf Raether o.raet...@epro.de wrote: The code looks like this: RuleBase ruleBase = RuleBaseFactory.newRuleBase(); for (int i = 0; i rules.length; i

Re: [rules-users] Problem when using multiple rule files (Drools 5)

2009-07-27 Thread Wolfgang Laun
Could it be that the fact where the NPE happens during its insert contains a field of some wrapper type (e.g.)Integer that's null and needs to be converted to a simple type (e.g. int)? But the same NPE should happen when you insert the same fact with rules coming from a single file - but you'll

Re: [rules-users] Using ArrayList as global in DRL file

2009-07-29 Thread Wolfgang Laun
Does your Destination class have a field FieldMember? -W 2009/7/29 Divya Rajendranath divya.rajendran...@gmail.com Hi, I am setting an ArrayList as a Global on my drools session by saying ... StatefulSession drlSession = getRuleManager().getSession(); drlSession.setGlobal(myMailingList,

Re: [rules-users] org.drools.RuntimeDroolsException when inserting into Knowledge Session

2009-08-01 Thread Wolfgang Laun
The global ao must be assigned to the ksession, from your Java code, by calling ksession.setGlobal( ao, assertionObject ) before you do anything that triggers LHS evaluations. See Drools Expert, section 4.5.2. The WM and rule setup as you present it does not make sense (to me). If you insert

Re: [rules-users] Templates Documented as Experimental from Community, not from Red Hat

2009-08-05 Thread Wolfgang Laun
2009/8/5 Mark Proctor mproc...@codehaus.org Ken Archer wrote: The jboss.org documentation describes rule templates as an experimental feature. In particular, the API is subject to change. However, the Red Hat documentation does not caveat rule templates as experimental in any way. Are

Re: [rules-users] Using Enums in when clause

2009-08-06 Thread Wolfgang Laun
In gameWinner == PARTICIPANTS.HOME.getId(), the second operand isn't an enum, it's a method call on an enum object. Hence, it must be written as a Return Value Restriction (cf. Expert doc on a Rule's LHS), thus ..., gameWinner == ( PARTICIPANTS.HOME.getId() ), ... -W 2009/8/6 Zevenbergen,

Re: [rules-users] Strategy for initializing objects

2009-08-07 Thread Wolfgang Laun
Your goal and the presented code aren't clear to me. The consequence (after then) contains calls to static/class methods (Box.setX()) which isn't going to change anything in your fact object. The call b.setX() might change your object, but this depends on what the class method Box.getX() returns.

Re: [rules-users] populating global variable in Condition Section?

2009-08-21 Thread Wolfgang Laun
quote It is rather common for people to write something like (not (exists (A))), but this is just a very inefficient way to write (not (A)). /quote Kudos to Ernest Friedman-Hill to put this sentence into the Jess documentation. Maybe I should quote hiom in the Drools Expert doc ;-) -W On

Re: [rules-users] Using RuleDescr, PackageDescr... Classes from org.drools.lang.descr

2009-08-25 Thread Wolfgang Laun
These classes are not part of the stable API, which is considered safe, i.e., not threatened by future changes. Also, the lack of javadoc is appalling. And if that's not enough, creating and maintaining any but the simplest LHS compositions programmatically is a mind-straining exercise, for which

Re: [rules-users] java.lang.IllegalArgumentException: Could not parse knowledge.

2009-08-26 Thread Wolfgang Laun
Hi Edson, love this one – (!) a marvellous case of To See and See Not ;-) Lindy copy-pasted the Vote.drl from the cited HTML page which must have been run over by some text processor which promptly converted space surrounded hyphens into an EN DASH, codepoint 0x2013 = 8211. -W 2009/8/25 Edson

Re: [rules-users] Looking for guidance / approach to porting a question graph to Drools

2009-08-28 Thread Wolfgang Laun
See below. On Fri, Aug 28, 2009 at 12:49 AM, tim fulcher against.entr...@googlemail.com wrote: Hi Making no bones about it, this is a broad topic request and I've got little hands-on Drools experience, just looking for some pointers on a potential Drools approach, feedback appreciated.

Re: [rules-users] Why so many ACTIVATION/DEACTIVATION events?

2009-09-01 Thread Wolfgang Laun
Hi Tom, your understanding of Activation is fine, so let's see what happens if your rule RS... fires. (I'm abbreviating names.) Initially, neither PolSet nor PolSetId are there, so RS... activation #1 is on the agenda, fires and executes the consequence. Now, PolSet is created and inserted as a

Re: [rules-users] question on drools and method calls on facts

2009-09-02 Thread Wolfgang Laun
It depends whether you are a purist, a pragmatist, or a maverick. A few random thoughts, and note that I consider myself a repenting pragmatist ;-) Having fact classes with methods that modify the object in addition to the usual setters is dangerous; a toString() according to the convention is

[rules-users] forall/from/eval/contains: odd DRL syntax error

2009-09-02 Thread Wolfgang Laun
A rule has to ascertain that all elements in a ListElemBoxStatusin a Collector occur in the matching BoxResponse's SetElemBoxStatus. There is just one BoxResponse per Collector. This here works fine: rule matchCollectorResponse when $c : Collector( $ebsList : elemBoxStatusList, $gsSet

Re: [rules-users] Scaling to large numbers of rules

2009-09-03 Thread Wolfgang Laun
If your 200K rules are all of the same few patterns (1, 2 and 3 attribute equalities) then expanding this into all combinations may not be the way to go. Can you provide a little more detail about whether the 1/2/3 attributes are always from the same fact type, and how many of these

Re: [rules-users] Drools as Lexer / Parser (sequential data processing)

2009-09-04 Thread Wolfgang Laun
The rules for a lexer are bound to be all of the same standard pattern: rule FirstDigit salience 0 where $i : Input( $ch : character matches \d ) $l : Lexer( state == State.IDLE, $buf : buffer ) then $buf.setLength( 0 ); $buf.append( $ch ); modify( $l

Re: [rules-users] (no subject)

2009-09-04 Thread Wolfgang Laun
A returnValue restriction takes the form field relop ( expression ) (homeHalfTimeScore + awayHalfTimeScore) 0 = homeHalfTimeScore ( - awayHalfTimeScore ) -W On 9/4/09, Zevenbergen, Alex azevenber...@paddypower.com wrote: Hi all, This rule clause fails to evaluate, I am

[rules-users] RuleML 2009 Call for Participation and Rules Challenge Extended Submission Deadline Preliminary Program

2009-09-04 Thread Wolfgang Laun
Systems Rule Systems on the Web 13:45 Challenges for Rule Systems on the Web. Yuh-Jong Hu, Ching-Long Yeh and Wolfgang Laun 14:00 A modest proposal to enable RIF dialects with limited forward compatibility. Christiane de Sainte Marie 14:15 RIF RuleML Rosetta Ring: Round-Tripping the Dlex Subset

Re: [rules-users] Getting the return from a funcion

2009-09-10 Thread Wolfgang Laun
You cannot bind a variable to a function result, as in $word : hasForbiddenWordsSet( ... ). I'd use the original boolean function hasForbiddenWordsSet (which might even include the check against getTitle() returning null), and add another function, returning the string, to be called after 'then'.

Re: [rules-users] compiled package too big

2009-09-25 Thread Wolfgang Laun
One proposal: Don't put the values to which you compare the attributes into rules; put them into additional facts. Consider: rule bounds_a_1_10 when Fact( a = 1 = 10 ) then ... end and similar for 11:100, 101:1000,... could be handled by a single rule and a set of Limit-type facts: rule

Re: [rules-users] infinite loop rules problem

2009-09-28 Thread Wolfgang Laun
Collecting stuff from several matches into a single Collector fact is best done by letting matches occur with rules at salience N. Then, put a single rule matching the Collector, without any constraints, at salience N. This matches any Collector fact, and, in the consequence you should remove

Re: [rules-users] Better ways to write left hand sides

2009-09-29 Thread Wolfgang Laun
On Tue, Sep 29, 2009 at 12:43 AM, Dave Schweisguth d...@schweisguth.orgwrote: Greetings fellow Droolers, I've just begun using Drools and am very happy with it so far as it seems to be a great fit for what we want to do. My left hand sides are not quite beautiful enough, however, and I

[rules-users] Bug: equally named functions in different .drl files

2009-09-30 Thread Wolfgang Laun
If there are two different .drl files in the same package each of which contains a function with name x, and if we have calls to x in both files, expecting to call the local x, respectively: (a) if the function signatures are identical, then this compiles without errors, but at runtime only one

Re: [rules-users] Division Operator in a Rule Condition

2009-10-02 Thread Wolfgang Laun
Check the Expert manual. What you need here is a so-called Return Value Restriction where you relate a field and a parenthesized expression using a relational operator; i.e.: field op ( expr ) Therefore, $b/$c = 105 is not correct, but $b = ( 105*$c ) is (apart from possible truncation if $b and

Re: [rules-users] unable to resolve method using strict-mode

2009-10-02 Thread Wolfgang Laun
2009/10/2 Vladimir Perlov vladp...@hotmail.com Here is the rule that failed to compile on Linux: rule TEST dialect mvel Send when map : Map() $map : Map() or omit '$' in the consequence. -W then System.out.println($map.get(x).getSomeMethod());

Re: [rules-users] unable to resolve method using strict-mode

2009-10-02 Thread Wolfgang Laun
Map() in the .drl file is bound to be interpreted as MapObject,Object so that a Map.get() returns an Object. To be able to call method getSomeMethod() you'd have to cast this result, according to ((SomeClass)$map.get(x)).getSomeMethod() I fail to understand how this could ever be avoided -

Re: [rules-users] unable to resolve method using strict-mode

2009-10-03 Thread Wolfgang Laun
The Java code in the archive just compiles a .drl file, and there's no reason this should fail. The class cast would only appear to be missing after a Map object is inserted into WM, and the session is run so that the rule fires. -W 2009/10/2 Vladimir Perlov vladp...@hotmail.com It's compiled

Re: [rules-users] Better way to run each rule once?

2009-10-08 Thread Wolfgang Laun
I see no cogent reason for implementing Identifiable for each fact class. The hashCode() any object returns should be distinct enough, especially considering that all the hash codes are munched together, which is definitely not *guaranteed* to result in different values for *all* rule and fact set

Re: [rules-users] setting globals in rule file

2009-10-14 Thread Wolfgang Laun
No, globals can only be set by calling the WorkingMemory method wm.setGlobal(String name, Object value) You could call this in a consequence (RHS), but it's usually not a good idea to do so. What do you want to achieve? -W 2009/10/14 Chris Richmond crichm...@referentia.com Shouldn’t it

Re: [rules-users] setting globals in rule file

2009-10-14 Thread Wolfgang Laun
: rules-users-boun...@lists.jboss.org] *On Behalf Of *Wolfgang Laun *Sent:* Wednesday, October 14, 2009 7:50 AM *To:* Rules Users List *Subject:* Re: [rules-users] setting globals in rule file No, globals can only be set by calling the WorkingMemory method wm.setGlobal(String name, Object

Re: [rules-users] setting globals in rule file

2009-10-14 Thread Wolfgang Laun
this and call it? Thanks Chris From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Wednesday, October 14, 2009 8:15 AM To: Rules Users List Subject: Re: [rules-users] setting globals

Re: [rules-users] setting globals in rule file

2009-10-14 Thread Wolfgang Laun
...@lists.jboss.org [mailto: rules-users-boun...@lists.jboss.org] *On Behalf Of *Wolfgang Laun *Sent:* Wednesday, October 14, 2009 8:50 AM *To:* Rules Users List *Subject:* Re: [rules-users] setting globals in rule file I've used functions with Drools 5, but not with MVEL. A recent thread seemed

  1   2   3   4   5   6   7   8   9   10   >