Re: [rules-users] How can I iterate through the ArrayList

2013-11-13 Thread Wolfgang Laun
You may have to phrase your question more accurately in order to get an answer.

Do you want the rule to fire if some, or if all, "value" fields of the
AwaitingAction have some value? Once or for each AwaitingAction? Or do
you want it to fire once if at least one, or if all, AwaitingActions
of all AwaitingActionLists have a field "value" with some specific
value?

Also, would you consider inserting also the AwaitingAction objects as
facts, not only the AwaitingActionList?

-W



On 13/11/2013, Govind J. Parashar  wrote:
> HI,
>
> I have a AwaitingActionList Object which has a awaitingActionsList Object
> which has a ArrayList of AwaitingAction Objects. How can I iterate through
> the ArrayList to get to check each object AwaitingAction .value in the drl
> file.
>
> Java refrence file attached
>
> Thanks
> Govind
> MASTEK LTD.
> In the US, we're called MAJESCOMASTEK
>
> ~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-mail
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to which
> it is addressed. Any review, re-transmission, dissemination or other use of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. It
> is the responsibility of the recipient to run the virus check on e-mails and
> attachments before opening them. If you have received this e-mail in error,
> kindly delete this e-mail from desktop and server.
> ~~
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] iterate through the ArrayList

2013-11-13 Thread Govind J. Parashar
Hi all

I have  Class A  which has a one attribute

private List obj =  new ArrayList();


Class B   which has a one attribute
Status
Value

How can I iterate through the ArrayList (i.e obj)  to get to check each object 
B . Status=='True'  the set Value=true  in the drl file.


Thanks
Govind
MASTEK LTD.
In the US, we're called MAJESCOMASTEK

~~
Opinions expressed in this e-mail are those of the individual and not that of 
Mastek Limited, unless specifically indicated to that effect. Mastek Limited 
does not accept any responsibility or liability for it. This e-mail and 
attachments (if any) transmitted with it are confidential and/or privileged and 
solely for the use of the intended person or entity to which it is addressed. 
Any review, re-transmission, dissemination or other use of or taking of any 
action in reliance upon this information by persons or entities other than the 
intended recipient is prohibited. This e-mail and its attachments have been 
scanned for the presence of computer viruses. It is the responsibility of the 
recipient to run the virus check on e-mails and attachments before opening 
them. If you have received this e-mail in error, kindly delete this e-mail from 
desktop and server.
~~
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] How to use type-safe enums in rule condition

2013-11-13 Thread Steven Williams
We use drools for validation rules in our application. Some of these rules
are dependent on which CRUD operation is being performed at the time, so as
part of our validation aspect we insert a CrudMode enum with the current
action (by annotating the advised method). e.g.

@Validate(validators = BusinessRulesValidator.class, mode = CREATE)
public void create(@DTO SomeDTO incomingDto)

In our rules we can then go:

CrudMode(this == CrudMode.CREATE)

The second way we use it (and this one I don't like so much) is that our
validation aspect runs both before and after a method (PRE and POST). We
use an agenda-group to to indicate which phase a rule should be included
which works fine, however we were finding that some conditions were
relatively expensive which had performance implications. Our solution was
to also include a ValidationPhase enum as a fact and use that to
short-circuit the rules. I reckon there is probably a better way to achieve
this however we didn't spend a lot of time thinking about it.

cheers
Steve

---
Steven Williams



On Thu, Nov 14, 2013 at 12:40 AM, Wolfgang Laun wrote:

> Just curiosity.
>
> On 13/11/2013, Steven Williams  wrote:
> > I use something like the following in rules to good effect:
> >
> > Country( this == Country.USA )
>
> Granted, you can add any number of attributes to an enum so that it's
> just another way of writing a static set of bean objects. But is there
> a "good effect" to be had from a pattern that merely ascertains the
> presence of an enum instance
> in the Working Memory?
>
> Other than this, a pattern like
>City( country == Country.USA )
> doesn't require the insertion of the Country enums.
>
> Cheers
> Wolfgang
> ___
> 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] How can I iterate through the ArrayList

2013-11-13 Thread Govind J. Parashar
HI,

I have a AwaitingActionList Object which has a awaitingActionsList Object which 
has a ArrayList of AwaitingAction Objects. How can I iterate through the 
ArrayList to get to check each object AwaitingAction .value in the drl file.

Java refrence file attached

Thanks
Govind
MASTEK LTD.
In the US, we're called MAJESCOMASTEK

