Re: [rules-users] Jbilling Drools performance

2010-05-19 Thread Greg Barton
See attached project, DroolsBilling.
You can build it with Maven from the project directory: mvn clean package

To run it after building: java -jar target/DroolsBilling-1.0.jar numRules 
numPhoneNumbersPerThread
$ java -server -jar target/DroolsBilling-1.0.jar 100 10Rules load time: 
3482msRules execution time: 732ms, per number: 0.00732msRules execution time: 
731ms, per number: 0.00731msRules execution time: 746ms, per number: 
0.00746msRules execution time: 760ms, per number: 0.0076msRules execution time: 
832ms, per number: 0.00832msRules execution time: 623ms, per number: 
0.00623msRules execution time: 600ms, per number: 0.0060msRules execution time: 
632ms, per number: 0.00632msRules execution time: 630ms, per number: 
0.0063msRules execution time: 607ms, per number: 0.00607msDONE!
At higher numbers of rules you have to increase the perm gen and heap memory:
$ java -server -Xmx1024M -XX:MaxPermSize=128M -jar target/DroolsBilling-1.0.jar 
1 10Rules load time: 58317msRules execution time: 1580ms, per number: 
0.0158msRules execution time: 1580ms, per number: 0.0158msRules execution time: 
1586ms, per number: 0.01586msRules execution time: 2493ms, per number: 
0.02493msRules execution time: 2502ms, per number: 0.02502msRules execution 
time: 1360ms, per number: 0.0136msRules execution time: 1358ms, per number: 
0.01358msRules execution time: 1376ms, per number: 0.01376msRules execution 
time: 473ms, per number: 0.00473msRules execution time: 489ms, per number: 
0.00489msDONE!
As you can see the time to process one phone number is lower than 1 minute. :)  
The example uses 5 concurrent threads and was executed on a 4 core machine.
A Sample.drl is included that shows the format of the rules generated, 
basically this:
rule PhoneNumber0 whenp : PhoneNumber( digit0 == '0', 
digit1 == '0', digit2 == '0', digit3 == '0', digit4 == '0', digit5 == '0', 
digit6 == '0', digit7 == '0', digit8 == '0', digit9 == '0')  then
p.setPrice(0.0);end
They should be substantially similar to the rules generated behind the decision 
table you've given, so the performance should be similar.  As you can see from 
the times above, rule creation is expensive but execution is cheap.  As Mark 
said, reuse the KnowledgeBase.

--- On Tue, 5/18/10, Antonio Anderson Souza anto...@voicetechnology.com.br 
wrote:

From: Antonio Anderson Souza anto...@voicetechnology.com.br
Subject: Re: [rules-users] Jbilling Drools performance
To: Rules Users List rules-users@lists.jboss.org
Date: Tuesday, May 18, 2010, 4:11 PM

Greg, 



CDR is a Call Detail Record, sorry I forgot to explain it, the object is
 a POJO with the following attributes:


field: name: datereference type: DATE value: 2010-04-28 00:00:00.0

field: name: billingid type: STRING value: 20100428.15544.42adf

field: name: accountid type: INTEGER value: 15544

field: name: billingperiod type: STRING value: 20100401

field: name: billingclassification type: STRING value: DUR

field: name: ipxcallguid type: STRING value: 
5k692927-guwtka-g8kj8d0u-1-g8krry54-o4n

field: name: transactiondatetime type: DATE value: 2010-04-28 
20:21:01.337

field: name: billingitemid type: INTEGER value: 0

field: name: ratesystem type: STRING value: IPXNET

field: name: originnumber type: STRING value: 
551135880...@bitcompany.braste

field: name: destinationnumber type: STRING value: 551139012650

field: name: destinationareaid type: STRING value: 10551

field: name: chargedduration type: DATE value: 1980-01-01 00:02:06.0

field: name: chargedamount type: FLOAT value: 0.0816

field: name: userid type: INTEGER value: 3372

field: name: username type: STRING value: bitcom51

field: name: unitamount type: FLOAT value: 0.00389

field: name: amountcurrency type: STRING value: USD

field: name: timezone type: INTEGER value: -3

field: name: registertype type: STRING value: MV

field: name: datelastupdated type: DATE value: 2010-04-29 02:57:18.54

field: name: lastupdatedby type: STRING value: IPXRateCalls rev032

field: name: lastupdateremarks type: STRING value: null

field: name: dateinserted type: DATE value: 2010-04-29 02:57:18.54

field: name: destinationdetail type: STRING value: SAO PAULO

field: name: type type: STRING value: Fixo

field: name: collectedcallflag type: INTEGER value: 0

field: name: jb_timestamp type: DATE value: null

field: name: digit0 type: INTEGER value: 5

field: name: digit1 type: INTEGER value: 5

field: name: digit2 type: INTEGER value: 1

field: name: digit3 type: INTEGER value: 1

field: name: digit4 type: INTEGER value: 3

field: name: digit5 type: INTEGER value: 9

field: name: digit6 type: INTEGER value: 0

field: name: digit7 type: INTEGER value: 1

field: name: digit8 type: INTEGER value: 2

field: name: digit9 type: INTEGER value: 6

field: name: digit10 type: INTEGER value: 5

field: name: digit11 type: INTEGER value: 0


This spreadsheet is only a sample because the whole one has 4 rules, I'm 
checking the 

Re: [rules-users] [Drools Fusion] Can't detect 2 occurrences with sliding window

2010-05-19 Thread Xavier Coulon

Hello Wolfgang,

sorry, I wasn't available yesterday.
I just followed your instructions:

Here's my test method now :

