Re: [rules-users] using From keyword in the rule

2013-07-29 Thread IPatel
Thank you everyone for your response.

I am using Guvnor 5.5.0.

The combine string method will take 2 strings as an arguments and
concatinate in the following pattern
String1@string2. This string will be the output of the method. I am really
not sure why it is asking for Boolean. Also this method is written inside
Guvnor using Function asset.

Thank you,
Isha



--
View this message in context: 
http://drools.46999.n3.nabble.com/using-From-keyword-in-the-rule-tp4025163p4025183.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] using From keyword in the rule

2013-07-29 Thread Wolfgang Laun
There you are: you cannot use a method call such as
   POC_CombineString($value.getField1(),$value.getField2())
as a pattern on the LHS. This is absolutely basic.
-W


On 29 July 2013 15:49, IPatel ishita.pa...@usbank.com wrote:

 Thank you everyone for your response.

 I am using Guvnor 5.5.0.

 The combine string method will take 2 strings as an arguments and
 concatinate in the following pattern
 String1@string2. This string will be the output of the method. I am really
 not sure why it is asking for Boolean. Also this method is written inside
 Guvnor using Function asset.

 Thank you,
 Isha



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/using-From-keyword-in-the-rule-tp4025163p4025183.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] using From keyword in the rule

2013-07-27 Thread Wolfgang Laun
There is no reason why this should not compile.

I suspect that you have not posted the *accurate* text of the rule
where that error occurred. Does the snippet you've mailed
cause the same error?

-W

On 26/07/2013, IPatel ishita.pa...@usbank.com wrote:
 Thank you for your replay... here is what i am using
 package POC2013
 dialect mvel
 import  com.usbank.tmup.rules.value.Database
 import  com.usbank.tmup.rules.value.TestValue
 import  com.usbank.tmup.rules.value.DatabaseConnection

 rule getting user

 when
 $value: TestValue()
 record : POC_CombineString($value.getField1(),$value.getField2()) 
 val : TestValue() from Database.connect().getUserRisk(record);
 then
   System.out.println(The value of the score is + val);
 end



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/using-From-keyword-in-the-rule-tp4025163p4025165.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] using From keyword in the rule

2013-07-27 Thread Wolfgang Laun
On 27/07/2013, Stephen Masters stephen.mast...@me.com wrote:
 I guess it depends on whether there is a static connect() method on the
 Database class which returns a DatabaseConnection, which in turn has a
 method getUserRisk(POC_CombineString), which returns an instance of the
 TestValue class.

All three possibilities should result in an error such as:
 unable to resolve method using strict-mode: Database.connect()]
-W
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] using From keyword in the rule

2013-07-27 Thread Davide Sottara
By the way,
what is POC_CombineString supposed to be?
A pattern or a function call?
Davide

p.s. which version are you using?

On 07/26/2013 10:18 PM, IPatel wrote:
 Thank you for your replay... here is what i am using
 package POC2013
 dialect mvel
 import  com.usbank.tmup.rules.value.Database
 import  com.usbank.tmup.rules.value.TestValue
 import  com.usbank.tmup.rules.value.DatabaseConnection

 rule getting user

 when
 $value: TestValue()
 record : POC_CombineString($value.getField1(),$value.getField2()) 
 val : TestValue() from Database.connect().getUserRisk(record);
 then
   System.out.println(The value of the score is + val);
 end



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/using-From-keyword-in-the-rule-tp4025163p4025165.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] using From keyword in the rule

2013-07-27 Thread Wolfgang Laun
On 27/07/2013, Stephen Masters stephen.mast...@me.com wrote:
 Ah … spotted the specific exception by going back to Nabble. I was just
 looking for reasons why it might not compile. :)

 To be honest the line:

 record : POC_CombineString($value.getField1(),$value.getField2())


 … looks wrong. I can't work out a way in which it could compile, even if I
 assume that the code is missing imports of either a POC_CombineString
 function or class.

If both methods return a boolean...? Any boolean expression is a valid
constraint. It does look strange, though.

-W

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


[rules-users] using From keyword in the rule

2013-07-26 Thread IPatel
Hi,

I am trying to use the From keyword when writing rule and i am getting
following error:
mismatched input 'from' in rule
parser returned a null package

here is my use case, i am getting a user and i calling a database to get
some number associated with this user 

Does anyone know why i am getting this error?

thank you in advance
Isha



--
View this message in context: 
http://drools.46999.n3.nabble.com/using-From-keyword-in-the-rule-tp4025163.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] using From keyword in the rule

2013-07-26 Thread Wolfgang Laun
On 26/07/2013, IPatel ishita.pa...@usbank.com wrote:
 Hi,

 I am trying to use the From keyword when writing rule and i am getting
 following error:
 mismatched input 'from' in rule
 parser returned a null package

 here is my use case, i am getting a user and i calling a database to get
 some number associated with this user

 Does anyone know why i am getting this error?

Yes: you have made a syntax error.
-W



 thank you in advance
 Isha



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/using-From-keyword-in-the-rule-tp4025163.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] using From keyword in the rule

2013-07-26 Thread IPatel
Thank you for your replay... here is what i am using
package POC2013
dialect mvel
import  com.usbank.tmup.rules.value.Database
import  com.usbank.tmup.rules.value.TestValue
import  com.usbank.tmup.rules.value.DatabaseConnection

rule getting user

when
$value: TestValue()
record : POC_CombineString($value.getField1(),$value.getField2())   
val : TestValue() from Database.connect().getUserRisk(record);
then
System.out.println(The value of the score is + val);
end



--
View this message in context: 
http://drools.46999.n3.nabble.com/using-From-keyword-in-the-rule-tp4025163p4025165.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] Using FROM in decision table

2013-06-30 Thread devan.vanree...@gmail.com
Thanks Wolfgang, we will possibly look at upgrading.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-FROM-in-decision-table-tp4024617p4024669.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] Using FROM in decision table

2013-06-28 Thread devan.vanree...@gmail.com
Hi there, 

Would like to find out if it is possible to use the FROM keyword in decision
tables, I cant seem to find any examples anywhere. I need to iterate over a
collection from within a CONDITION in the decision table. 

Any help would be appreciated. 

Thanks 
Devan



--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-FROM-in-decision-table-tp4024617.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] Using FROM in decision table

2013-06-28 Thread Wolfgang Laun
Why don't you simply try something like this:

   ThisClass() from $somewhere

as a condition?

-W


