[rules-users] Grouping and Aggregation in Drools

2011-01-07 Thread Manav
Hi, 
I have a slightly tricky problem on my hand that i am trying to solve using 
rules. 

I am using version 5.1 of Drools.Appreciate if there are any suggestions / 
pointers . 


I have a customer who will have a shopping cart with various products. For 
example 

the shopping cart will be a list of products that belong to a certain 
sub-category and 

super category like 

product-id= 'Noodles', sub-category='PackagedFood', super-category='FMCG-Food', 
%value of total=3%
product-id= 'Cookies', sub-category='PackagedFood',super-category='FMCG-Food', 
%value of total=6%
product-id= 'Pizza', sub-category='ReadyToEat',super-category='FMCG-Food', 
%value of total=5%
product-id= 'Burgers', sub-category='ReadyToEat',super-category='FMCG-Food', 
%value of total=7%
product-id= 'Shampoo', 
sub-category='Toiletaries',super-category='FMCG-NonFood', 
%value of total=4%
product-id= 'Conditioner', 
sub-category='Toiletaries',super-category='FMCG-NonFood', %value of total=8%

The customer will also have a suggested cart that serves as a reference at the 
sub-category and supercategory level. The reference will tell what level of his 
total purchase he can spend on the sub-category and super-category. The 
reference will look something like 


super-category='FMCG-Food', %value-suggested=20%
super-category='FMCG-NonFood', %value-suggested=15%
sub-category='PackagedFood',%value-suggested=10%
sub-category='ReadyToEat',%value-suggested=10%
sub-category='Toiletaries',%value-suggested=6%

Looking at this example the customer is going overboard in the FMCG-Food super 
category as the suggested 

limit is 20% and the actual grouped at the supsercategory is 21% . Also he is 
crossing the limit at the 

sub-category level for ReadyToEat (suggested is 10% vs actual is 12%) and 
Toiletaries (suggested is 6% vs actual 12%)

My problem is how do i  group the actual data at various supercategory level, 
sum the %value and then compare it with the suggested in the when clause. 


If they cross the limit i will then have some action taken in the then clause. 
Similarly i will have to do the same at the sub-category level as well. 
Regards,
Manav



  

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


[rules-users] Drools Flow Fluent API and the StateNode

2011-01-07 Thread Daniel Nathanson
Hi,

How can I create a StateNode using the DroolsFlowProcessFactory?  I'm  
using Drools 5.1.1 and the StateNode exists, but there is no method:

 StateNodeFactory stateNode(long)

available.  For that matter, there is no StateNodeFactory class either.

Is this an oversight? Do I need a newer version of Drools?  Is there a  
workaround?

Regards,

Dan Nathanson

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


Re: [rules-users] Need help with Decision Table Conditions

2011-01-07 Thread Jason Mihalick

Tihomir,

Do you know if decision tables support 
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e3368
metadata ?
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2215160.html
Sent from the Drools - User 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] Compiling rules using maven?

2011-01-07 Thread Ansgar Konermann
Hi,

is there any official support for compiling *.drl files into 
pre-compiled binary rule packages using a maven plugin?

I found reminescents of a maven plugin in the ticket tracking system, 
but the code seems to be orphaned.

Thanks in advance

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


[rules-users] Can I deploy pre-compiled drools rules as OSGi bundles?

2011-01-07 Thread Ansgar Konermann
Hi,

I heard that drools was called "OSGi ready" some time ago. As I am new 
to OSGi, I'd like to hear some opinions on whether the following 
scenario would work for rules deployment:

For the drools part:
- pre-compile all rules into a binary package file
- include these file as a resource into an OSGi bundle
- put a configuration file, say drools-rules.xml into META-INF, 
containing references to all the rule files/resources which should be 
loaded/used

For the OSGi part:
- create an extender bundle which uses the information from the 
configuration file of the above bundle
- automatically de-serializes the rule packages and
- registers a service which offers methods to run the rules contained in 
the rules bundle