@SuppressWarnings(unchecked)
@Test
public void testActivity() throws IOException, ParseException,
InterruptedException {
// parse the log file
Resource logFile = new ClassPathResource(
activity/activity18h20-18h30-extract.log);
// converter and inject tracks in the session,
ListString logLines = FileUtils.readLines(logFile.getFile(),
UTF-8);
LOGGER.info(loading events);
// load events from stream
Operation previousOperation = null;
for (String logLine : logLines) {
Operation operation = LineConverterUtil.getOperation(logLine);
Assert.assertFalse(Current operation equals() previous one,
operation.equals(previousOperation));
Assert.assertFalse(Current operation == previous one,
operation == previousOperation);
previousOperation = operation;
LOGGER.debug(Moving clock from 
+ (new Date(clock.getCurrentTime())).toString() +  to 
+ operation.getDate());
clock.advanceTime(operation.getDate().getTime()
- clock.getCurrentTime(), TimeUnit.MILLISECONDS);
// clock.advanceTime(10, TimeUnit.SECONDS);
LOGGER.debug(Inserting  + operation);
FactHandle operationHandle = entryPoint.insert(operation);
LOGGER.debug(Insertion done:  +
operationHandle.toExternalForm());

}
session.fireAllRules();

LOGGER.info(done with events);
// check...
Assert.assertTrue(Rule not fired..., listener
.isRuleFired(overActivity));
}

And the logs in the console :

Console 2010-05-19 09:57:06|INFO ||DroolsRulesTestCase.testActivity|loading
events
Console 2010-05-19 09:57:06|DEBUG||DroolsRulesTestCase.testActivity|Moving
clock from Thu Jan 01 01:00:00 CET 1970 to Fri Apr 30 18:26:47 CEST 2010
Console 2010-05-19
09:57:06|DEBUG||DroolsRulesTestCase.testActivity|Inserting Operation
[date=Fri Apr 30 18:26:47 CEST 2010, executionTime=1, hostname=server1,
ipAddress=1.2.3.4, operation=null, requestSize=0, responseSize=0]
Console 2010-05-19 09:57:06|WARN
||TrackingWorkingMemoryEventListener.objectInserted|Object inserted: [event
fid:1:1:Operation [date=Fri Apr 30 18:26:47 CEST 2010, executionTime=1,
hostname=server1, ipAddress=1.2.3.4, operation=null, requestSize=0,
responseSize=0]]
Console 2010-05-19
09:57:06|DEBUG||DroolsRulesTestCase.testActivity|Insertion done: [event
fid:1:1:Operation [date=Fri Apr 30 18:26:47 CEST 2010, executionTime=1,
hostname=server1, ipAddress=1.2.3.4, operation=null, requestSize=0,
responseSize=0]]
Console 2010-05-19 09:57:06|DEBUG||DroolsRulesTestCase.testActivity|Moving
clock from Fri Apr 30 18:26:47 CEST 2010 to Fri Apr 30 18:27:11 CEST 2010
Console 2010-05-19
09:57:06|DEBUG||DroolsRulesTestCase.testActivity|Inserting Operation
[date=Fri Apr 30 18:27:11 CEST 2010, executionTime=164, hostname=server1,
ipAddress=1.2.3.4, operation=CONSULTATION, requestSize=1299,
responseSize=895]
Console 2010-05-19 09:57:06|WARN
||TrackingWorkingMemoryEventListener.objectRetracted|Object retracted:
[event fid:1:1:Operation [date=Fri Apr 30 18:26:47 CEST 2010,
executionTime=1, hostname=server1, ipAddress=1.2.3.4, operation=null,
requestSize=0, responseSize=0]]
Console 2010-05-19 09:57:06|WARN
||TrackingWorkingMemoryEventListener.objectInserted|Object inserted: [event
fid:2:2:Operation [date=Fri Apr 30 18:27:11 CEST 2010, executionTime=164,
hostname=server1, ipAddress=1.2.3.4, operation=CONSULTATION,
requestSize=1299, responseSize=895]]
Console 2010-05-19
09:57:06|DEBUG||DroolsRulesTestCase.testActivity|Insertion done: [event
fid:2:2:Operation [date=Fri Apr 30 18:27:11 CEST 2010, executionTime=164,
hostname=server1, ipAddress=1.2.3.4, operation=CONSULTATION,
requestSize=1299, responseSize=895]]
Console 2010-05-19 09:57:06|DEBUG||DroolsRulesTestCase.testActivity|Moving
clock from Fri Apr 30 18:27:11 CEST 2010 to Fri Apr 30 18:28:47 CEST 2010
Console 2010-05-19
09:57:06|DEBUG||DroolsRulesTestCase.testActivity|Inserting Operation
[date=Fri Apr 30 18:28:47 CEST 2010, executionTime=1, hostname=server1,
ipAddress=1.2.3.4, operation=null, requestSize=0, responseSize=0]
Console 2010-05-19 09:57:06|WARN
||TrackingWorkingMemoryEventListener.objectRetracted|Object retracted:
[event fid:2:2:Operation [date=Fri Apr 30 18:27:11 CEST 2010,
executionTime=164, hostname=server1, ipAddress=1.2.3.4,
operation=CONSULTATION, requestSize=1299, responseSize=895]]
Console 2010-05-19 09:57:06|WARN
||TrackingWorkingMemoryEventListener.objectInserted|Object inserted: [event
fid:3:3:Operation [date=Fri Apr 30 18:28:47 CEST 2010, executionTime=1,
hostname=server1, ipAddress=1.2.3.4, operation=null, requestSize=0,
responseSize=0]]
Console 2010-05-19

[rules-users] use rule assign actor

2010-05-19 Thread HONG DENG
hi , i am a drools flow newbie.I want to  using assignment rule
assign a actor to a HumanTask. I have write a dsl and dslr files and
following code :

   kbuilder.add(ResourceFactory.newClassPathResource(HelloWorldSample.rf),
ResourceType.DRF);
   kbuilder.add(ResourceFactory.newClassPathResource(assignment.dsl),
ResourceType.DSL);
   kbuilder.add(ResourceFactory.newClassPathResource(assignment.dslr),
ResourceType.DSLR);

but when i start a process instance and the token arrive at a
humantask,the assignment rule couldn't be firing.
who can tell me how can i do it?
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Optimizing the size of a StatefulKnowledgeSession object.

2010-05-19 Thread Johannes Meier

Dear Drools' developers and users,

I have a problem regarding the size of my Drools' StatefulKnowledgeSession. 
As I'm working with a 'stateful' session that lives on a web server I have
bound this session onto my web session. That means the Drools' session is
able to access some facts from preceding calls. The Drools' session lives as
long as the web session lives.

So far so good. Now I've started to mesure the size of the
StatefulKnowledgeSession by usage of heap dumps and some profiling tools.
This yielded a size of approximately 5 MB.

