[rules-users] Looking for a Drools lecturer

2011-10-26 Thread Laurence Vignollet
Hello,

We have introduced a rule-engine course in a 5th year of Computer 
Science Study in University of Savoie, France.

We would like to give some hours on a Drools initiation, including 
practise, to the 20 students attending this course.

If somebody could be interested, please contact me by email.

Thanks in advance,

all the best,
Laurence Vignollet
-- 
Université de Savoie
Campus Scientifique
73370 Le Bourget-du-Lac
Tel : +33 (0)479 758 847
Fax : +33 (0)479 758 690
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Looking for a Drools lecturer

2011-10-26 Thread Salaboy
I'm extremely interested can you elaborate a little bit more about what are you 
planning to do?
Cheers

- CTO @ http://www.plugtree.com
- MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jbug.com.ar
- Mauricio Salaboy Salatino -

On 25/10/2011, at 23:34, Laurence Vignollet laurence.vignol...@univ-savoie.fr 
wrote:

 Hello,
 
 We have introduced a rule-engine course in a 5th year of Computer 
 Science Study in University of Savoie, France.
 
 We would like to give some hours on a Drools initiation, including 
 practise, to the 20 students attending this course.
 
 If somebody could be interested, please contact me by email.
 
 Thanks in advance,
 
 all the best,
 Laurence Vignollet
 -- 
 Université de Savoie
 Campus Scientifique
 73370 Le Bourget-du-Lac
 Tel : +33 (0)479 758 847
 Fax : +33 (0)479 758 690
 ___
 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] Looking for a Drools lecturer

2011-10-26 Thread Baiyuan Tang
It's a online session?
We are very interesting.

Best Regards,
Tony(Baiyuan, Tang)
Insigma Hengtian Software Ltd.
(C) +86-13858148802

-Original Message-
From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Laurence Vignollet
Sent: 2011年10月26日 14:35
To: Rules Users List
Subject: [rules-users] Looking for a Drools lecturer

Hello,

We have introduced a rule-engine course in a 5th year of Computer 
Science Study in University of Savoie, France.

We would like to give some hours on a Drools initiation, including 
practise, to the 20 students attending this course.

If somebody could be interested, please contact me by email.

Thanks in advance,

all the best,
Laurence Vignollet
-- 
Université de Savoie
Campus Scientifique
73370 Le Bourget-du-Lac
Tel : +33 (0)479 758 847
Fax : +33 (0)479 758 690
___
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] [planner][5.3.0.Final] Benchmark

2011-10-26 Thread Geoffrey De Smet



Op 25-10-11 15:57, Guilherme Kunigami schreef:
I'm trying to upgrade from drools 5.2.0 to 5.3.0 and having some 
difficulties with the planner benchmark.


I'd like to make a set of move factories common to all local search 
solvers, by adding them to inheritedSolverBenchmark block. But it 
seems that the localSearch environment always requires a selector, so 
I can't specify the localSearch environment for the solverBenchmark's 
 without providing a selector. Here's a piece of code that gives 
runtime error: http://paste.ubuntu.com/718806/

From the UpgradeFromPreviousVersionRecipe.txt:

Warning for *SolverBenchmarkConfig.xml:
  If the inheritedSolverBenchmark contains a selector, acceptor 
or forager,
  that can no longer be inherited individually. Copy the selector, 
acceptor or forager to every solverBenchmark.
  Because a benchmark specific localSearch will not overwrite the 
inheriting localSearch,
  but instead add an extra localSearch phase, which will result in 2 
separate, sequential localSearch phases.



This is annoying indeed... but as we can now define multiple phases to 
be run sequentially for 1 solver, for example

localSearch20 minutes simulated annealing/localSearch
localSearch10 minutes tabu search/localSearch
I haven't see a good way yet on how to define inheriting that it works 
properly.
If you got an idea, open an issue (issues.jboss.org JBRULES) and clearly 
describe it there.


The error is:
Exception in thread main java.lang.IllegalArgumentException: A 
selector requires configuration, for example a moveFactoryClass.


--- Note ---

If I understood correcly, the following configuration from examination 
examples:


examinationStepLimitSolverBenchmarkConfig.xml

contains a bug, because it specifies a maximum step count for a 
general solver


termination
maximumStepCount70/maximumStepCount
/termination

This gave the following exception:

Exception in thread main java.lang.UnsupportedOperationException: 
StepCountTermination can only be used for phase termination.

Thanks for reporting this, I 'll fix it.