On 28/06/2013, devan.vanree...@gmail.com devan.vanree...@gmail.com wrote:
 Hi there,

 Would like to find out if it is possible to use the FROM keyword in
 decision
 tables, I cant seem to find any examples anywhere. I need to iterate over a
 collection from within a CONDITION in the decision table.

 Any help would be appreciated.

 Thanks
 Devan



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Using-FROM-in-decision-table-tp4024617.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] Using FROM in decision table

2013-06-28 Thread devan.vanree...@gmail.com
http://drools.46999.n3.nabble.com/file/n4024620/Untitled.png 

As per the attached image I have attempted to do this but still doing
something wrong as I am trying to evaluate id property on the DocumentType
class but source generates incorrectly.

it generates the below source

1.|  #generated from Decision Table
2.|  import
uk.co.pruprotect.claims.rules.document.IDocumentRule;
3.|  import
uk.co.pruprotect.claims.rules.document.ClaimDocumentRule;
4.|  import
uk.co.pruprotect.claims.rules.document.DocumentEnum;
5.|  import
uk.co.pruprotect.domain.claims.jpa.entity.DocumentType;
6.|  import
uk.co.pruprotect.claims.rules.document.IBenefitCategoryDocumentRule;
7.|  import
uk.co.pruprotect.claims.rules.document.ClaimBenefitCategoryDocumentRule;
8.|  global IBenefitCategoryDocumentRule
globalDocumentRule;
9.|  #From row number: 11
10.  |  rule Life Cover
11.  |  
12.  |  when
13.  | 
$i:IBenefitCategoryDocumentRule(benefitCategoryCode == 1)
14.  |  DocumentType() from
$i.getAllDocumentTypeList();(id in (1, 2, 3))
15.  |  then
16.  |  end







--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-FROM-in-decision-table-tp4024617p4024620.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] Using FROM in decision table

2013-06-28 Thread devan.vanree...@gmail.com
I have tried something I think to what you are suggesting but I am doing
something wrong as the source does not generate correctly from the decision
table

http://drools.46999.n3.nabble.com/file/n4024621/Untitled.png 

getAllDocumentTypeList returns a collection of DocumentType and I am trying
to evaluate the id property of DocumentType

|  #generated from Decision Table
2.|   
9.|  #From row number: 11
10.  |  rule Test
11.  |  
12.  |  when
13.  |  $d:DocumentRule(code == 1)
14.  |  DocumentType() from
$d.getAllDocumentTypeList();(id in (1, 2, 3))
15.  |  then
16.  |  end








--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-FROM-in-decision-table-tp4024617p4024621.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] Using FROM in decision table

2013-06-28 Thread Wolfgang Laun
I can't reproduce this effect, not with 5.5.0 or 5.4.0
-W

On 28/06/2013, devan.vanree...@gmail.com devan.vanree...@gmail.com wrote:
 http://drools.46999.n3.nabble.com/file/n4024620/Untitled.png

 As per the attached image I have attempted to do this but still doing
 something wrong as I am trying to evaluate id property on the DocumentType
 class but source generates incorrectly.

 it generates the below source

 1.|  #generated from Decision Table
 2.|  import
 uk.co.pruprotect.claims.rules.document.IDocumentRule;
 3.|  import
 uk.co.pruprotect.claims.rules.document.ClaimDocumentRule;
 4.|  import
 uk.co.pruprotect.claims.rules.document.DocumentEnum;
 5.|  import
 uk.co.pruprotect.domain.claims.jpa.entity.DocumentType;
 6.|  import
 uk.co.pruprotect.claims.rules.document.IBenefitCategoryDocumentRule;
 7.|  import
 uk.co.pruprotect.claims.rules.document.ClaimBenefitCategoryDocumentRule;
 8.|  global IBenefitCategoryDocumentRule
 globalDocumentRule;
 9.|  #From row number: 11
 10.  |  rule Life Cover
 11.  |
 12.  |  when
 13.  |
 $i:IBenefitCategoryDocumentRule(benefitCategoryCode == 1)
 14.  |  DocumentType() from
 $i.getAllDocumentTypeList();(id in (1, 2, 3))
 15.  |  then
 16.  |  end







 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Using-FROM-in-decision-table-tp4024617p4024620.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] Using FROM in decision table

2013-06-28 Thread devan.vanree...@gmail.com
Thanks for feedback. We are using an old version - 5.0.0.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-FROM-in-decision-table-tp4024617p4024625.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] Using FROM in decision table

2013-06-28 Thread Wolfgang Laun
Upgrade. IIRC, serious improvements were done for 5.2.0 and, possibly,
later on, too. 5.0.0 is *very* out of time.
-W


On 28 June 2013 15:31, devan.vanree...@gmail.com
devan.vanree...@gmail.comwrote:

 Thanks for feedback. We are using an old version - 5.0.0.



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Using-FROM-in-decision-table-tp4024617p4024625.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] using from accumulate with wrong return type

2012-11-24 Thread raffi
Hello,

I have a problem with using the /from accumulate/ statement. It is because
I'd like to optmize my code a liitle bit. There are two rules that I like to
merge.

/query max recomm value for slot 1
accumulate (Recommendation(slot == 1, $recomm_value : recommValue),
max : max($recomm_value))
end/

and

/query recomms for slot 1
recomm  : Recommendation(slot == 1)
end/

So with the first rule I get the maximum of the variable recommValue. The
second rule is for searching exactly this Recommendation-fact with this
value. Now I tried to merge them in the following way:
/
query recomm for slot 1
$recomm : Recommendation() from
accumulate(Recommendation(
slot == 1, $recomm_value : 
recommValue),
max($recomm_value)
)
end/

But the returned value always is a double one. Is it because of the usage of
the maximum function? Is it possible to solve this problem with only one
query (getting that Recommendation-fact with the highest recommValue)?

Regards...



--
View this message in context: 
http://drools.46999.n3.nabble.com/using-from-accumulate-with-wrong-return-type-tp4020957.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] using from accumulate with wrong return type

2012-11-24 Thread Wolfgang Laun
Each (not *the*) Recommendation with the maximum recommValue can be found
using

   $recMax: Recommendation( slot == 1, $recommValue: recommValue)
   not Recommendation( slot == 1, recommValue  $recommValue )

with $recMax being bound to one of the Recommendations with the maximum,
and the maximum value being bound to $recommValue.

-W