Is there any approach to optimize the size of a StatefulKnowledgeSession?
Apparently this object has a lot of overhead (from my point of view)
regarding the Drools Flow and Gouvenor frameworks because I'm not utilizing
this frameworks at all (just Drools Expert). Maybe this is an approach to
optimize the session's size?

If I accept this size, is there a convenient way to serialize the
StatefulKnowledgeSession between calls? I'm thinking about storing the whole
StatefulKnowledgeSession inside the database or maybe some datastructure
apart from the websession. Every call inside one web session would have to
lead to a deserialization, application and serialization of Drools' session. 

Thank you in advance for any reply.

Kind regards!
Johannes
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Optimizing-the-size-of-a-StatefulKnowledgeSession-object-tp828728p828728.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


Re: [rules-users] Optimizing the size of a StatefulKnowledgeSessionobject.

2010-05-19 Thread Johannes Meier

Dear Thomas,

Sorry, I forgot to mention that 5 MB is the 'initial' size. There are just
the rules and some data inside the session. From this starting point on the
session doesn't become dramatically bigger. 

Yes, I'm retracting the most of the facts at points where I'm certain that
these facts aren't relevant any more. But the facts aren't a problem. It is
the size of the session with all the rules loaded.


Kind regards,
Johannes
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Optimizing-the-size-of-a-StatefulKnowledgeSession-object-tp828728p828747.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] Dynamic generated list

2010-05-19 Thread Giovanni Motta
I would like to generate a template that can output rules, as explained in
Drools expert user guide at chapter 5.2 (
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html_single/index.html#d0e6212
).
My parameters are 2 lists of strings. In some case the list is to be
outputted as a multi restriction, and that is no problem.
But, from one of this lists, i need also to generate a collection of strings
to then reason over.
As an example, suppose the list1 contains 3 productIds, A,B,C, and the
list2 contains X and Y.
In the generated rule, i need to check, for example, that:

   - if a product with id 'X' or 'Y' exists (this part is easy),

and

   - a tuple composed of products from the other list(one A, one B, one
   C) that individually satisfy some condition exists (this is tough for me)

then i will execute my code.

I think the generated rule should be something like:

when
$target: Product (id in (X,Y))
$list: ArrayList() from   #arrayList should contain the parameter
values A,B,C
forall ( $id: String() from $list
 Product (id == $id, here some condition...)
)
then
   .

The difficult part is to generate the ArrayList dynamically, i don't know
how to accomplish that...
Any ideas? Is there a better approach than templates, to generate a rule
like this?
Do you have a suggestion on how the rule could be rewritten to avoid the use
of the ArrayList?
Thank you in advance
Giovanni
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Event expiration doubt

2010-05-19 Thread Makewise - Vitor Rui Mendonça
Hi!

 

I've detected some problems in my rules regarding event expiration but I can't 
understand why. Maybe someone with more experience could help me out.

 

I think the example is quite simple: the application receives transactions. The 
lack of transactions for an hour should raise an alarm. If there's a 
transaction when the alarm is on, then the application should rearm, clear the 
alarm state and check for lack of transactions.

 

The rules:

package com.company.application;

 

import com.company.application.Notifier;

import com.company.application.Notification;

import com.company.application.Transaction;

 

dialect java

 

# event which represents an alarm state

declare NoTransactions

  @role( event )

  dummy1: long

end

 

# event which represents the start of drools engine

declare EngineStarted

  @role( event )

  dummy2 : long

end

 

# event which represents the need to check for absence of transactions for the 
first hour

declare CheckFirstTransaction

  @role( event )

  @expire( 1h )

  dummy3: long

end

 

# event which represents a Transaction

declare Transaction

  @role( event )

  @expires( 1h )

end

 

# Notification System

global Notifier notifier;

 

 

rule ***start***

when

  not( EngineStarted() )

then

  insert( new EngineStarted() );

  insert( new CheckFirstTransaction() );

end

 

 

rule ***notrx_after_start***

when

  $engineStarted : EngineStarted()

  $checkFirstTransaction : CheckFirstTransaction() 

  not( NoTransactions() )

  not( Transaction( this after[0s,1h] $engineStarted ) from entry-point 
incoming ) 

then

  insert ( new NoTransactions() );

  retract( $checkFirstTransaction );

  notifier.send( new Notification( ALARM ) );

end

 

 

rule ***notrx_after_trx***

when

  EngineStarted()

  not( NoTransactions() )

  $transaction: Transaction() from entry-point incoming

  not( Transaction( this != $transaction, this after [0s,1h] $transaction ) 
from entry-point incoming ) 

then

  insert( new NoTransactions());

  notifier.send( new Notification( ALARM ) );

end

 

 

rule ***rearm***

when

  EngineStarted()

  $noTransactions : NoTransactions()

  $transaction: Transaction( this after $noTransactions ) from entry-point 
incoming

then

  retract( $noTransactions );

  notifier.send( new Notification( REARM ) );

end

 

 

The unit test:

kSession.fireAllRules(); // needed to detect lack of transactions in the first 
hour

 

/* here, ***start*** rule fires = EngineStarted and 
CheckFirstTransaction inserted */

 

clock.advanceTime( 1, TimeUnit.HOURS );

 

/* here, ***notrx_after_start*** rule fires = NoTransactions inserted, 
CheckFirstTransaction retracted */

 

clock.advanceTime(10, TimeUnit.MINUTES );

 

entryPoint.insert( new Transaction() );

 

/* before inserting Transaction into EntryPoint, NoTransactions is 
retracted */

 

kSession.fireAllRules();

 

 

The problem:

After inserting the last transaction, automatically the NoTransactions event is 
retracted. Debugging inside drools-core project, I've discovered that the event 
was retracted because expiration (WorkingMemoryReteExpireAction on 
actionQueue). 