Thanks,


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


--
With kind regards,
Geoffrey De Smet

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] [drools planner 5.3.0 Final] cached planning values

2011-10-26 Thread Geoffrey De Smet
Even if you didn't set something properly, it's an issue that planner 
crashes without a decent error message.
I created this issue:
   https://issues.jboss.org/browse/JBRULES-3265


It's during construction heuristics.
Apparently you got a planning entity which has a planning variable which 
has no possible planning values in that ValueRange.
For example: you got a Course which has a room property but when you 
look at the value range with the possible Room values, it's empty.
Are you using ValueRangeBySolutionProperty ?

Op 25-10-11 20:37, guyver schreef:
 I get the following exception when i try to solve and don't know if i didn't
 set something properly on my side or if there is a bug in the planner.

 After debugging, seems like cachedPlanningValues in PlanningValueCreator is
 being created as an empty collection and when PlanningValueWalker gets
 cachedPlanningValues's iterator and tries to iterate through it then it gets
 a  NoSuchElementException. I am a little confused as to when the
 extractPlanningValues method is called in PlanningValueSelector to get a
 collection of planned values a null is begin passed in instead of a planning
 entity which is responsible for the empty cachedPlanningValues collection.

 Any help on this issue will be much appreciated.

 java.util.NoSuchElementException
   at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:61)
   at
 org.drools.planner.core.heuristic.selector.variable.PlanningValueWalker.initWalk(PlanningValueWalker.java:90)
   at
 org.drools.planner.core.heuristic.selector.variable.PlanningVariableWalker.initWalk(PlanningVariableWalker.java:104)
   at
 org.drools.planner.core.constructionheuristic.greedyFit.decider.DefaultGreedyDecider.decideNextStep(DefaultGreedyDecider.java:58)
   at
 org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:62)
   at
 org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:166)
   at
 org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:138)

 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/drools-planner-5-3-0-Final-cached-planning-values-tp3452270p3452270.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


-- 
With kind regards,
Geoffrey De Smet


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] dsl and metadata rule information

2011-10-26 Thread gcautiero
Hello,

I'm not able to find a way to define in my DSL a phrase to add metadata for
a certain rule.
I'm interested to provide something that can help end user to add
data-effective metadata for some rule in the DSLR file.

--
View this message in context: 
http://drools.46999.n3.nabble.com/dsl-and-metadata-rule-information-tp3454282p3454282.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] Decision Table with more than 9 parameters

2011-10-26 Thread marta
Hi,

I've a problem with Drools 5.1.1. I'm using a decision table to write my
rules and I need to use more than 9 parameters in the same action, but
something doesn't work. In fact the $10 parameter is interpreted by Drools
as the first parameter ($1) with 0 appended on queue.
Does exist a different way to write the tenth (or greater) parameter?

Thanks.   

--
View this message in context: 
http://drools.46999.n3.nabble.com/Decision-Table-with-more-than-9-parameters-tp3454391p3454391.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] Drools 5.3.0.Final with jBPM

2011-10-26 Thread Melton, Michael P CTR SPAWARSYSCEN-ATLANTIC, 01200
Is there a recommended version of jBPM to use in conjunction with Drools 
5.3.0.Final? We are currently using jBPM 5.1.0.Final alongside Drools 
5.2.0.Final, but I see in Nexus that jBPM has 5.1.1Final and 5.1.2.Final 
releases and I'd like to only upgrade one time.

Thank you.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Decision Table with more than 9 parameters

2011-10-26 Thread Michael Anstis
That sounds like a bug, can you please open a JIRA and attach your example?

sent on the move

On 26 Oct 2011 14:10, marta marta.ama...@gmail.com wrote:

 Hi, I've a problem with Drools 5.1.1. I'm using a decision table to write
 my rules and I need to use more than 9 parameters in the same action, but
 something doesn't work. In fact the $10 parameter is interpreted by Drools
 as the first parameter ($1) with 0 appended on queue. Does exist a different
 way to write the tenth (or greater) parameter? Thanks.
 --
 View this message in context: Decision Table with more than 9 
 parametershttp://drools.46999.n3.nabble.com/Decision-Table-with-more-than-9-parameters-tp3454391p3454391.html
 Sent from the Drools: User forum mailing list 
 archivehttp://drools.46999.n3.nabble.com/Drools-User-forum-f47000.htmlat 
 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


Re: [rules-users] [drools planner 5.3.0 Final] cached planning values