On 24 November 2012 13:18, raffi christian.koeh...@s2008.tu-chemnitz.dewrote:

 Hello,

 I have a problem with using the /from accumulate/ statement. It is because
 I'd like to optmize my code a liitle bit. There are two rules that I like
 to
 merge.

 /query max recomm value for slot 1
 accumulate (Recommendation(slot == 1, $recomm_value : recommValue),
 max : max($recomm_value))
 end/

 and

 /query recomms for slot 1
 recomm  : Recommendation(slot == 1)
 end/

 So with the first rule I get the maximum of the variable recommValue. The
 second rule is for searching exactly this Recommendation-fact with this
 value. Now I tried to merge them in the following way:
 /
 query recomm for slot 1
 $recomm : Recommendation() from
 accumulate(Recommendation(
 slot == 1, $recomm_value :
 recommValue),
 max($recomm_value)
 )
 end/

 But the returned value always is a double one. Is it because of the usage
 of
 the maximum function? Is it possible to solve this problem with only one
 query (getting that Recommendation-fact with the highest recommValue)?

 Regards...



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/using-from-accumulate-with-wrong-return-type-tp4020957.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] using from accumulate with wrong return type

2012-11-24 Thread raffi
Thank you very much. This works perfect.

The Solution can be that easy. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/using-from-accumulate-with-wrong-return-type-tp4020957p4020959.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] Using 'from {x}.field' in DSL

2012-06-13 Thread Wolfgang Laun
On 13/06/2012, Sandjaja, Dominik dominik.sandj...@it-motive.de wrote:
 Hello Wolfgang, hello everybody,

 Nice one, thanks for the idea! This one works for now, but is there a way to
 automatically assign random variable names to the RHS of the DSL? So the
 user won't have to explicitly set a variable in the DSL which is only needed
 for internal purposes.

This is one thing I've occasionally missed, too, in my experiments
with DSLs. It wouldn't be too difficult to add, and patch/pull
requests are always welcome with the Drools team.

If at least one of the variables differs between repeated uses of the
DSL phrase, you might consider using this text (if its characters are
always suitable!) as part of the binding variable name, e.g.

 [when][]The field {field} in the module {module} contains value {value}=
  {value}Obj : {module} ( {field} != null) String(
this.equalsIgnoreCase( {value} )  ) from {value}Obj.{field}

BTW, consider defining a custom operator which would let you write the
much simpler pattern
   Module( field spells value )
You can make a trivial clone from the implementation of contains,
shouldn't take more than 5 minutes ;-)   Some hints can be found at
http://members.inode.at/w.laun/drools/CustomOperatorHowTo.html

Cheers
-W



 Thanks
 Dominik

 -Ursprüngliche Nachricht-
 Von: rules-users-boun...@lists.jboss.org
 [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang Laun
 Gesendet: Dienstag, 12. Juni 2012 19:46
 An: Rules Users List
 Cc: Edson Tirelli
 Betreff: Re: [rules-users] Using 'from {x}.field' in DSL

 There is a bug in the DSL parser: after '=', a couple of variable references
 merely separated by a period isn't recognized.

 As a workaround, use this:

 [when][]The field {field} in the module {module} contains value {value} as
 {abc} =
  {abc}x : {module} ( {field} != null) String(
 this.equalsIgnoreCase({value}) ) from {abc}x.{field}

 -W


 On 12/06/2012, Sandjaja, Dominik dominik.sandj...@it-motive.de wrote:
 There is no expanded DRL. If I take that line into the DSL, I can't
 even validate the DSL and if I have the line in it, I can't select any
 DSL statements for rules in Guvnor.



 BTW, I am using Drools and Guvnor 5.4.0.



 Von: rules-users-boun...@lists.jboss.org
 [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang
 Laun
 Gesendet: Dienstag, 12. Juni 2012 17:31
 An: Rules Users List
 Betreff: Re: [rules-users] Using 'from {x}.field' in DSL



 Have you checked the expanded DRL? What does this line look like?

 -W

 On 12 June 2012 17:06, Sandjaja, Dominik
 dominik.sandj...@it-motive.de
 wrote:

 I have the following Drools DSL sentence:

 [when]The field {field} in the module {module} contains value
 {value}=$a : {module} ( {field} != null)

   String( this.equalsIgnoreCase({value}) ) from $a.{field}

 where the `field` is a `Set` of Strings.

 Now, if I have two of these sentences in one rule, it obviously won't
 work as the variable `$a` occurs twice. So I wanted to improve the
 rule to make the variable, well, variable:

 [when]The field {field} in the module {module} contains value
 {value} as {a}={a} : {module} ( {field} != null)

   String( this.equalsIgnoreCase({value}) ) from {a}.{field}

 This doesn't work, I can't use the part `{a}.`, that breaks.

 So, my questions are: Is there either a way to rewrite the rules or a
 way to allow the `{variable}.` notation to work? Alternatively, is
 there a `contains` operator which works case insensitive?

 Thanks in advance

 Dominik


 ___
 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


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


[rules-users] Using 'from {x}.field' in DSL

2012-06-12 Thread Sandjaja, Dominik
I have the following Drools DSL sentence:

[when]The field {field} in the module {module} contains value
{value}=$a : {module} ( {field} != null)
  String( this.equalsIgnoreCase({value}) ) from $a.{field}
where the `field` is a `Set` of Strings.

Now, if I have two of these sentences in one rule, it obviously won't
work as the variable `$a` occurs twice. So I wanted to improve the rule
to make the variable, well, variable:

[when]The field {field} in the module {module} contains value
{value} as {a}={a} : {module} ( {field} != null)
  String( this.equalsIgnoreCase({value}) ) from {a}.{field}

This doesn't work, I can't use the part `{a}.`, that breaks.

So, my questions are: Is there either a way to rewrite the rules or a
way to allow the `{variable}.` notation to work? Alternatively, is there
a `contains` operator which works case insensitive?

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


Re: [rules-users] Using 'from {x}.field' in DSL

2012-06-12 Thread Wolfgang Laun
Have you checked the expanded DRL? What does this line look like?

-W

On 12 June 2012 17:06, Sandjaja, Dominik dominik.sandj...@it-motive.dewrote:

 **

 I have the following Drools DSL sentence:

 [when]The field {field} in the module {module} contains value
 {value}=$a : {module} ( {field} != null)

   String( this.equalsIgnoreCase({value}) ) from $a.{field}

 where the `field` is a `Set` of Strings.

 Now, if I have two of these sentences in one rule, it obviously won't
 work as the variable `$a` occurs twice. So I wanted to improve the rule to
 make the variable, well, variable:

 [when]The field {field} in the module {module} contains value {value}
 as {a}={a} : {module} ( {field} != null)

   String( this.equalsIgnoreCase({value}) ) from {a}.{field}

 This doesn't work, I can't use the part `{a}.`, that breaks.

 So, my questions are: Is there either a way to rewrite the rules or a way
 to allow the `{variable}.` notation to work? Alternatively, is there a
 `contains` operator which works case insensitive?

 Thanks in advance

 Dominik

 ___
 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] Using 'from {x}.field' in DSL

2012-06-12 Thread Sandjaja, Dominik
There is no expanded DRL. If I take that line into the DSL, I can't even
validate the DSL and if I have the line in it, I can't select any DSL
statements for rules in Guvnor.

 

BTW, I am using Drools and Guvnor 5.4.0.

 

Von: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang
Laun
Gesendet: Dienstag, 12. Juni 2012 17:31
An: Rules Users List
Betreff: Re: [rules-users] Using 'from {x}.field' in DSL

 

Have you checked the expanded DRL? What does this line look like?

-W

On 12 June 2012 17:06, Sandjaja, Dominik dominik.sandj...@it-motive.de
wrote:

I have the following Drools DSL sentence:

[when]The field {field} in the module {module} contains value
{value}=$a : {module} ( {field} != null)

  String( this.equalsIgnoreCase({value}) ) from $a.{field}

where the `field` is a `Set` of Strings.

Now, if I have two of these sentences in one rule, it obviously won't
work as the variable `$a` occurs twice. So I wanted to improve the rule
to make the variable, well, variable:

[when]The field {field} in the module {module} contains value
{value} as {a}={a} : {module} ( {field} != null)

  String( this.equalsIgnoreCase({value}) ) from {a}.{field}

This doesn't work, I can't use the part `{a}.`, that breaks.

So, my questions are: Is there either a way to rewrite the rules or a
way to allow the `{variable}.` notation to work? Alternatively, is there
a `contains` operator which works case insensitive?

Thanks in advance

Dominik


___
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] Using 'from {x}.field' in DSL