I've also found some more explain how expiration events works, by Edison 
(http://drools-java-rules-engine.46999.n3.nabble.com/Events-are-not-automatically-expiring-from-working-memory-td61127.html).
 That shed some light on *when* the event is retracted but I don't understand 
*why* it's retracted.

 

 

Thanks In Advance!

 

 

Vítor Mendonça Moreira
Analista / Programador
Direcção de Investigação e Desenvolvimento

Rua Dr. Francisco Sá Carneiro, nº. 4 r/c esq.
2500 - 206 - Caldas da Rainha
Tel: (+351) 262 832 196
Fax: (+351) 262 186 455
Web: www.makewise.pt http://www.makewise.pt 
Uma empresa: Grupo Sousa Pedro http://www.sousapedro.com  

 



 

 

image001.jpgimage002.jpg___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] use rule assign actor

2010-05-19 Thread Esteban Aliverti
A good start could be to give us more info, like your rules, your flow and
how are you executing them. ;)

Best,

On Wed, May 19, 2010 at 6:39 AM, HONG DENG denghongs...@gmail.com wrote:

 hi , i am a drools flow newbie.I want to  using assignment rule
 assign a actor to a HumanTask. I have write a dsl and dslr files and
 following code :

   kbuilder.add(ResourceFactory.newClassPathResource(HelloWorldSample.rf),
 ResourceType.DRF);
   kbuilder.add(ResourceFactory.newClassPathResource(assignment.dsl),
 ResourceType.DSL);
   kbuilder.add(ResourceFactory.newClassPathResource(assignment.dslr),
 ResourceType.DSLR);

 but when i start a process instance and the token arrive at a
 humantask,the assignment rule couldn't be firing.
 who can tell me how can i do it?
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 


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


[rules-users] Drools 5.1 Persistence without JTA

2010-05-19 Thread KiranP

I dont want to use the JTA transactions for process 
can this be done if yes please point me towards it
thanks

-
Keep Working 
KiranP
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-1-Persistence-without-JTA-tp828933p828933.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


Re: [rules-users] Using Drools as a glorified Hashmap

2010-05-19 Thread djb

Hi John, Wolfgang,

Thanks for your suggestions.  Though I didn't use either of your suggestions
as described, it helped me work it out.  I added tokens describing the
prescriptions, then as they are matched (using RETE), the tokens are
retracted. Then any tokens left over are invalid.  It is probably as fast as
a HashMap.  I don't think John's solution would have worked, because no
single rule can determine whether a prescription is invalid.

Regards,
Daniel
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Using-Drools-as-a-glorified-Hashmap-tp825851p829059.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


Re: [rules-users] Deployment ear with drools support

2010-05-19 Thread Mauricio Salatino
basically you are including a jar file that contains a orm.xml file that
contains a lot of named queries and also a persistence.xml file that defines
org.drools.task. That is causing you problems.

2010/5/19 Pedro Maria Buitrago Mantilla pmbt...@gmail.com


 Greatings,

 Features:

 1. jboss 4.2.1
 2. jvm jdk1.5.0_13
 3. drools 5.0.1

 I deployed a EAR application over jboss, this application uses drools
 support for work flow activities, without particular persistence definitions
 , but I have the next error:

 --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
 ObjectName:
 persistence.units:ear=DroolsSupport-Ear.ear,unitName=org.drools.task
   State: FAILED
   Reason: java.lang.RuntimeException: You have not defined a
 jta-data-source for a JTA enabled persistence context named: org.drools.task

 ObjectName:
 persistence.units:ear=DroolsSupport-Ear.ear,jar=DroolsSupportEjb.jar,unitName=DroolsSupportJPA
   State: FAILED
   Reason: javax.persistence.PersistenceException:
 org.hibernate.HibernateException: Errors in named queries:
 TasksAssignedAsBusinessAdministrator, TasksAssignedAsTaskInitiator,
 TasksAssignedAsExcludedOwner, TasksAssignedAsRecipient,
 TasksAssignedAsPotentialOwner, TasksAssignedAsPotentialOwnerWithGroup,
 SubTasksAssignedAsPotentialOwner, TasksOwned,
 TasksAssignedAsPotentialOwnerByGroup, GetSubTasksByParentTaskId,
 TasksAssignedAsTaskStakeholder, UnescalatedDeadlines
   I Depend On:
 jboss.jca:service=DataSourceBinding,name=DroolsDatasource
   Depends On Me:

 jboss.j2ee:ear=DroolsSupport-Ear.ear,jar=DroolsSupportEjb.jar,name=WorkFlowResultServices,service=EJB


 DroolsSupportJPA is a persistence unit independient of drools

 But I don't use anything for drools persistence, What happend?


 PEDRO MARIA BUITRAGO MANTILLA
 Bogotá, Colombia


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




-- 
- http://salaboy.wordpress.com
- http://www.jbug.com.ar
- Salatino Salaboy Mauricio -
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Dynamic generated list

2010-05-19 Thread Giovanni Motta
Looking at:
http://mvel.codehaus.org/Inline+List,+Maps+and+Arrays

I see MVEL supports inline of lists, but unfortunately, this syntax seems
not to be supported by 'from' construct.
From drools expert documentation @ 4.8.2.8 Conditional Element from i read:

The expression used to define the object source is any expression that
follows regular MVEL syntax.
I tried Edson Tirelli suggestion reported in:
http://drools-java-rules-engine.46999.n3.nabble.com/Welcome-to-the-rules-users-mailing-list-td325731.html#none
I realized by testing that the suggestion works for a memberOf construct,
but not in a from clause.
Is this expected behaviour or is this a bug/unsupported feature?
Thank you in advance.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Dynamic generated list

2010-05-19 Thread djb

You can't do any sort of constructor calls in the condition section.  
i'm not sure if you're asking what goes in the  spot, but, 
$list: ArrayList() from collect(Product(id == @{id}, ...conditions...))
perhaps?
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Dynamic-generated-list-tp828787p829220.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


Re: [rules-users] Dynamic generated list

2010-05-19 Thread Giovanni Motta
Thank you for the response djb.
Doing what you say, i will collect ALL instances of products with id
'A','B','C', instead i need a tuple of exactly one 'A', one 'B' and one 'C'.
In my scenario, products may occur multiple times (that i forgot to say, my
fault...).
I investigated a bit and posted a response myself, probably found a bug or
missing implementation.
Kind regards
2010/5/19 djb dbrownel...@hotmail.com


 You can't do any sort of constructor calls in the condition section.
 i'm not sure if you're asking what goes in the  spot, but,
 $list: ArrayList() from collect(Product(id == @{id}, ...conditions...))
 perhaps?
 --
 View this message in context:
 http://drools-java-rules-engine.46999.n3.nabble.com/Dynamic-generated-list-tp828787p829220.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Using Drools as a glorified Hashmap