The service interface in my case would be project-specific, and would be 
the same for all rule bundles. We have multiple customers, each with 
their own implementation of a ruleset for risk estimation. Each service 
instance could carry a property configured in the 
META-INF/drools-rules.xml file, making it easy for client code to find 
the correct service instance to call.

What I'm particularly interested in:
- does Drools support being used in an OSGi setting as sketched above?
- can anyone estimate whether I will I into class loading issues?


Thanks in advance

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


[rules-users] Integrating Drools Fusion and JBPM5

2011-01-07 Thread Plug Tree
Hi guys, just wanted to share a little post that we wrote about the
integration of CustomEventListeners in JBPM5 and CEP in Drools Fusion to
control processes.
 <%20http://www.plugtree.com/?p=26492>
ttp://www.plugtree.com/?p=26492 <%20http://www.plugtree.com/?p=26492>

Feedback is appreciated ! Thanks!

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


Re: [rules-users] Speed up inserting of rules into knowledge base

2011-01-07 Thread Corneil du Plessis

you may reconsider the structure of the rules.

Push instead of pull. This means compare the file time or content to the 
database and only recreate rules that have modified. This way you can 
update the serialized packages where appropriate.


Without knowing what your rules looks like I can offer the following:
Consider using decision tables where the rules are similar but based on 
data.
Consider having rules that to retrieve the data instead of rules 
generated from the data.

Consider that some of the data may be facts and not rules.

If you can generate rules from data then you can write rules that use 
the data as facts.


On 07/01/2011 16:16, Piotr Jedrychowski wrote:

Part:
knowledgeBuilder.add(resource, ResourceType.DRL);
is the most expensive part of my source code - rest of instructions 
are nothing when you compare them to above line.


I cannot serialize the compiled rule packages because rules are 
generated from data read from database and this data isn't static. 
Data is generated before loading rules from files that user can change 
- so I have to do this:

1) read files (which could be changed by user since last JBoss startup)
2) process files and generate rows for database
3) get rows from database and generate rules for Drools

Rules aren't stored directly into database - I wasn't accurate in my 
previous e-mail. - sorry.




On 2011-01-07 14:00, Corneil du Plessis wrote:

You should only repeat

knowledgeBuilder.add(resource, ResourceType.DRL);

for each rule.

The next thing you can do is to serialize the compiled rule packages.

You should also consider using Guvnor to manage your rules.

On 07/01/2011 14:05, Piotr Jedrychowski wrote:

Hello.

I'm loading a big amount of rules during starting of JBoss (2 
rules). All rules (in string format) are available before JBoss 
startup - they are stored into database. Rules are loaded one by one 
and it takes about 90 minutes. I want to speed up this process. Is 
there something like "bulk load" for inserting rules into knowledge 
base or another smart way to fast loading a big amount of rules?


I'm using:
1) Drools 5.1
2) JBoss 4.2.3

My source code looks like this:

String rule = ...
Resource resource = ResourceFactory.newReaderResource(new 
StringReader(rule));
KnowledgeBuilder knowledgeBuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();

knowledgeBuilder.add(resource, ResourceType.DRL);
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());

Regards,
Piotr


___
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] Speed up inserting of rules into knowledge base

2011-01-07 Thread Swindells, Thomas
It depends on your use case but do you actually need to generate rules each 
time? Or could you have a static set of rules and insert extra data in your 
working memory to simulate each of the rules?

If your scenario was you have different pricing rules for different customers 
and your data was something like the following:
Customer, Discount
A, 0.9
B, 0.89
C. 0.95

You could either generate 3 rules:

Rule "Customer A pricing"
When
P: Purchase(customer == "A", finalPrice == null)
Then
Modify(p) {
p.setFinalPrice(p.getPrice()*0.9);
}
End

Rule "Customer B pricing"
When
P: Purchase(customer == "B", finalPrice == null)
Then
Modify(p) {
p.setFinalPrice(p.getPrice()*0.89);
}
End