2012-06-12 Thread Wolfgang Laun
There is a bug in the DSL parser: after '=', a couple of variable
references merely separated by a period isn't recognized.

As a workaround, use this:

[when][]The field {field} in the module {module} contains value
{value} as {abc} =
 {abc}x : {module} ( {field} != null) String(
this.equalsIgnoreCase({value}) ) from {abc}x.{field}

-W


On 12/06/2012, Sandjaja, Dominik dominik.sandj...@it-motive.de wrote:
 There is no expanded DRL. If I take that line into the DSL, I can't even
 validate the DSL and if I have the line in it, I can't select any DSL
 statements for rules in Guvnor.



 BTW, I am using Drools and Guvnor 5.4.0.



 Von: rules-users-boun...@lists.jboss.org
 [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang
 Laun
 Gesendet: Dienstag, 12. Juni 2012 17:31
 An: Rules Users List
 Betreff: Re: [rules-users] Using 'from {x}.field' in DSL



 Have you checked the expanded DRL? What does this line look like?

 -W

 On 12 June 2012 17:06, Sandjaja, Dominik dominik.sandj...@it-motive.de
 wrote:

 I have the following Drools DSL sentence:

 [when]The field {field} in the module {module} contains value
 {value}=$a : {module} ( {field} != null)

   String( this.equalsIgnoreCase({value}) ) from $a.{field}

 where the `field` is a `Set` of Strings.

 Now, if I have two of these sentences in one rule, it obviously won't
 work as the variable `$a` occurs twice. So I wanted to improve the rule
 to make the variable, well, variable:

 [when]The field {field} in the module {module} contains value
 {value} as {a}={a} : {module} ( {field} != null)

   String( this.equalsIgnoreCase({value}) ) from {a}.{field}

 This doesn't work, I can't use the part `{a}.`, that breaks.

 So, my questions are: Is there either a way to rewrite the rules or a
 way to allow the `{variable}.` notation to work? Alternatively, is there
 a `contains` operator which works case insensitive?

 Thanks in advance

 Dominik


 ___
 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 from with named queries

2010-07-28 Thread rouvas
Hello list,

I'm using Drools.5.0.1 and I am trying to comprehend how to used the
from keyword over a named query.

I've googled this:
http://blog.athico.com/2007/06/chained-from-accumulate-collect.html

where it states:

p : Person( )
  Restaurant( food == p.favouriteFood )
from hs.getNamedQuery( list restaurants by postcode )
 .setProperties( [ postcode : p.address.zipcode ] )
 .list()

If I understand the above correctly, the hs.getNamedQuery returns
Restaurant objects using values from Person object.

There are a couple of issues that I would like to resolve.

Where and how is the hs object in hs.getNamedQuery statement is declared?

If the Person object itself is the result of a NamedQuery, could the
above statement be rewritten as:

  p : Person( ) from ps.getNamedQuery(return list of persons)
  Restaurant( food == p.favouriteFood )
from hs.getNamedQuery( list restaurants by postcode )
 .setProperties( [ postcode : p.address.zipcode ] )
 .list()

Thank you for your time.
-Stathis

PS: Please take note that this is a newbie (in Drools) speaking.


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


Re: [rules-users] Using from with named queries

2010-07-28 Thread Wolfgang Laun
Don't be too keen on using from in connection with queries. The simple
reason is that queries return nothing but what rules can do just as well.

Thus, getting all pairs of Person's and Restaurant's with matching food
and zipcode, the straightforward LHS would be

  p:Person( $favFood : favouriteFood, $zip : address.zipcode )
  r: Restaurant( food == $favFood, postcode == $zip )

from is required if the objects aren't facts but, for instance, elements
in a collection contained in a fact. So, if you have Restaurants only
as a ListRestaurant in a (say) City object, you would write

  p:Person( $favFood : favouriteFood, $zip : address.zipcode )
  c: City( zipcodeSet contains $zip )# a person's home town
  r: Restaurant( food == $favFood, postcode == $zip ) from c.restaurantList

assuming that a (biggish) City typically has many zipcodes.

-W



On 28 July 2010 15:06,  rou...@di.uoa.gr wrote:
 Hello list,

 I'm using Drools.5.0.1 and I am trying to comprehend how to used the
 from keyword over a named query.

 I've googled this:
 http://blog.athico.com/2007/06/chained-from-accumulate-collect.html

 where it states:

 p : Person( )
  Restaurant( food == p.favouriteFood )
                from hs.getNamedQuery( list restaurants by postcode )
                     .setProperties( [ postcode : p.address.zipcode ] )
                     .list()

 If I understand the above correctly, the hs.getNamedQuery returns
 Restaurant objects using values from Person object.

 There are a couple of issues that I would like to resolve.

 Where and how is the hs object in hs.getNamedQuery statement is declared?

 If the Person object itself is the result of a NamedQuery, could the
 above statement be rewritten as:

  p : Person( ) from ps.getNamedQuery(return list of persons)
  Restaurant( food == p.favouriteFood )
                from hs.getNamedQuery( list restaurants by postcode )
                     .setProperties( [ postcode : p.address.zipcode ] )
                     .list()

 Thank you for your time.
 -Stathis

 PS: Please take note that this is a newbie (in Drools) speaking.


 ___
 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] Using from with named queries