2011-10-26 Thread guyver
Thank you so much ge0ffrey. 

It works now. That was indeed the case, I had a planning variable which had
no planning values when the planningValueRange was specified.

--
View this message in context: 
http://drools.46999.n3.nabble.com/drools-planner-5-3-0-Final-cached-planning-values-tp3452270p3454492.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] [drools 5.3.0.Final] Predicate ... must be a Boolean expression

2011-10-26 Thread kennywest
I did a quick search in the mailing list, but couldn't find a related issue.
The following rule worked fine in 5.3.0.CR1 (and earlier)
...
when
$party : ImmutableParty(addresses == null || addresses.size() == 0)
then
...
ImmutableParty has a getter for addresses and addresses is a collection.
When upgrading to 5.3.0.Final, I get this error:
Caused by: java.lang.RuntimeException: Predicate 'addresses == null ||
addresses.size() == 0' must be a Boolean expression
[Line: 17, Column: 32] : [Rule name='party - address - at least one']

This is with mvel 2.1 beta 6.

--
View this message in context: 
http://drools.46999.n3.nabble.com/drools-5-3-0-Final-Predicate-must-be-a-Boolean-expression-tp3454503p3454503.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] dsl and metadata rule information

2011-10-26 Thread Wolfgang Laun
You can't do this with [when] or [then] entries, but try [keyword]. It also
works with parameters.

For instance:
[keyword]precondition {title}=rule {title}\nsalience 100\nwhen

-W

On 26 October 2011 14:21, gcautiero gianfranco.cauti...@truvo.com wrote:

 Hello,

 I'm not able to find a way to define in my DSL a phrase to add metadata for
 a certain rule.
 I'm interested to provide something that can help end user to add
 data-effective metadata for some rule in the DSLR file.

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/dsl-and-metadata-rule-information-tp3454282p3454282.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] Fwd: Questions

2011-10-26 Thread Michael Anstis
Anybody?

-- Forwarded message --
From: Damien Renier

All,

I’m trying to prepare some answers to questions of a customer

The client wish to execute some rules on dates which are not today.


The rule is:

1.

|

rule TooYoung

2.

|

date-expires 26-MAR-2013

3.

|

date-effective 19-MAR-2010

4.

|

dialect mvel

5.

|

when

6.

|

Driver( age  16 )

7.

|

then

8.

|

Rejection fact0 = new Rejection();

9.

|

fact0.setReason( TooYoung );

10.

|

insert(fact0 );

11.

|

System.out.println(TooYoung);

12.

|

end



First test with execution date set to today in Guvnor/test-scenario

Rule is executed - OK


Second test with execution date set to tomorrow

Rule is executed – OK


Now one change the rule’s attributes and execution date

Execution date = 20-MAR-2011

date-effective = 19-MAR-2010

date-expires   = 26-MAR-2011

no execution


Execution date = 20-MAR-2012

date-effective = 19-MAR-2012

date-expires   = 26-MAR-2013

no execution


So my guess is the execution date is ignored.

I tried to use the AgendaFilter unsuccessfully.

ksession.fireAllRules(new AgendaFilter() {

public boolean accept(Activation a) {

System.out.println(--  +
a.getRule().getName());

return true;

}

});


But this code do not work for the specific rule above, others with no date
attributes are going through and the sysout do its job.


My question is:

How can I tell the engine which rule to execute based on the execution date?
Maybe this behaviour is only in Guvnor.
Is it possible to set an execution date to the engine which is not today and
how to do it?


Thank you


Damien
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools 5.3.0.Final with jBPM - compatibility matrix

2011-10-26 Thread Geoffrey De Smet
There's a compatibility matrix in the introduction docs, but it's not 
updated with the latest release.


Combine Drools 5.3.0.Final with jbpm 5.1.2.Final with Guvnor 5.3.0.Final.

Op 26-10-11 15:21, Melton, Michael P CTR SPAWARSYSCEN-ATLANTIC, 01200 
schreef:
Is there a recommended version of jBPM to use in conjunction with 
Drools 5.3.0.Final? We are currently using jBPM 5.1.0.Final alongside 
Drools 5.2.0.Final, but I see in Nexus that jBPM has 5.1.1Final and 
5.1.2.Final releases and I'd like to only upgrade one time.

Thank you.


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


--
With kind regards,
Geoffrey De Smet

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] [drools 5.3.0.Final] Predicate ... must be a Boolean expression

2011-10-26 Thread kennywest
Yes, I found this out a few minutes ago. You indeed need 2.1.0.drools4. My
mistake. Thanks!