Rule "Customer C pricing"
When
P: Purchase(customer == "C", finalPrice == null)
Then
Modify(p) {
p.setFinalPrice(p.getPrice()*0.95);
}
End

Or you could insert a CustomerDetails(customer, discount) for each customer and 
have a single rule
Rule "Customer pricing"
When
C : CustomerDetails()
P : Purchase(customer == c.name, finalPrice == null)
Then
Modify(p) {
p.setFinalPrice(p.getPrice()*c.getDiscount());
}

Don't know if it will help or not - depends on your scenario.

Thomas

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Piotr Jedrychowski
Sent: 07 January 2011 14:16
To: Rules Users List
Subject: Re: [rules-users] Speed up inserting of rules into knowledge base

Part:
knowledgeBuilder.add(resource, ResourceType.DRL);
is the most expensive part of my source code - rest of instructions are nothing 
when you compare them to above line.

I cannot serialize the compiled rule packages because rules are generated from 
data read from database and this data isn't static. Data is generated before 
loading rules from files that user can change - so I have to do this:
1) read files (which could be changed by user since last JBoss startup)
2) process files and generate rows for database
3) get rows from database and generate rules for Drools

Rules aren't stored directly into database - I wasn't accurate in my previous 
e-mail. - sorry.



On 2011-01-07 14:00, Corneil du Plessis wrote:
You should only repeat

knowledgeBuilder.add(resource, ResourceType.DRL);

for each rule.

The next thing you can do is to serialize the compiled rule packages.

You should also consider using Guvnor to manage your rules.

On 07/01/2011 14:05, Piotr Jedrychowski wrote:
Hello.

I'm loading a big amount of rules during starting of JBoss (2 rules). All 
rules (in string format) are available before JBoss startup - they are stored 
into database. Rules are loaded one by one and it takes about 90 minutes. I 
want to speed up this process. Is there something like "bulk load" for 
inserting rules into knowledge base or another smart way to fast loading a big 
amount of rules?

I'm using:
1) Drools 5.1
2) JBoss 4.2.3

My source code looks like this:

String rule = ...
Resource resource = ResourceFactory.newReaderResource(new StringReader(rule));
KnowledgeBuilder knowledgeBuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add(resource, ResourceType.DRL);
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());

Regards,
Piotr




___

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



**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Speed up inserting of rules into knowledge base

2011-01-07 Thread Piotr Jedrychowski

Part:
knowledgeBuilder.add(resource, ResourceType.DRL);
is the most expensive part of my source code - rest of instructions are 
nothing when you compare them to above line.


I cannot serialize the compiled rule packages because rules are 
generated from data read from database and this data isn't static. Data 
is generated before loading rules from files that user can change - so I 
have to do this:

1) read files (which could be changed by user since last JBoss startup)
2) process files and generate rows for database
3) get rows from database and generate rules for Drools

Rules aren't stored directly into database - I wasn't accurate in my 
previous e-mail. - sorry.




On 2011-01-07 14:00, Corneil du Plessis wrote:

You should only repeat

knowledgeBuilder.add(resource, ResourceType.DRL);

for each rule.

The next thing you can do is to serialize the compiled rule packages.

You should also consider using Guvnor to manage your rules.

On 07/01/2011 14:05, Piotr Jedrychowski wrote:

Hello.

I'm loading a big amount of rules during starting of JBoss (2 
rules). All rules (in string format) are available before JBoss 
startup - they are stored into database. Rules are loaded one by one 
and it takes about 90 minutes. I want to speed up this process. Is 
there something like "bulk load" for inserting rules into knowledge 
base or another smart way to fast loading a big amount of rules?


I'm using:
1) Drools 5.1
2) JBoss 4.2.3

My source code looks like this:

String rule = ...
Resource resource = ResourceFactory.newReaderResource(new 
StringReader(rule));
KnowledgeBuilder knowledgeBuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();