~~
Opinions expressed in this e-mail are those of the individual and not that of 
Mastek Limited, unless specifically indicated to that effect. Mastek Limited 
does not accept any responsibility or liability for it. This e-mail and 
attachments (if any) transmitted with it are confidential and/or privileged and 
solely for the use of the intended person or entity to which it is addressed. 
Any review, re-transmission, dissemination or other use of or taking of any 
action in reliance upon this information by persons or entities other than the 
intended recipient is prohibited. This e-mail and its attachments have been 
scanned for the presence of computer viruses. It is the responsibility of the 
recipient to run the virus check on e-mails and attachments before opening 
them. If you have received this e-mail in error, kindly delete this e-mail from 
desktop and server.
~~


AwaitingAction.java
Description: AwaitingAction.java


AwaitingActionClient.java
Description: AwaitingActionClient.java


AwaitingActionList.java
Description: AwaitingActionList.java


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

Re: [rules-users] Problem in writing rule and apply DSL

2013-11-13 Thread braveheart85
Thank you I'll try these ways.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-in-writing-rule-and-apply-DSL-tp4026751p4026771.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] "distinct" operator in a query

2013-11-13 Thread Wolfgang Laun
Try an exists containing a pattern combination:

  exists ( $y: YearData( id ==  $result.identifierCode )
   and
   Vehicle( model == "foobar" ) from $y.vehicles )

-W

On 13/11/2013, braveheart85  wrote:
> First thing I'm sorry for stealing your time.
> What you say is true in this case, but what about case which i would add a
> constraint to Vehicle:
>
> query "QuerySelected"
> $result: Person( identifierCode == "ABCDEF12H45S100A" )
> $y: YearData( id ==  $result.identifierCode )
> exists Vehicle( model == "foobar" ) from $y.vehicles
> end
>
> Then again maybe my question is stupid.
>
> Andrea
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/distinct-operator-in-a-query-tp4026762p4026769.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] "distinct" operator in a query

2013-11-13 Thread braveheart85
First thing I'm sorry for stealing your time.
What you say is true in this case, but what about case which i would add a
constraint to Vehicle:

query "QuerySelected" 
$result: Person( identifierCode == "ABCDEF12H45S100A" ) 
$y: YearData( id ==  $result.identifierCode ) 
exists Vehicle( model == "foobar" ) from $y.vehicles 
end 

Then again maybe my question is stupid.

Andrea



--
View this message in context: 
http://drools.46999.n3.nabble.com/distinct-operator-in-a-query-tp4026762p4026769.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] How to use type-safe enums in rule condition

2013-11-13 Thread Wolfgang Laun
Just curiosity.

On 13/11/2013, Steven Williams  wrote:
> I use something like the following in rules to good effect:
>
> Country( this == Country.USA )

Granted, you can add any number of attributes to an enum so that it's
just another way of writing a static set of bean objects. But is there
a "good effect" to be had from a pattern that merely ascertains the
presence of an enum instance
in the Working Memory?

Other than this, a pattern like
   City( country == Country.USA )
doesn't require the insertion of the Country enums.

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


Re: [rules-users] "distinct" operator in a query

2013-11-13 Thread Wolfgang Laun
Probably what you mean is:
   exists YearData( id ==  $result.identifierCode, vehicles.size > 0 )

-W

On 13/11/2013, braveheart85  wrote:
> How can i insert an EXISTS in above query?
> I inserted exist on Vehicle but what about Year?
> I got an exception if i write:
>
> exists $y: Year( )
>
> or
>
> $y: exists Year( )
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/distinct-operator-in-a-query-tp4026762p4026766.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] "distinct" operator in a query

2013-11-13 Thread braveheart85
How can i insert an EXISTS in above query?
I inserted exist on Vehicle but what about Year?
I got an exception if i write:

exists $y: Year( )

or

$y: exists Year( )



--
View this message in context: 
http://drools.46999.n3.nabble.com/distinct-operator-in-a-query-tp4026762p4026766.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] Problem in writing rule and apply DSL

2013-11-13 Thread Wolfgang Laun
On 13/11/2013, Stephen Masters  wrote:
> Of course, you can just bypass the built in “-“ processing.
>
> [condition][]There is a Person = $p: Person()
> [condition][]The person is aged over "{age}” =$age: Integer(this > {age})
> from $person.age
>
> Of course that does require that you’re careful about writing the DSLR, so
> that you always bind a variable to Person() before using a phrase which
> expects that variable to exist.
>
> btw … Apologies, but Integer(this > {age}) is almost certainly buggy syntax.
> I can’t remember off-hand the best way to do that comparison. :-/

Integer( intValue > {age} )

-W