2010-05-19 Thread John Peterson
Hey Daniel,

My suggestion was that a single default rule could be fired to indicate
that the prescription was invalid if all the matching rules failed to
create a valid match.  

Example:
- Match Rule 1, Salience 50, Activation-group Match Rules
- Match Rule 2, Salience 50, Activation-group Match Rules
- Match Rule 3, Salience 50, Activation-group Match Rules
- Match Rule 4, Salience 50, Activation-group Match Rules
- Match Rule 5, Salience 50, Activation-group Match Rules
- Match Rule 6, Salience 50, Activation-group Match Rules
- Match Rule 7, Salience 50, Activation-group Match Rules
- Match Rule 8, Salience 50, Activation-group Match Rules
- Match Rule 9, Salience 50, Activation-group Match Rules
- No Match Rule 1, Salience 0, Activation-group Match Rules

Activation-group allows only one rule to fire from all the rules sharing
that activation-group.  By putting a positive salience (priority) on all
the match rules, if any one of them matches, that's all that can fire
per the activation-group.  However, if the No Match rule is fired, that
means that the prescription was not matched by any of the match rules.
It is a default.  The rule can be as simple as:

Rule No Match
salience 0
activation-group Match Rules
When
  Eval(true) // Always true
Then
  Do your no match logic
End

The activation-group is doing your heavy lifting, so to speak

jp



Message: 3
Date: Wed, 19 May 2010 06:20:39 -0700 (PDT)
From: djb dbrownel...@hotmail.com
Subject: Re: [rules-users] Using Drools as a glorified Hashmap
To: rules-users@lists.jboss.org
Message-ID: 1274275239719-829059.p...@n3.nabble.com
Content-Type: text/plain; charset=us-ascii


Hi John, Wolfgang,

Thanks for your suggestions.  Though I didn't use either of your
suggestions
as described, it helped me work it out.  I added tokens describing the
prescriptions, then as they are matched (using RETE), the tokens are
retracted. Then any tokens left over are invalid.  It is probably as
fast as
a HashMap.  I don't think John's solution would have worked, because no
single rule can determine whether a prescription is invalid.

Regards,
Daniel
-- 
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Using-Drools-as-a-gl
orified-Hashmap-tp825851p829059.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


Re: [rules-users] Drools 5.1 Persistence without JTA

2010-05-19 Thread Pablo Nussembaum
Hi Kiram,
We are currently working, through the spring integration, on adding
support for using processes without JTA. The only pending feature is the
automatic rollback handling that JTA provides, that means that you
*MUST* reload the session instance after a rollback.

Here you have an example app:
http://www.plugtree.com/downloads/DroolsFlowSpring.tgz

-- 
Baunax


On Wednesday 19,May,2010 09:22 AM, KiranP wrote:
 I dont want to use the JTA transactions for process 
 can this be done if yes please point me towards it
 thanks

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


Re: [rules-users] Drools 5.1 Persistence without JTA

2010-05-19 Thread Mark Proctor
On 19/05/2010 16:13, Pablo Nussembaum wrote:
 Hi Kiram,
 We are currently working, through the spring integration, on adding
 support for using processes without JTA. The only pending feature is the
 automatic rollback handling that JTA provides, that means that you
 *MUST* reload the session instance after a rollback.

I'm now wondering if automic rollback was such as good idea; I'm just 
not sure of a good way to ensure integrity between the rules and the 
process interactions if the current workingmemory becomes invalid. for 
processes it just loads the process on demand anyway, so automatic 
rollback isn't needed, for rules it's a little more complicated.

Mark
 Here you have an example app:
 http://www.plugtree.com/downloads/DroolsFlowSpring.tgz




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


[rules-users] Changes made to knowledge bases and the time associated with it

2010-05-19 Thread Luiz Eduardo Guida Valmont
Hi all,

I'm working on an application that has to maintain a knowledge base that'll
change (a lot) over time; meaning some rules might change, others will be
added and, finally, some will be deleted from the KB. Our tests show the
following un-expected (imho *) behaviors:

   - Whenever the contents of the KB change, all rules associated with it
   are re-compiled.It doesn't matter whether one rule or all of them were
   changed.
   - If the time taken to re-compile all rules is greater than the frequency
   according to which resource change notification / scanner services poll the
   KB, then the KB will be re-compiled more than once. I can't measure how many
   extra compilations happen due to time constraints; it takes more than 10
   minutes for the application to compile all rules and something like 5
   minutes to recompile the smallest possible version of it.

So... my question is: is possible to fine tune this behavior so that drools
won't recompile everything from scratch? More than that, I'd like to have it
wait for itself to finish any compilation that might happening at the time.
Is it possible?

My approach to using drools is the following: create a KnowledgeAgent, then
have it apply a change set that points to a directory that contains DRL
files. And this has to be done for five different KA's. I suppose this is
the correct approach.

Thanks in advance for any feedback that you might have.

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


Re: [rules-users] Changes made to knowledge bases and the time associated with it

2010-05-19 Thread Esteban Aliverti
I was working in KnowledgeAgent incremental change-set processing. Right
now, the agent only adds to the kbase those rules that were modified. The
bad news are that in order to know if a rule was modified or not, the agent
must compile the resource.

Here you can find more info:
http://ilesteban.wordpress.com/2010/03/25/knowledge-agent-incremental-change-set-processing-and-binary-diff/

http://ilesteban.wordpress.com/2010/03/25/knowledge-agent-incremental-change-set-processing-and-binary-diff/I'm
planning to post a more detailed explanation of what happens inside the
kagent when processing change-sets.

Best,

2010/5/19 Luiz Eduardo Guida Valmont legvalm...@gmail.com

 Hi all,

 I'm working on an application that has to maintain a knowledge base that'll
 change (a lot) over time; meaning some rules might change, others will be
 added and, finally, some will be deleted from the KB. Our tests show the
 following un-expected (imho *) behaviors:

- Whenever the contents of the KB change, all rules associated with it
are re-compiled.It doesn't matter whether one rule or all of them were
changed.
- If the time taken to re-compile all rules is greater than the
frequency according to which resource change notification / scanner 
 services
poll the KB, then the KB will be re-compiled more than once. I can't 
 measure
how many extra compilations happen due to time constraints; it takes more
than 10 minutes for the application to compile all rules and something like
5 minutes to recompile the smallest possible version of it.

 So... my question is: is possible to fine tune this behavior so that drools
 won't recompile everything from scratch? More than that, I'd like to have it
 wait for itself to finish any compilation that might happening at the time.
 Is it possible?

 My approach to using drools is the following: create a KnowledgeAgent, then
 have it apply a change set that points to a directory that contains DRL
 files. And this has to be done for five different KA's. I suppose this is
 the correct approach.

 Thanks in advance for any feedback that you might have.

 Regards,
 Luiz Eduardo

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




-- 


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


[rules-users] Java Enums in Guvnor

2010-05-19 Thread Ian-D.Jones
Hi All,
 
I've recently started using Drools and Guvnor, and so far really like
it!
 
I have one problem however, to do with Java enums in Guvnor. 
 
I have a simple enum as follows:
public enum STPRuleAction
{
UNKNOWN, ACCEPT, REJECT
}

I can hand write a rule that works fine with this enum as follows:
rule Retract rejected
dialect mvel
when
 o : CtasOrder( stpRuleAction == STPRuleAction.REJECT )
then
 o.setStatus( 1 );
retract( o );
end

However, if I create a rule with Guvnor, it always puts quotes around
the condition, so seems to treat it as a string and it is never
triggered. I have created a Guvnor enumeration as follows:
 
'CtasOrder.stpRuleAction' : ['STPRuleAction.UNKNOWN=UNKNOWN',
'STPRuleAction.ACCEPT=ACCEPT', 'STPRuleAction.REJECT=REJECT']
 
Which gives me the correct drop down values in the Business Rule editor,
but the source of the rule looks like:
rule Retract rejected
dialect mvel
when
 o : CtasOrder( stpRuleAction == STPRuleAction.REJECT)
then
 o.setStatus( 1 );
retract( o );
end

I've tried without the mapping in the enumeration (e.g ... :
['STPRuleAction.UNKNOWN', ...) and even removing the enumeration and
adding the text manually as a literal value. I can't see any way to
specfy a enum/qualifiedIdentifier as a condition in Guvnor. It works
fine as a consequence and produces a rule without quotes around (e.g.
o.setStpRuleAction( STPRuleAction.REJECT )...)
 
Many thanks for any assistance you can give.
Regards,
Ian
Visit our website at http://www.ubs.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mails are not encrypted and cannot be guaranteed to be secure or 
error-free as information could be intercepted, corrupted, lost, 
destroyed, arrive late or incomplete, or contain viruses.  The sender 
therefore does not accept liability for any errors or omissions in the 
contents of this message which arise as a result of e-mail transmission.  
If verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities 
or related financial instruments.

UBS Limited is a company registered in England  Wales under company
number 2035362, whose registered office is at 1 Finsbury Avenue,
London, EC2M 2PP, United Kingdom.

UBS AG (London Branch) is registered as a branch of a foreign company
under number BR004507, whose registered office is at
1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.

UBS Clearing and Execution Services Limited is a company registered
in England  Wales under company number 03123037, whose registered
office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
 
UBS reserves the right to retain all messages. Messages are protected
and accessed only in legally justified cases.___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Configuration file problem in Glassfish

2010-05-19 Thread Zack Pederson

I've run into a problem with the 5.0 version of drools and it's interaction
with the Glassfish app server. When the drools engine is initializing it
looks for the drools.rulebase.conf file in the user.home directory. In my
company's app server environments, the applications are not allowed to write
to or read from the user.home directory so it throws an
AccessControlException saying access is denied and the application will not
start up. Is there any way to tell drools not too look for this file short
of downloading the source, modifying it and creating my own jars? I've
tracked the offending code down to the ChainedProperties class in the
drools-core jar so I know what to change if it comes down to that.

Thanks in advance.

Zack
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Configuration-file-problem-in-Glassfish-tp829814p829814.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


Re: [rules-users] Java Enums in Guvnor

2010-05-19 Thread Ansgar Konermann

Hi Ian,

I tried using Enums with Guvnor twice: once back in the 4.0 times of 
Drools, once again when we got the 5.0 update.


My experience: Java enums and Guvnor simply don't work together. Stick 
with writing DRL rule files in a text editor, or even better, using the 
Eclipse plugin. This way, enums work somehow (still no code completion 
for enum values, even when using the Eclipse plugin). If for some reason 
you must use guvnor, you'll probably need to convert your beans 
properties now holding Java enums into properties of type String and use 
string constants to define the allowed value range.


Guvnor experts: I'd be very happy to be proven wrong by someone of you. 
Some kind of HOWTO use Java Enums in Guvnor correctly blog post etc. 
very much appreciated ;-)


Best regards

Ansgar


On 19.05.2010 18:36, ian-d.jo...@ubs.com wrote:


Hi All,
I've recently started using Drools and Guvnor, and so far really like it!
I have one problem however, to do with Java enums in Guvnor.
I have a simple enum as follows:
**

*public* *enum* STPRuleAction
{
/ UNKNOWN/, /ACCEPT/, /REJECT//
/}

I can hand write a rule that works fine with this enum as follows:
**

*rule* Retract rejected
* dialect* mvel
* when
* o : CtasOrder( stpRuleAction == STPRuleAction.REJECT )
* then
* o.setStatus( 1 );
* retract*( o );
*end*

However, if I create a rule with Guvnor, it always puts quotes around 
the condition, so seems to treat it as a string and it is never 
triggered. I have created a Guvnor enumeration as follows:
'CtasOrder.stpRuleAction' : ['STPRuleAction.UNKNOWN=UNKNOWN', 
'STPRuleAction.ACCEPT=ACCEPT', 'STPRuleAction.REJECT=REJECT']
Which gives me the correct drop down values in the Business Rule 
editor, but the source of the rule looks like:


*rule* Retract rejected
* dialect* mvel
* when
* o : CtasOrder( stpRuleAction == *STPRuleAction.REJECT*)
* then
* o.setStatus( 1 );
* retract*( o );
*end*