2010-07-28 Thread rouvas
Wolfang,

Wolfgang Laun wrote:
 Don't be too keen on using from in connection with queries. The simple
 reason is that queries return nothing but what rules can do just as well.

 Thus, getting all pairs of Person's and Restaurant's with matching food
 and zipcode, the straightforward LHS would be

   p:Person( $favFood : favouriteFood, $zip : address.zipcode )
   r: Restaurant( food == $favFood, postcode == $zip )

That was(is) my initial approach, and it is clearly the most
straightforward one.

Then I learned that the (theoretical) number of facts for Person objects
the client has, is about 65 billion with the potential of doubling every
year.

Of course, they are in a database and I was looking into using the from
keyword to do lookups in the database to retrieve the facts I need.

By the way, I have looked into eval and I am not sure how to use it in
respect to inline vs conditional element.

Regardless, my primary issue is how to reason over the facts as records
in a database.

Any ideas will be greatly appreciated.

-Stathis


 from is required if the objects aren't facts but, for instance, elements
 in a collection contained in a fact. So, if you have Restaurants only
 as a ListRestaurant in a (say) City object, you would write

   p:Person( $favFood : favouriteFood, $zip : address.zipcode )
   c: City( zipcodeSet contains $zip )# a person's home town
   r: Restaurant( food == $favFood, postcode == $zip ) from
 c.restaurantList

 assuming that a (biggish) City typically has many zipcodes.

 -W



 On 28 July 2010 15:06,  rou...@di.uoa.gr wrote:
 Hello list,

 I'm using Drools.5.0.1 and I am trying to comprehend how to used the
 from keyword over a named query.

 I've googled this:
 http://blog.athico.com/2007/06/chained-from-accumulate-collect.html

 where it states:

 p : Person( )
  Restaurant( food == p.favouriteFood )
                from hs.getNamedQuery( list restaurants by postcode )
                     .setProperties( [ postcode : p.address.zipcode ] )
                     .list()

 If I understand the above correctly, the hs.getNamedQuery returns
 Restaurant objects using values from Person object.

 There are a couple of issues that I would like to resolve.

 Where and how is the hs object in hs.getNamedQuery statement is
 declared?

 If the Person object itself is the result of a NamedQuery, could the
 above statement be rewritten as:

  p : Person( ) from ps.getNamedQuery(return list of persons)
  Restaurant( food == p.favouriteFood )
                from hs.getNamedQuery( list restaurants by postcode )
                     .setProperties( [ postcode : p.address.zipcode ] )
                     .list()

 Thank you for your time.
 -Stathis

 PS: Please take note that this is a newbie (in Drools) speaking.


 ___
 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] Using from

2008-07-18 Thread Edson Tirelli
   Hey Aziz,

  Try like this:

when
$f : Father( age  45 )
exists( Son( age  5 ) from $f.sons )
then
   // $f is older than 45 and has at least one son older than 5
end

   Happy drooling,

   []s
   Edson


2008/7/17 Aziz Boxwala [EMAIL PROTECTED]:

 I have the following class structure.

 Class GrandFather {
   ListFather fathers;
   public ListFather getFathers() {return fathers;}
 }

 Class Father {
int age;
   ListSon sons;
   public int getAge() {return age;}
   public ListSon getSons() {return sons;}
 }

 Class Son {
  int age;
   public int getAge() {return age;}
 }

 I'd like to write a rule that finds all the Fathers who have age  45 and
 have Sons where the son's age is greater than 5. But I can't figure out how
 to use from to iterate over father first and then over son.

 Any help will be greatly appreciated.

 Thanks,
 --Aziz



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




-- 
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Using from

2008-07-18 Thread Aziz Boxwala
Marcus,

Thank you very much. I am trying that out.

--Aziz



- Original Message 
From: Marcus Ilgner [EMAIL PROTECTED]
To: Rules Users List rules-users@lists.jboss.org
Sent: Thursday, July 17, 2008 2:35:55 PM
Subject: Re: [rules-users] Using from

Hi Aziz,

On Thu, Jul 17, 2008 at 8:26 PM, Aziz Boxwala [EMAIL PROTECTED] wrote:
 I have the following class structure.

 Class GrandFather {
   ListFather fathers;
   public ListFather getFathers() {return fathers;}
 }

 Class Father {
int age;
   ListSon sons;
   public int getAge() {return age;}
   public ListSon getSons() {return sons;}
 }

 Class Son {
  int age;
   public int getAge() {return age;}
 }

 I'd like to write a rule that finds all the Fathers who have age  45 and
 have Sons where the son's age is greater than 5. But I can't figure out how
 to use from to iterate over father first and then over son.

 Any help will be greatly appreciated.

 Thanks,
 --Aziz

Something like this?

rule FatherAndSon
when
  $father : Father(age  45)
  $son : Son(age  5) from $father.sons
then
// do something
end

Best regards
Marcus
___
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 from

2008-07-17 Thread Aziz Boxwala
I have the following class structure. 

Class GrandFather {
  ListFather fathers;
  public ListFather getFathers() {return fathers;}
}

Class Father {
   int age;
  ListSon sons;
  public int getAge() {return age;}
  public ListSon getSons() {return sons;}
}

Class Son {
 int age;
  public int getAge() {return age;}
}

I'd like to write a rule that finds all the Fathers who have age  45 and have 
Sons where the son's age is greater than 5. But I can't figure out how to use 
from to iterate over father first and then over son.

Any help will be greatly appreciated.

Thanks,
--Aziz


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


Re: [rules-users] Using from

2008-07-17 Thread Marcus Ilgner
Hi Aziz,

On Thu, Jul 17, 2008 at 8:26 PM, Aziz Boxwala [EMAIL PROTECTED] wrote:
 I have the following class structure.

 Class GrandFather {
   ListFather fathers;
   public ListFather getFathers() {return fathers;}
 }

 Class Father {
int age;
   ListSon sons;
   public int getAge() {return age;}
   public ListSon getSons() {return sons;}
 }

 Class Son {
  int age;
   public int getAge() {return age;}
 }

 I'd like to write a rule that finds all the Fathers who have age  45 and
 have Sons where the son's age is greater than 5. But I can't figure out how
 to use from to iterate over father first and then over son.

 Any help will be greatly appreciated.

 Thanks,
 --Aziz

