[rules-users] Contains an object

2012-04-26 Thread gboro54
Is there a way to use contains with an object? i.e

obj:Object(collection contains SubObject(string=TST,int=1))


I know you could do a from but we are writing a DSL and it would be great if
I could accomplish something like this above

TIA!

--
View this message in context: 
http://drools.46999.n3.nabble.com/Contains-an-object-tp3941334p3941334.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] Contains an object

2012-04-26 Thread gboro54
I guess I could also have a method on my main object that takes parameters
and just do a not null check...


gboro54 wrote
 
 Is there a way to use contains with an object? i.e
 
 obj:Object(collection contains SubObject(string=TST,int=1))
 
 
 I know you could do a from but we are writing a DSL and it would be great
 if I could accomplish something like this above
 
 TIA!
 


--
View this message in context: 
http://drools.46999.n3.nabble.com/Contains-an-object-tp3941334p3941343.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] Contains an object

2012-04-26 Thread gboro54
Yes I know that from can be used with DSL. I was just trying to think of a
way to do something with a sub part of the object(i.e a dsl entry with a - )


laune wrote
 
 On 26/04/2012, gboro54 lt;gboro54@gt; wrote:
 Is there a way to use contains with an object? i.e
 
 Yes, but've got to follow Java's sytax rules (apart from using
 additional operators).
 
 

 obj:Object(collection contains SubObject(string=TST,int=1))

 
 The second operand isn't a valid Java expression.
 
 Rather than being forced to use from, consider inserting SubObjects as
 facts.
 
$subobj: SubObject(string=TST,int=1)
obj:Object(collection contains $subobj)
 

 I know you could do a from but we are writing a DSL and it would be great
 if
 I could accomplish something like this above
 
 But using from can be accomplished with a DSL phrase as well.
 
 -W
 

 TIA!

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Contains-an-object-tp3941334p3941334.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@.jboss
 https://lists.jboss.org/mailman/listinfo/rules-users

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


--
View this message in context: 
http://drools.46999.n3.nabble.com/Contains-an-object-tp3941334p3941387.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] Contains an object

2012-04-26 Thread Wolfgang Laun
On 26/04/2012, gboro54 gbor...@gmail.com wrote:
 Is there a way to use contains with an object? i.e

Yes, but've got to follow Java's sytax rules (apart from using
additional operators).



 obj:Object(collection contains SubObject(string=TST,int=1))


The second operand isn't a valid Java expression.

Rather than being forced to use from, consider inserting SubObjects as facts.

   $subobj: SubObject(string=TST,int=1)
   obj:Object(collection contains $subobj)


 I know you could do a from but we are writing a DSL and it would be great
 if
 I could accomplish something like this above

But using from can be accomplished with a DSL phrase as well.

-W


 TIA!

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Contains-an-object-tp3941334p3941334.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