>
>
>
> On 13 Nov 2013, at 11:52, Wolfgang Laun  wrote:
>
>> Gee, we all have work to do to earn our keep. If you provide the dough
>> you can have instant bread ;-)
>>
>> I suggest you redesign your DSL with phrases like
>>  There is a {Fact}
>>  and a {FactA} from {FactB}'s {attribute}
>>
>> Users would have to write these in individual lines. Then, adding the
>> "- with" doesn't create a problem.
>>
>> Other than this, I don't see much hope for getting the constraint
>> where it belongs. Consider that *you* think right *now*, that it ought
>> to be in the first pattern, but s.o. else might want it in the middle
>> one...
>>
>> -W
>>
>> On 13/11/2013, braveheart85  wrote:
>>> Nobody can help me?
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/Problem-in-writing-rule-and-apply-DSL-tp4026751p4026759.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 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] "distinct" operator in a query

2013-11-13 Thread Wolfgang Laun
What about exists?

On 13/11/2013, braveheart85  wrote:
> Hello guys,
>
> I make a very simple question, especially for a curiosity.
> I have this query:
>
> query "QuerySelected"
>   $result: Person( identifierCode == "ABCDEF12H45S100A" )
>   $y: YearData( id ==  $result.identifierCode )
>   exists Vehicle( ) from $y.vehicles
> end
>
> With this query i get two equal person results because there are two annual
> that matches with condition.
> There is a simple way in drools to apply "distinct" operator or avoid this
> behaviour.
>
> Best regards
>
> Andrea
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/distinct-operator-in-a-query-tp4026762.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] Problem in writing rule and apply DSL

2013-11-13 Thread Stephen Masters
Of course, you can just bypass the built in “-“ processing.

[condition][]There is a Person = $p: Person()
[condition][]The person is aged over "{age}” =$age: Integer(this > {age}) from 
$person.age 

Of course that does require that you’re careful about writing the DSLR, so that 
you always bind a variable to Person() before using a phrase which expects that 
variable to exist.

btw … Apologies, but Integer(this > {age}) is almost certainly buggy syntax. I 
can’t remember off-hand the best way to do that comparison. :-/



On 13 Nov 2013, at 11:52, Wolfgang Laun  wrote:

> Gee, we all have work to do to earn our keep. If you provide the dough
> you can have instant bread ;-)
> 
> I suggest you redesign your DSL with phrases like
>  There is a {Fact}
>  and a {FactA} from {FactB}'s {attribute}
> 
> Users would have to write these in individual lines. Then, adding the
> "- with" doesn't create a problem.
> 
> Other than this, I don't see much hope for getting the constraint
> where it belongs. Consider that *you* think right *now*, that it ought
> to be in the first pattern, but s.o. else might want it in the middle
> one...
> 
> -W
> 
> On 13/11/2013, braveheart85  wrote:
>> Nobody can help me?
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Problem-in-writing-rule-and-apply-DSL-tp4026751p4026759.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] "distinct" operator in a query

2013-11-13 Thread braveheart85
Hello guys,

I make a very simple question, especially for a curiosity.
I have this query:

query "QuerySelected"
$result: Person( identifierCode == "ABCDEF12H45S100A" )
$y: YearData( id ==  $result.identifierCode )
exists Vehicle( ) from $y.vehicles 
end

With this query i get two equal person results because there are two annual
that matches with condition.
There is a simple way in drools to apply "distinct" operator or avoid this
behaviour.

Best regards

Andrea



--
View this message in context: 
http://drools.46999.n3.nabble.com/distinct-operator-in-a-query-tp4026762.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] Problem in writing rule and apply DSL

2013-11-13 Thread Wolfgang Laun
Gee, we all have work to do to earn our keep. If you provide the dough
you can have instant bread ;-)

I suggest you redesign your DSL with phrases like
  There is a {Fact}
  and a {FactA} from {FactB}'s {attribute}

Users would have to write these in individual lines. Then, adding the
"- with" doesn't create a problem.

Other than this, I don't see much hope for getting the constraint
where it belongs. Consider that *you* think right *now*, that it ought
to be in the first pattern, but s.o. else might want it in the middle
one...

-W

On 13/11/2013, braveheart85  wrote:
> Nobody can help me?
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Problem-in-writing-rule-and-apply-DSL-tp4026751p4026759.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] Problem in writing rule and apply DSL

2013-11-13 Thread braveheart85
Nobody can help me?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Problem-in-writing-rule-and-apply-DSL-tp4026751p4026759.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] Out of Mem and thousand threads : Disabling JIT ?

2013-11-13 Thread Raphael Jolivet
Ok, I have figured it out :
I created a META-INF/drools.rulebase.conf with the correct setting.
It works fine now.

Thanks


2013/11/12 Raphael Jolivet 

> Hi again.
>
> I have looked at PermGenThresholdOption but do not find an exmaple of how
> to set those option porgammatically:
> KnowledgeBuilder#newKnowledgeBase() does not seem to take any
> configuration.
>
> Thanks for your help.
> Raphael
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users