knowledgeBuilder.add(resource, ResourceType.DRL);
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());

Regards,
Piotr


___
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] Speed up inserting of rules into knowledge base

2011-01-07 Thread Corneil du Plessis

You should only repeat

knowledgeBuilder.add(resource, ResourceType.DRL);

for each rule.

The next thing you can do is to serialize the compiled rule packages.

You should also consider using Guvnor to manage your rules.

On 07/01/2011 14:05, Piotr Jedrychowski wrote:

Hello.

I'm loading a big amount of rules during starting of JBoss (2 
rules). All rules (in string format) are available before JBoss 
startup - they are stored into database. Rules are loaded one by one 
and it takes about 90 minutes. I want to speed up this process. Is 
there something like "bulk load" for inserting rules into knowledge 
base or another smart way to fast loading a big amount of rules?


I'm using:
1) Drools 5.1
2) JBoss 4.2.3

My source code looks like this:

String rule = ...
Resource resource = ResourceFactory.newReaderResource(new 
StringReader(rule));
KnowledgeBuilder knowledgeBuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();

knowledgeBuilder.add(resource, ResourceType.DRL);
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());

Regards,
Piotr


___
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] Speed up inserting of rules into knowledge base

2011-01-07 Thread Piotr Jedrychowski

Hello.

I'm loading a big amount of rules during starting of JBoss (2 
rules). All rules (in string format) are available before JBoss startup 
- they are stored into database. Rules are loaded one by one and it 
takes about 90 minutes. I want to speed up this process. Is there 
something like "bulk load" for inserting rules into knowledge base or 
another smart way to fast loading a big amount of rules?


I'm using:
1) Drools 5.1
2) JBoss 4.2.3

My source code looks like this:

String rule = ...
Resource resource = ResourceFactory.newReaderResource(new 
StringReader(rule));
KnowledgeBuilder knowledgeBuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();

knowledgeBuilder.add(resource, ResourceType.DRL);
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());

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


Re: [rules-users] Drools definitive list of Error Codes

2011-01-07 Thread Wolfgang Laun
Don't rely on the error numerals, just read the error message text.
-W