Something like this?

rule FatherAndSon
when
  $father : Father(age  45)
  $son : Son(age  5) from $father.sons
then
// do something
end

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


[rules-users] using from with not

2007-10-04 Thread Chris West
Hello,

Does anyone know why rule GoodBye2 below does not compile, but rule
GoodBye1 does compile using Drools 4.0.0?  The only difference is the
not.  Shouldn't this be valid?

Thanks,
-Chris


package com.sample

import com.sample.DroolsTest.Message;
import com.sample.DroolsTest.Foo;
import java.util.List;

rule Hello World
when
m : Message( status == Message.HELLO, message : message )
then
System.out.println( message );
m.setMessage( Goodbye cruel world );
m.setStatus( Message.GOODBYE );
update( m );
end

rule GoodBye1
no-loop true
when
m : Message( status == Message.GOODBYE, message : message, $foos:
foos )
Foo(id == 10) from $foos
then
System.out.println( message );
m.setMessage( message );

end

rule GoodBye2
no-loop true
when
m : Message( status == Message.GOODBYE, message : message, $foos:
foos )
not Foo(id == 10) from $foos
then
System.out.println( message );
m.setMessage( message );

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


RE: [rules-users] using from with not

2007-10-04 Thread Anstis, Michael \(M.\)
What if you try not (Foo(id == 10) from $foos)?


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris West
Sent: 04 October 2007 16:59
To: Rules Users List
Subject: Re: [rules-users] using from with not


It does not compile.  The error is:
unknown:32:20 mismatched token: [EMAIL PROTECTED],682:685='from',38,32:20]; 
expecting
type THEN

-Chris


On 10/4/07, Anstis, Michael (M.) [EMAIL PROTECTED] wrote: 

Does it not compile (in which case can you post the error)?
 
Or does it not activate?


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris West
Sent: 04 October 2007 16:03
To: Rules Users List
Subject: [rules-users] using from with not



Hello,

Does anyone know why rule GoodBye2 below does not compile, but rule
GoodBye1 does compile using Drools 4.0.0?  The only difference is the
not.  Shouldn't this be valid? 

Thanks,
-Chris


package com.sample
 
import com.sample.DroolsTest.Message;
import com.sample.DroolsTest.Foo;
import java.util.List;
 
rule Hello World
when
m : Message( status == Message.HELLO, message : message )
then
System.out.println( message ); 
m.setMessage( Goodbye cruel world );
m.setStatus( Message.GOODBYE );
update( m );
end 

rule GoodBye1
no-loop true
when
m : Message( status == Message.GOODBYE, message : message, $foos:
foos )
Foo(id == 10) from $foos
then
System.out.println ( message ); 
m.setMessage( message );

end

rule GoodBye2
no-loop true
when
m : Message( status == Message.GOODBYE, message : message, $foos:
foos )
not Foo(id == 10) from $foos
then
System.out.println( message ); 
m.setMessage( message );

end 


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







smime.p7s
Description: S/MIME cryptographic signature
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] using from with not

2007-10-04 Thread Chris West
That makes it compile, but during the run I get:

java.lang.NullPointerException
at org.drools.reteoo.builder.BuildUtils.createBetaNodeConstraint(
BuildUtils.java:168)
at org.drools.reteoo.builder.GroupElementBuilder$NotBuilder.build(
GroupElementBuilder.java:231)
at org.drools.reteoo.builder.GroupElementBuilder.build(
GroupElementBuilder.java:70)
at org.drools.reteoo.builder.GroupElementBuilder$AndBuilder.build(
GroupElementBuilder.java:112)
at org.drools.reteoo.builder.GroupElementBuilder.build(
GroupElementBuilder.java:70)
at org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(
ReteooRuleBuilder.java:136)
at org.drools.reteoo.builder.ReteooRuleBuilder.addRule(
ReteooRuleBuilder.java:109)
at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:116)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:262)
at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java
:333)
at com.sample.DroolsTest.readRule(DroolsTest.java:66)
at com.sample.DroolsTest.main(DroolsTest.java:23)


-Chris

On 10/4/07, Anstis, Michael (M.) [EMAIL PROTECTED] wrote:

  What if you try not (Foo(id == 10) from $foos)?

  --
 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] *On Behalf Of *Chris West
 *Sent:* 04 October 2007 16:59
 *To:* Rules Users List
 *Subject:* Re: [rules-users] using from with not

 It does not compile.  The error is:
 unknown:32:20 mismatched token: [EMAIL PROTECTED],682:685='from',38,32:20];
 expecting type THEN

 -Chris

 On 10/4/07, Anstis, Michael (M.) [EMAIL PROTECTED] wrote:
 
   Does it not compile (in which case can you post the error)?
 
  Or does it not activate?
 
   --
  *From:* [EMAIL PROTECTED] [mailto:
  [EMAIL PROTECTED] *On Behalf Of *Chris West
  *Sent:* 04 October 2007 16:03
  *To:* Rules Users List
  *Subject:* [rules-users] using from with not
 
   Hello,
 
  Does anyone know why rule GoodBye2 below does not compile, but rule
  GoodBye1 does compile using Drools 4.0.0?  The only difference is the
  not.  Shouldn't this be valid?
 
  Thanks,
  -Chris
 
 
  package com.sample
 
  import com.sample.DroolsTest.Message;
  import com.sample.DroolsTest.Foo;
  import java.util.List;
 
  rule Hello World
  when
  m : Message( status == Message.HELLO, message : message )
  then
  System.out.println( message );
  m.setMessage( Goodbye cruel world );
  m.setStatus( Message.GOODBYE );
  update( m );
  end
 
  rule GoodBye1
  no-loop true
  when
  m : Message( status == Message.GOODBYE, message : message,
  $foos: foos )
  Foo(id == 10) from $foos
  then
  System.out.println ( message );
  m.setMessage( message );
 
  end
 
  rule GoodBye2
  no-loop true
  when
  m : Message( status == Message.GOODBYE, message : message,
  $foos: foos )
  not Foo(id == 10) from $foos
  then
  System.out.println( message );
  m.setMessage( message );
 
  end
 
 
  ___
  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] using from with not

2007-10-04 Thread Edson Tirelli
   From the manual:

A not statement must be followed by parentheses around the pattern that it
applies to. In the simplest case of a single pattern (like below) you can
omit the parentheses.

   We improved the docs for the next version. Hope it is clearer now. But
Michael got it right.

[]s
Edson