--
View this message in context: 
http://drools.46999.n3.nabble.com/drools-5-3-0-Final-Predicate-must-be-a-Boolean-expression-tp3454503p3454717.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] dsl and metadata rule information

2011-10-26 Thread gcautiero
Tnx. Ill give it a try.

--
View this message in context: 
http://drools.46999.n3.nabble.com/dsl-and-metadata-rule-information-tp3454282p3454831.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] Preventing re-evaluation on modification of 'output' fact

2011-10-26 Thread Jamie
We're building a fraud detection application that uses rules to analyze
orders and the buyers and recipients on those orders.  As rules fire, they
modify an 'output' fact, which is an object whose only intent is to record
the results as rules fire.  It's not used in the LHS of any rules other than
to get a handle to it, e.g.:

rule Rule 001 - Operator Flagged

enabled (FraudRuleEvaluationHelper.isRuleEnabled(Rule 001 - Operator
Flagged))

ruleflow-group orderAnalysis

lock-on-active

when
$order:   OrderFact(operatorFlagged==true)
$results: FraudResultsDTO()
then
modify($results) {
addOrderSuspectReason(O)
};

FraudRuleConsequenceHelper.logRuleFiring($order.getOrderId(), 
001);
end

We're finding that as the number of facts increases, the processing team
increases dramatically and I'm wondering if modifying the output fact the
way we do causes the rules to get re-evaluated to see if any activations
should be created or cancelled.  Would removing the modify block help
anything?  Should we be thinking about this in some other way?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Preventing-re-evaluation-on-modification-of-output-fact-tp3455022p3455022.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] Preventing re-evaluation on modification of 'output' fact

2011-10-26 Thread GPatel
Define FraudResultsDTO as a global. That way, you don't have to specify it in 
the WHEN part merely for assigning a variable to it




- Original Message -
From: Jamie [js...@llbean.com]
Sent: 10/26/2011 09:24 AM MST
To: rules-users@lists.jboss.org
Subject: [rules-users] Preventing re-evaluation on modification of 'output' 
fact



We're building a fraud detection application that uses rules to analyze
orders and the buyers and recipients on those orders.  As rules fire, they
modify an 'output' fact, which is an object whose only intent is to record
the results as rules fire.  It's not used in the LHS of any rules other than
to get a handle to it, e.g.:

rule Rule 001 - Operator Flagged

enabled (FraudRuleEvaluationHelper.isRuleEnabled(Rule 001 - Operator
Flagged))

ruleflow-group orderAnalysis

lock-on-active

when
$order:   OrderFact(operatorFlagged==true)
$results: FraudResultsDTO()
then
modify($results) {
addOrderSuspectReason(O)
};

FraudRuleConsequenceHelper.logRuleFiring($order.getOrderId(), 
001);
end

We're finding that as the number of facts increases, the processing team
increases dramatically and I'm wondering if modifying the output fact the
way we do causes the rules to get re-evaluated to see if any activations
should be created or cancelled.  Would removing the modify block help
anything?  Should we be thinking about this in some other way?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Preventing-re-evaluation-on-modification-of-output-fact-tp3455022p3455022.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
-
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] confusing behaviour of enum comparison

2011-10-26 Thread lhorton
5.2.0.Final

I am seeing some confusing behaviour in enum comparisons in LHS rule
conditions.  I have an enum class, Status (full source below) that is an
attribute on several of our domain objects.  I'm comparing the enum in
several ways, and the rule fires differently when I use syntax that AFAIK
ought to have the same result.

for example, say there is a Step with status of Status.PENDING.  if I write:

$step : Step(status.active == false)// rule DOES fire

$step : Step(status != Status.ACTIVE)// rule does NOT fire, but should

I am testing this with the same objects and same test each time.  can anyone
explain why the two comparisons do not get the same result?

here is the definition of Status:
 
public enum Status {

PENDING(Pending),
ACTIVE(Active),
COMPLETE(Complete);

private final String label;

private Status(String label) {
this.label = label;
}

public String getLabel() {
return label;
}

public boolean isPending(){
return label.equals(Pending);
}

public boolean isActive(){
return label.equals(Active);
}

public boolean isComplete(){
return label.equals(Complete);
}

public static boolean isPending(Status status) {
return (status == null) ? false : status.isPending();
}

public static boolean isActive(Status status) {
return (status == null) ? false : status.isActive();
}

public static boolean isComplete(Status status) {
return (status == null) ? false : status.isComplete();
}

public static Status fromString(String name) {
if (name != null) {
Status types[] = Status.values();
for(Status s : types) {
if (name.equalsIgnoreCase(s.toString())) {
return s;
}
}
}
return null;
}
}