I've tried without the mapping in the enumeration (e.g ... : 
['STPRuleAction.UNKNOWN', ...) and even removing the enumeration and 
adding the text manually as a literal value. I can't see any way to 
specfy a enum/qualifiedIdentifier as a condition in Guvnor. It works 
fine as a consequence and produces a rule without quotes around (e.g. 
o.setStpRuleAction( STPRuleAction.REJECT )...)

Many thanks for any assistance you can give.
Regards,
Ian


___
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 5.1 Persistence without JTA

2010-05-19 Thread tolitius

yea, for the process ( flow ) it seems to work fine using a regular
org.springframework.orm.jpa.JpaTransactionManager:

bean id=abstractKnowledgeProvider
 
class=org.drools.container.spring.beans.persistence.JPAKnowledgeServiceBean
  abstract=true

  property name=entityManagerFactory ref=entityManagerFactory 
/
  property name=transactionManager ref=txManager /
  property name=variablePersisters
util:map
entry key=javax.persistence.Entity

value=org.drools.persistence.processinstance.persisters.JPAVariablePersister
/
entry key=java.lang.String

value=com.jpmc.tss.admincenter.framework.workflow.drools.variablepersistence.StringVariablePersister
/
entry key=java.io.Serializable

value=org.drools.persistence.processinstance.persisters.SerializableVariablePersister
/
/util:map
   /property
/bean

bean id=txManager
class=org.springframework.orm.jpa.JpaTransactionManager
property name=entityManagerFactory 
ref=entityManagerFactory /
/bean

bean id=entityManagerFactory

class=org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
property name=persistenceUnitName 
value=your.persistence.unit /
property name=dataSource ref=datasource /
property name=jpaProperties
props
prop
key=hibernate.connection.autocommit${hibernate.connection.autocommit}/prop
prop
key=hibernate.max_fetch_depth${hibernate.max_fetch_depth}/prop
prop key=hibernate.show_sql${hibernate.show_sql}/prop
prop key=hibernate.dialect${hibernate.dialect}/prop
prop
key=hibernate.hbm2ddl.auto${hibernate.hbm2ddl.auto}/prop
/props
/property
/bean

bean
class=org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
/
bean
class=org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor/

drools:connection id=connection1 type=local /
drools:execution-node id=node1 connection=connection1 /


/Anatoly

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-1-Persistence-without-JTA-tp828933p829922.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


Re: [rules-users] skip workflow's task from NodeInstance

2010-05-19 Thread dgimenes

salaboy,

I'm need to do a web page that shows the flow and allows a superuser to
start/stop the flow, as well as skip and interact with the active nodes.
This need to be available for each flow instantiated.

So what I managed (with help) to list all flows instantiated as well as it's
nodes waiting to be completed, but I need some way to show the other tasks
and approve (complete) them just by having it NodeInstance (or maybe
approach on a different way... any ideas).

best regards,
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/skip-workflow-s-task-from-NodeInstance-tp787552p830058.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] BPMN2 Timer Cycle

2010-05-19 Thread tolitius

Per BPMN2 specification: 

  The timer has a specific time-date or a specific cycle (e.g.,
every Monday at 9am) that can be set, so if the cycle is every day at 9
a.m.

  BPMN2 was a recommended way to go, since DRF is going to become
obsolete soon.

  Is this timer feature currently supported by Drools? I can see it
in XSD:

xsd:element name=timerEventDefinition type=tTimerEventDefinition
substitutionGroup=eventDefinition/
xsd:complexType name=tTimerEventDefinition
xsd:complexContent
xsd:extension base=tEventDefinition
xsd:choice
xsd:element name=timeDate type=tExpression 
minOccurs=0
maxOccurs=1/
xsd:element name=timeCycle 
type=tExpression minOccurs=0
maxOccurs=1/
/xsd:choice
/xsd:extension
/xsd:complexContent
/xsd:complexType

But not in Eclipse IDE properties.

/Anatoly
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/BPMN2-Timer-Cycle-tp830158p830158.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] BPMN2 Timers : Dynamic Delay / Cycle

2010-05-19 Thread tolitius

Similar to calling a subprocess dynamically:

   processId=com.sample.#{var}

Can Timer Values such as timeDate and timeCycle can be configured at
runtime?

Thank you,
/Anatoly

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/BPMN2-Timers-Dynamic-Delay-Cycle-tp830169p830169.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


Re: [rules-users] Wrong flow script task executes when multiple flows are loaded

2010-05-19 Thread H.C.

This issue seems to be remedied by placing each flow in its own package. I
still don't know if this is a bug or a feature.
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Wrong-flow-script-task-executes-when-multiple-flows-are-loaded-tp826751p830193.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] Drools with Guvnor

2010-05-19 Thread bbarani

Hi,

I am very new to Drools and very very new to Guvnor.

I am in the process of creating a rule engine which will fetch the data from
a source (I am using Hibernate framework to fetch the data) and evaluate the
data using Drools rule engine. The rules supplied to the Drools rule engine
are stored in a Rules table in a database.

Now my question is that can I use Guvnor to store the rules (instead of me
creating a rule data model) and use Guvnor to supply rules to my Drools
engine?

I am trying to find out the best possible way to create / manage a rule
database (which stores all the rules).

Thanks,
BB
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-with-Guvnor-tp830453p830453.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


Re: [rules-users] Drools with Guvnor

2010-05-19 Thread Michael Rhoden
Yes and no . Guvnor uses a JCR repository (the default is 
http://jackrabbit.apache.org/) which can not be accessed using hibernate 
directly. We ran into this issue, and the only way to use guvnor as of 6 months 
ago was to have a user go into guvnor and create a DRL file by clicking a few 
buttons. Not a big deal, but it isn't automated. You can then use that DRL as a 
resource in your application. I know there was some working being done to be 
able to pull out DRLs from Guvnor using xml calls, but don't know if that was 
ever completed. 

Michael Rhoden 


- Original Message - 
From: bbarani bbar...@gmail.com 
To: rules-users@lists.jboss.org 
Sent: Wednesday, May 19, 2010 5:12:57 PM 
Subject: [rules-users] Drools with Guvnor 


Hi, 

I am very new to Drools and very very new to Guvnor. 

I am in the process of creating a rule engine which will fetch the data from 
a source (I am using Hibernate framework to fetch the data) and evaluate the 
data using Drools rule engine. The rules supplied to the Drools rule engine 
are stored in a Rules table in a database. 

Now my question is that can I use Guvnor to store the rules (instead of me 
creating a rule data model) and use Guvnor to supply rules to my Drools 
engine? 

I am trying to find out the best possible way to create / manage a rule 
database (which stores all the rules). 

Thanks, 
BB 
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-with-Guvnor-tp830453p830453.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] use rule assign actor