2007/10/4, Anstis, Michael (M.) [EMAIL PROTECTED]:

  What if you try not (Foo(id == 10) from $foos)?

  --
 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] *On Behalf Of *Chris West
 *Sent:* 04 October 2007 16:59
 *To:* Rules Users List
 *Subject:* Re: [rules-users] using from with not

 It does not compile.  The error is:
 unknown:32:20 mismatched token: [EMAIL PROTECTED],682:685='from',38,32:20];
 expecting type THEN

 -Chris

 On 10/4/07, Anstis, Michael (M.) [EMAIL PROTECTED] wrote:
 
   Does it not compile (in which case can you post the error)?
 
  Or does it not activate?
 
   --
  *From:* [EMAIL PROTECTED] [mailto:
  [EMAIL PROTECTED] *On Behalf Of *Chris West
  *Sent:* 04 October 2007 16:03
  *To:* Rules Users List
  *Subject:* [rules-users] using from with not
 
   Hello,
 
  Does anyone know why rule GoodBye2 below does not compile, but rule
  GoodBye1 does compile using Drools 4.0.0?  The only difference is the
  not.  Shouldn't this be valid?
 
  Thanks,
  -Chris
 
 
  package com.sample
 
  import com.sample.DroolsTest.Message;
  import com.sample.DroolsTest.Foo;
  import java.util.List;
 
  rule Hello World
  when
  m : Message( status == Message.HELLO, message : message )
  then
  System.out.println( message );
  m.setMessage( Goodbye cruel world );
  m.setStatus( Message.GOODBYE );
  update( m );
  end
 
  rule GoodBye1
  no-loop true
  when
  m : Message( status == Message.GOODBYE, message : message,
  $foos: foos )
  Foo(id == 10) from $foos
  then
  System.out.println ( message );
  m.setMessage( message );
 
  end
 
  rule GoodBye2
  no-loop true
  when
  m : Message( status == Message.GOODBYE, message : message,
  $foos: foos )
  not Foo(id == 10) from $foos
  then
  System.out.println( message );
  m.setMessage( message );
 
  end
 
 
  ___
  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





-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] using from with not

2007-10-04 Thread Chris West
Ok, the parenthesis makes sense.

But when I enclose the pattern as Michael suggested, it gets a runtime error
trying to parse.  I attached a sample project illustrating this in an
earlier response.  So isn't there still a problem?

-Chris

On 10/4/07, Edson Tirelli [EMAIL PROTECTED] wrote:


From the manual:

 A not statement must be followed by parentheses around the pattern that
 it applies to. In the simplest case of a single pattern (like below) you can
 omit the parentheses.

We improved the docs for the next version. Hope it is clearer now. But
 Michael got it right.

 []s
 Edson

 2007/10/4, Anstis, Michael (M.)  [EMAIL PROTECTED]:
 
   What if you try not (Foo(id == 10) from $foos) ?
 
   --
  *From:* [EMAIL PROTECTED] [mailto:
  [EMAIL PROTECTED] *On Behalf Of *Chris West
  *Sent:* 04 October 2007 16:59
  *To:* Rules Users List
  *Subject:* Re: [rules-users] using from with not
 
  It does not compile.  The error is:
  unknown:32:20 mismatched token: [EMAIL 
  PROTECTED],682:685='from',38,32:20];
  expecting type THEN
 
  -Chris
 
  On 10/4/07, Anstis, Michael (M.) [EMAIL PROTECTED] wrote:
  
Does it not compile (in which case can you post the error)?
  
   Or does it not activate?
  
--
   *From:* [EMAIL PROTECTED] [mailto:
   [EMAIL PROTECTED] *On Behalf Of *Chris West
   *Sent:* 04 October 2007 16:03
   *To:* Rules Users List
   *Subject:* [rules-users] using from with not
  
Hello,
  
   Does anyone know why rule GoodBye2 below does not compile, but rule
   GoodBye1 does compile using Drools 4.0.0?  The only difference is
   the not.  Shouldn't this be valid?
  
   Thanks,
   -Chris
  
  
   package com.sample
  
   import com.sample.DroolsTest.Message;
   import com.sample.DroolsTest.Foo;
   import java.util.List;
  
   rule Hello World
   when
   m : Message( status == Message.HELLO, message : message )
   then
   System.out.println( message );
   m.setMessage( Goodbye cruel world );
   m.setStatus( Message.GOODBYE );
   update( m );
   end
  
   rule GoodBye1
   no-loop true
   when
   m : Message( status == Message.GOODBYE, message : message,
   $foos: foos )
   Foo(id == 10) from $foos
   then
   System.out.println ( message );
   m.setMessage( message );
  
   end
  
   rule GoodBye2
   no-loop true
   when
   m : Message( status == Message.GOODBYE, message : message,
   $foos: foos )
   not Foo(id == 10) from $foos
   then
   System.out.println( message );
   m.setMessage( message );
  
   end
  
  
   ___
   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
 
 
 


 --
   Edson Tirelli
   Software Engineer - JBoss Rules Core Developer
   Office: +55 11 3529-6000
   Mobile: +55 11 9287-5646
   JBoss, a division of Red Hat @ www.jboss.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] using from with not

2007-10-04 Thread Chris West
Thank you for the snapshot build.  It does seem to fix the problem (and also
the bugs you mentioned you fixed).

-Chris

On 10/4/07, Edson Tirelli [EMAIL PROTECTED] wrote:


 Chris,

 I just tested your example and it works fine in 4.0.2.SNAPSHOT. We
 fixed a long list of bugs from 4.0.0 to 4.0.1/4.0.2, so I guess this is
 one of them.
 My suggestion for you is: since you will need to update anyway and we
 fixed the bugs you reported in JIRA, get and test the latest binary from
 here:


 https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/

 The only changes we expect to do in it for the 4.0.2 release are IDE
 changes, so it is very close to what you will get when it is released.

  []s
  Edson


 2007/10/4, Chris West  [EMAIL PROTECTED]:
 
  Attached is the eclipse project that illustrates the problem.  I use
  Drools 4.0.0, and have not tried this code with 4.0.1 (since bugs in it
  keep me from upgrading until 4.0.2).
 
  -Chris
 
  On 10/4/07, Chris West [EMAIL PROTECTED] wrote:
  
   That makes it compile, but during the run I get:
  
   java.lang.NullPointerException
   at org.drools.reteoo.builder.BuildUtils.createBetaNodeConstraint(
   BuildUtils.java:168)
   at org.drools.reteoo.builder.GroupElementBuilder$NotBuilder.build(
   GroupElementBuilder.java:231)
   at org.drools.reteoo.builder.GroupElementBuilder.build(
   GroupElementBuilder.java:70)
   at org.drools.reteoo.builder.GroupElementBuilder$AndBuilder.build(
   GroupElementBuilder.java:112)
   at org.drools.reteoo.builder.GroupElementBuilder.build(
   GroupElementBuilder.java:70)
   at org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(
   ReteooRuleBuilder.java:136)
   at org.drools.reteoo.builder.ReteooRuleBuilder.addRule (
   ReteooRuleBuilder.java:109)
   at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:116)
   at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java
   :262)
   at org.drools.common.AbstractRuleBase.addPackage (
   AbstractRuleBase.java:333)
   at com.sample.DroolsTest.readRule(DroolsTest.java:66)
   at com.sample.DroolsTest.main(DroolsTest.java:23)
  
  
   -Chris
  
   On 10/4/07, Anstis, Michael (M.) [EMAIL PROTECTED] wrote:
   
 What if you try not (Foo(id == 10) from $foos) ?
   
 --