On 07/01/2011, Murali Venugopal  wrote:
> Oopps sorry for being lazy.
>
>   _ _ _ _ |.
> | | ||_|| (_|||  \/
>
>
>
>
> On 01/07/2011 02:45 PM, Michael Anstis wrote:
>> The wonders of documentation
>> 
>>
>>
>> On 7 January 2011 07:55, Murali Venugopal
>> mailto:murali.venugo...@sifycorp.com>>
>> wrote:
>>
>>
>> Hi,
>>
>> I looking forward to find a Definitive List of Error codes and
>> their definitions. Please help me to find and understand them.
>>
>> eg: [ERR 102], [ERR 101]
>>
>>
>>  _ _ _ _ |.
>> | | ||_|| (_|||  \/
>>
>>
>>
>>
>> Get your world in your inbox!
>>
>> Mail, widgets, documents, spreadsheets, organizer and much more
>> with your Sifymail WIYI id!
>> Log on to http://www.sify.com
>>
>> ** DISCLAIMER **
>> Information contained and transmitted by this E-MAIL is proprietary to
>> Sify Limited and is intended for use only by the individual or
>> entity to
>> which it is addressed, and may contain information that is privileged,
>> confidential or exempt from disclosure under applicable law. If
>> this is a
>> forwarded message, the content of this E-MAIL may not have been
>> sent with
>> the authority of the Company. If you are not the intended
>> recipient, an
>> agent of the intended recipient or a  person responsible for
>> delivering the
>> information to the named recipient,  you are notified that any use,
>> distribution, transmission, printing, copying or dissemination of this
>> information in any way or in any manner is strictly prohibited. If
>> you have
>> received this communication in error, please delete this mail &
>> notify us
>> immediately at ad...@sifycorp.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


Re: [rules-users] Drools definitive list of Error Codes

2011-01-07 Thread Murali Venugopal

Oopps sorry for being lazy.

 _ _ _ _ |.
| | ||_|| (_|||  \/




On 01/07/2011 02:45 PM, Michael Anstis wrote:
The wonders of documentation 




On 7 January 2011 07:55, Murali Venugopal 
mailto:murali.venugo...@sifycorp.com>> 
wrote:



Hi,

I looking forward to find a Definitive List of Error codes and
their definitions. Please help me to find and understand them.

eg: [ERR 102], [ERR 101]


 _ _ _ _ |.
| | ||_|| (_|||  \/




Get your world in your inbox!

Mail, widgets, documents, spreadsheets, organizer and much more
with your Sifymail WIYI id!
Log on to http://www.sify.com

** DISCLAIMER **
Information contained and transmitted by this E-MAIL is proprietary to
Sify Limited and is intended for use only by the individual or
entity to
which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If
this is a
forwarded message, the content of this E-MAIL may not have been
sent with
the authority of the Company. If you are not the intended
recipient, an
agent of the intended recipient or a  person responsible for
delivering the
information to the named recipient,  you are notified that any use,
distribution, transmission, printing, copying or dissemination of this
information in any way or in any manner is strictly prohibited. If
you have
received this communication in error, please delete this mail &
notify us
immediately at ad...@sifycorp.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


Re: [rules-users] Drools definitive list of Error Codes

2011-01-07 Thread Michael Anstis
The wonders of 
documentation


On 7 January 2011 07:55, Murali Venugopal wrote:

>
> Hi,
>
> I looking forward to find a Definitive List of Error codes and their
> definitions. Please help me to find and understand them.
>
> eg: [ERR 102], [ERR 101]
>
>
>  _ _ _ _ |.
> | | ||_|| (_|||  \/
>
>
>
>
> Get your world in your inbox!
>
> Mail, widgets, documents, spreadsheets, organizer and much more with your
> Sifymail WIYI id!
> Log on to http://www.sify.com
>
> ** DISCLAIMER **
> Information contained and transmitted by this E-MAIL is proprietary to
> Sify Limited and is intended for use only by the individual or entity to
> which it is addressed, and may contain information that is privileged,
> confidential or exempt from disclosure under applicable law. If this is a
> forwarded message, the content of this E-MAIL may not have been sent with
> the authority of the Company. If you are not the intended recipient, an
> agent of the intended recipient or a  person responsible for delivering the
> information to the named recipient,  you are notified that any use,
> distribution, transmission, printing, copying or dissemination of this
> information in any way or in any manner is strictly prohibited. If you have
> received this communication in error, please delete this mail & notify us
> immediately at ad...@sifycorp.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] Drools definitive list of Error Codes

2011-01-07 Thread Murali Venugopal

Hi,

I looking forward to find a Definitive List of Error codes and their 
definitions. Please help me to find and understand them.

eg: [ERR 102], [ERR 101]


  _ _ _ _ |.
| | ||_|| (_|||  \/




Get your world in your inbox!

Mail, widgets, documents, spreadsheets, organizer and much more with your 
Sifymail WIYI id!
Log on to http://www.sify.com

** DISCLAIMER **
Information contained and transmitted by this E-MAIL is proprietary to 
Sify Limited and is intended for use only by the individual or entity to 
which it is addressed, and may contain information that is privileged, 
confidential or exempt from disclosure under applicable law. If this is a 
forwarded message, the content of this E-MAIL may not have been sent with 
the authority of the Company. If you are not the intended recipient, an 
agent of the intended recipient or a  person responsible for delivering the 
information to the named recipient,  you are notified that any use, 
distribution, transmission, printing, copying or dissemination of this 
information in any way or in any manner is strictly prohibited. If you have 
received this communication in error, please delete this mail & notify us 
immediately at ad...@sifycorp.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users