2010-05-19 Thread HONG DENG
*I paste all information here :

HelloWorldSample.rf * :

?xml version=1.0 encoding=UTF-8?
process xmlns=http://drools.org/drools-5.0/process;
xmlns:xs=http://www.w3.org/2001/XMLSchema-instance;

xs:schemaLocation=http://drools.org/drools-5.0/processdrools-processes-5.0.xsd;
type=RuleFlow name=flow id=com.sample.evaluation
package-name=org.drools.bpmn2 

 header
 /header

 nodes
   start id=1 name=Start x=44 y=139 width=48 height=48 /
   humanTask id=2 name=thefirstone x=156 y=140 width=80
height=40 
 work name=Human Task 
   parameter name=ActorId 
 type
name=org.drools.process.core.datatype.impl.type.StringDataType /
 value/value
   /parameter
   parameter name=Comment 
 type
name=org.drools.process.core.datatype.impl.type.StringDataType /
 valueYou need to perform a self-evaluation/value
   /parameter
   parameter name=Content 
 type
name=org.drools.process.core.datatype.impl.type.StringDataType /
   /parameter
   parameter name=Priority 
 type
name=org.drools.process.core.datatype.impl.type.StringDataType /
   /parameter
   parameter name=Skippable 
 type
name=org.drools.process.core.datatype.impl.type.StringDataType /
 valuefalse/value
   /parameter
   parameter name=TaskName 
 type
name=org.drools.process.core.datatype.impl.type.StringDataType /
 valuefirstHumanTask/value
   /parameter
 /work
   /humanTask
   end id=3 name=End x=290 y=140 width=80 height=40 /
 /nodes

 connections
   connection from=1 to=2 /
   connection from=2 to=3 /
 /connections

/process

*assignment.dslr:*
package org.drools.examples.process.order

import org.drools.process.instance.impl.WorkItemImpl
import org.drools.workflow.instance.node.WorkItemNodeInstance

expander assignment.dsl

/** Generic assignment rules **/

rule Assign actor salience 30
when
There is a human task
then
Set actor id mary
end


*assignment.dsl:*
***
[condition][HumanTaskWorkItem]- with actor id
{actorId}=parameters['ActorId'] == {actorId}
[condition][HumanTaskWorkItem]- without actor id=parameters['ActorId'] ==
null
[condition][HumanTaskWorkItem]- with task name
{taskName}=parameters['TaskName'] == {taskName}
[condition][HumanTaskWorkItem]There is a human task=workItemNodeInstance:
WorkItemNodeInstance( ) workItem: WorkItemImpl( name == Human Task ) from
workItemNodeInstance.workItem
[consequence][]Set actor id {actorId}=workItem.setParameter(ActorId,
{actorId}); update(workItemNodeInstance);
[condition][HumanTaskWorkItem]- with priority
{priority}=parameters['Priority'] == {priority}
[condition][HumanTaskWorkItem]Process {processId} contains a human
task=workItemNodeInstance: WorkItemNodeInstance( processInstance.processId
== {processId} ) workItem: WorkItemImpl( name == Human Task ) from
workItemNodeInstance.workItem
*

*and have following code to start a process instance:*
*
package com.sample;
/**
 * This is a sample file to launch a process.
 */
public class ProcessTest {

public static final void main(String[] args) {
try {
//start humantask component
startHumanTaskComponent();
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger =
KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, test);
ksession.getWorkItemManager().registerWorkItemHandler(Human Task, new
WSHumanTaskHandler());
// start a new process instance
MapString, Object params = new HashMapString, Object();
params.put(employee, Administrator);
ksession.startProcess(com.sample.evaluation, params);
} catch (Throwable t) {
t.printStackTrace();
}
}

private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilderConfiguration conf =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
//  ((PackageBuilderConfiguration) conf).initSemanticModules();
//  ((PackageBuilderConfiguration)
conf).loadSemanticModule(BPMN2SemanticModule.conf);
  KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(conf);
//  kbuilder.add(ResourceFactory.newClassPathResource(hellowWorld.bpmn),
ResourceType.DRF);
  kbuilder.add(ResourceFactory.newClassPathResource(HelloWorldSample.rf),
ResourceType.DRF);
  kbuilder.add(ResourceFactory.newClassPathResource(assignment.dsl),
ResourceType.DSL);
  kbuilder.add(ResourceFactory.newClassPathResource(assignment.dslr),
ResourceType.DSLR);
  KnowledgeBuilderErrors errors = kbuilder.getErrors();
  if (errors.size()  0) {
for (KnowledgeBuilderError error: errors) {
  System.err.println(error);
}
throw new IllegalArgumentException(Could not parse knowledge.);
  }
  KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
  kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
  return kbase;
}
 private static void startHumanTaskComponent(){
EntityManagerFactory emf =

Re: [rules-users] Drools 5.1 Persistence without JTA

2010-05-19 Thread KiranP

initially thanks for ur replies.

i downloaded the sample given Pablo Nussembaum but having problem
drools-spring dependency saying missing artifact...tried manually browsing
also but no good cant find it.

to tolitius,
thanks for that code snippet.what i tried was the same just i didnt had
the drools tags if u can just pass the whole test case ( i am a newbie to
this Drools-Spring integration thing so i need to find it out how it goes)  
the problem with mine was the table were getting created by the annotations
but when trying to start process it gives exception saying could not commit
session in SingleSessionCommandService.java file which actually calls the
new InitialContext().lookup(java:UserTransaction) which actually fails

thanks and regards

-
Keep Working 
KiranP
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-1-Persistence-without-JTA-tp828933p830964.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