--
View this message in context: 
http://drools.46999.n3.nabble.com/confusing-behaviour-of-enum-comparison-tp3455245p3455245.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] Drools 5.3.0 Dependencies

2011-10-26 Thread Andrew Waterman
I am seeing this exact error when I upgrade form 5.2.0.Final to 5.3.0.Final. I 
had seen some other issues when upgrading from 5.2.0.M2 to 5.2.0.Final relating 
to the use of interfaces and implementing objects in functions. 

The KnowledgeBuilder is complaining about not being able to find a reference to 
typed Sets:

Unable to resolve type SetGridPlayer:
Unable to find class 'SetGridPlayer'
Unable to resolve type SetGridMove:

And in our other game:

Unable to find class 'SetCheckCondition'

Class loading seems to be getting more difficult as these releases go by. Any 
suggestions?

best,

A


On Oct 25, 2011, at 3:21 PM, arrehman wrote:

 Yes locally in machine just to make sure i have only drools upgrade
 happening. My issues are because of this upgrade guaranteed.
 
 The error message drools is giving me is misleading:
 service.RulesService Error executing drools rules Unexpected global
 [dateService]
 
 No stacktrace, nothing :o
 
 Abdul
 
 
 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Drools-5-3-0-Dependencies-tp3452346p3452592.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


Re: [rules-users] confusing behaviour of enum comparison

2011-10-26 Thread Wolfgang Laun
Given your enum, this .drl

declare Step
   id: String
   status: Status
end

rule insertion
salience ( 10 )
when
then
  Step step = new Step();
  step.setId( One );
  step.setStatus( Status.PENDING );
  insert( step );
end

rule testPending
when
$step: Step( status == Status.PENDING )
##$step: Step( status != Status.ACTIVE )
##$step: Step( status.active == false )
then
System.out.println( testPending  + $step.getId() );
end

and Drools 5.2.0 Final, all three patterns result in a firing of rule
testPending.

-W


On 26 October 2011 19:38, lhorton lhor...@abclegal.com wrote:

 5.2.0.Final

 I am seeing some confusing behaviour in enum comparisons in LHS rule
 conditions.  I have an enum class, Status (full source below) that is an
 attribute on several of our domain objects.  I'm comparing the enum in
 several ways, and the rule fires differently when I use syntax that AFAIK
 ought to have the same result.

 for example, say there is a Step with status of Status.PENDING.  if I
 write:

 $step : Step(status.active == false)// rule DOES fire

 $step : Step(status != Status.ACTIVE)// rule does NOT fire, but should

 I am testing this with the same objects and same test each time.  can
 anyone
 explain why the two comparisons do not get the same result?

 here is the definition of Status:

 public enum Status {

PENDING(Pending),
ACTIVE(Active),
COMPLETE(Complete);

private final String label;

private Status(String label) {
this.label = label;
}

public String getLabel() {
return label;
}

public boolean isPending(){
return label.equals(Pending);
}

public boolean isActive(){
return label.equals(Active);
}

public boolean isComplete(){
return label.equals(Complete);
}

public static boolean isPending(Status status) {
return (status == null) ? false : status.isPending();
}

public static boolean isActive(Status status) {
return (status == null) ? false : status.isActive();
}

public static boolean isComplete(Status status) {
return (status == null) ? false : status.isComplete();
}

public static Status fromString(String name) {
if (name != null) {
Status types[] = Status.values();
for(Status s : types) {
if (name.equalsIgnoreCase(s.toString())) {
return s;
}
}
}
return null;
}
 }


 --
 View this message in context:
 http://drools.46999.n3.nabble.com/confusing-behaviour-of-enum-comparison-tp3455245p3455245.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


Re: [rules-users] confusing behaviour of enum comparison

2011-10-26 Thread lhorton
thank you for taking the time to test this, Wolf.I have other tests with
the same syntax that have tested ok as well.  It is puzzling.  I will test
tomorrow with the mvel jar that I'm using.  I went to the beta 6 mvel
because it compiles a lot faster for 5.2 but perhaps there are side effects.  

--
View this message in context: 
http://drools.46999.n3.nabble.com/confusing-behaviour-of-enum-comparison-tp3455245p3456711.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