*From:* [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED] *On Behalf Of *Chris West
*Sent:* 04 October 2007 16:59
*To:* Rules Users List
*Subject:* Re: [rules-users] using from with not
   
It does not compile.  The error is:
unknown:32:20 mismatched token: [EMAIL 
PROTECTED],682:685='from',38,32:20];
expecting type THEN
   
-Chris
   
On 10/4/07, Anstis, Michael (M.) [EMAIL PROTECTED] wrote:

  Does it not compile (in which case can you post the error)?

 Or does it not activate?

  --
 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] *On Behalf Of *Chris West
 *Sent:* 04 October 2007 16:03
 *To:* Rules Users List
 *Subject:* [rules-users] using from with not

  Hello,

 Does anyone know why rule GoodBye2 below does not compile, but
 rule GoodBye1 does compile using Drools 4.0.0?  The only
 difference is the not.  Shouldn't this be valid?

 Thanks,
 -Chris


 package com.sample

 import com.sample.DroolsTest.Message;
 import com.sample.DroolsTest.Foo;
 import java.util.List;

 rule Hello World
 when
 m : Message( status == Message.HELLO, message : message )
 then
 System.out.println( message );
 m.setMessage( Goodbye cruel world );
 m.setStatus( Message.GOODBYE );
 update( m );
 end

 rule GoodBye1
 no-loop true
 when
 m : Message( status == Message.GOODBYE, message : message,
 $foos: foos )
 Foo(id == 10) from $foos
 then
 System.out.println ( message );
 m.setMessage( message );

 end

 rule GoodBye2
 no-loop true
 when
 m : Message( status == Message.GOODBYE, message : message,
 $foos: foos )
 not Foo(id == 10) from $foos
 then
 System.out.println( message );
 m.setMessage( message );

 end


 ___
 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

Re: [rules-users] using from with not

2007-10-04 Thread Chris West
With 4.0.2, I know of no showstopper bugs.  But until Edson gave me the
SNAPSHOT build today, I did not have 4.0.2.

Thanks,
-Chris

On 10/4/07, Mark Proctor [EMAIL PROTECTED] wrote:

  we still have bugs which stop you upgrading?

 Mark
 Chris West wrote:

 Attached is the eclipse project that illustrates the problem.  I use
 Drools 4.0.0, and have not tried this code with 4.0.1 (since bugs in it
 keep me from upgrading until 4.0.2).

 -Chris

 On 10/4/07, Chris West [EMAIL PROTECTED] wrote:
 
  That makes it compile, but during the run I get:
 
  java.lang.NullPointerException
  at org.drools.reteoo.builder.BuildUtils.createBetaNodeConstraint(
  BuildUtils.java:168)
  at org.drools.reteoo.builder.GroupElementBuilder$NotBuilder.build (
  GroupElementBuilder.java:231)
  at org.drools.reteoo.builder.GroupElementBuilder.build(
  GroupElementBuilder.java:70)
  at org.drools.reteoo.builder.GroupElementBuilder$AndBuilder.build(
  GroupElementBuilder.java:112)
  at org.drools.reteoo.builder.GroupElementBuilder.build(
  GroupElementBuilder.java:70)
  at org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(
  ReteooRuleBuilder.java:136)
  at org.drools.reteoo.builder.ReteooRuleBuilder.addRule (
  ReteooRuleBuilder.java:109)
  at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:116)
  at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:262)
  at org.drools.common.AbstractRuleBase.addPackage (
  AbstractRuleBase.java:333)
  at com.sample.DroolsTest.readRule(DroolsTest.java:66)
  at com.sample.DroolsTest.main(DroolsTest.java:23)
 
 
  -Chris
 
  On 10/4/07, Anstis, Michael (M.) [EMAIL PROTECTED] wrote:
  
What if you try not (Foo(id == 10) from $foos) ?
  
--
   *From:* [EMAIL PROTECTED] [mailto:
   [EMAIL PROTECTED] *On Behalf Of *Chris West
   *Sent:* 04 October 2007 16:59
   *To:* Rules Users List
   *Subject:* Re: [rules-users] using from with not
  
It does not compile.  The error is:
   unknown:32:20 mismatched token: [EMAIL 
   PROTECTED],682:685='from',38,32:20];
   expecting type THEN
  
   -Chris
  
   On 10/4/07, Anstis, Michael (M.) [EMAIL PROTECTED] wrote:
   
 Does it not compile (in which case can you post the error)?
   
Or does it not activate?
   
 --
*From:* [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED] *On Behalf Of *Chris West
*Sent:* 04 October 2007 16:03
*To:* Rules Users List
*Subject:* [rules-users] using from with not
   
 Hello,
   
Does anyone know why rule GoodBye2 below does not compile, but
rule GoodBye1 does compile using Drools 4.0.0?  The only
difference is the not.  Shouldn't this be valid?
   
Thanks,
-Chris
   
   
package com.sample
   
import com.sample.DroolsTest.Message;
import com.sample.DroolsTest.Foo;
import java.util.List;
   
rule Hello World
when
m : Message( status == Message.HELLO, message : message )
then
System.out.println( message );
m.setMessage( Goodbye cruel world );
m.setStatus( Message.GOODBYE );
update( m );
end
   
rule GoodBye1
no-loop true
when
m : Message( status == Message.GOODBYE, message : message,
$foos: foos )
Foo(id == 10) from $foos
then
System.out.println ( message );
m.setMessage( message );
   
end
   
rule GoodBye2
no-loop true
when
m : Message( status == Message.GOODBYE, message : message,
$foos: foos )
not Foo(id == 10) from $foos
then
System.out.println( message );
m.setMessage( message );
   
end
   
   
___
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
 [EMAIL PROTECTED]://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