Re: [rules-users] Resuming the Flow: SESSION_ID, PROCESS_INSTANCE_ID, WORKITEM_ID

2010-03-25 Thread tolitius

Hi Kiran,

   I usually don't post before doing "homework". Unfortunately Drools Flow
documentation is too high-level in order to actually understand how it all
comes together without looking at the source code...

   WorkflowService {
...
 resumeFlow ( someBusinessId ) {
 
  // NO SESSION_ID given
  // NO PROCESS_INSTANCE_ID given
  // NO WORKITEM_ID given (or "ExecuteWorkItem" parameter
for that matter)
 
 }
...
   }

Again:
 
   1.  How these three relate to each other?

examples of the answers: [ session has many processes, process has
many workitems ], [session is singleton for the knowledge base given, and
has many processes, which have many workitems], etc..

   2. How do I find these IDs in the sample method above?

   3. I understand "workitemId" can resume the flow, but do I need session
and process IDs to get to that work item?

   4. Given that multiple workitems may be completed, how do I know, having
SESSION_ID and PROCESS_ID (which I hopefully can get from the question "2")
which workitem to mark as complete?

Thank you,
/Anatoly


-- 
View this message in context: 
http://n3.nabble.com/Resuming-the-Flow-SESSION-ID-PROCESS-INSTANCE-ID-WORKITEM-ID-tp607507p629805.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] how to configure packages in Drools-Gunvor

2010-03-25 Thread srikar.jillela

 Hi,


I followed the same mentioned in the documentation that you have
suggested, but i have got strucked in the middle .i.e

   Before creating rules in the ,

1. i have created categories,created package .But when configuring the
package i dont know

which jar file i should upload ..Can you please suggest me this ...
   
 2.Can you please also let me know which version of eclipse i should use
.


  Thanks in advance

   Sreekar 
-- 
View this message in context: 
http://n3.nabble.com/Drools-Gunvor-tp470499p626854.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] Resuming the Flow: SESSION_ID, PROCESS_INSTANCE_ID, WORKITEM_ID

2010-03-25 Thread KiranP

hello tolitius,

  i know its a bit complicated here. but still you must have
sorted it out yourself the three things are as follows

when a process waits for some HumanTask or WorkItem 
WorkItem is available in ExceuteWorkItem parameter as 

workItem.getId();

form workItem itself u can also get processinstance id as

workItem.getProcessInstanceId();

and the sessionId is what i m keeping u as homework

feel free to ask more questions

regards



-
Keep Working >>:working:
KiranP
-- 
View this message in context: 
http://n3.nabble.com/Resuming-the-Flow-SESSION-ID-PROCESS-INSTANCE-ID-WORKITEM-ID-tp607507p617906.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] Resuming the Flow: SESSION_ID, PROCESS_INSTANCE_ID, WORKITEM_ID

2010-03-25 Thread tolitius

Hi Flow Crew,

This is about reloading the session and resuming the flow.

Let's say the flow reached one of its wait states, and was persisted.

Two days later an "assigned actor" does his/her duties, and the flow can
be resumed.

At this point, we need to call something, let's call it a
WorkflowService, that would have a resumeFlow( someBusinessId ) method that
will be called.

Here is where the question starts...

I understand there are three pieces in this puzzle: SESSION_ID,
PROCESS_INSTANCE_ID and WORKITEM_ID

I also understand that in order to resume the flow, I need to get a hold
of that certain work item that is ready to be completed, and let the flow
know it is completed.

But at the point, where I should resume the flow, I have no reference to
neither SESSION_ID, PROCESS_INSTANCE_ID or WORKFLOW_ID.

1.  How are these three related to each other?

2.  How do I find these three associated IDs?

2.  Which one(s) do I need to resume the flow?

3.  If I (somehow) get the reference to SESSION and PROCESS_INSTANCE
ids, how do I know which work item is ready to be completed?

Thank you,
/Anatoly
-- 
View this message in context: 
http://n3.nabble.com/Resuming-the-Flow-SESSION-ID-PROCESS-INSTANCE-ID-WORKITEM-ID-tp607507p607507.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] Can we works on fact of "dynamic Map" instead of POJO?

2010-03-25 Thread 王在祥
I have a requirement of run rules on dynamic map instead of POJO, for
example:

*when
Map(* TransCode == "LOGIN" , userName == "wangzx", password == "123456"
)
*then
doSth1()

when
   Map( *TransCode = "SaveOrder" userName == "wangzx" category == "Book")
*then
  doSth2()

*
the Fact is not a Java Bean, but a dynamic map, so the
TransCode == "Login" is what we means map("TransCode") == "Login".

By using map insteam of POJO, we can build a rules run on the message
dispatch, since there is a lot of Message Types, and each message type has
different schema, so using dynamic types is more flexible than POJO.

Can someone tell me how can it be supported in drools? Very thanks.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Flow Spring Integration

2010-03-25 Thread tolitius

really? nobody is using Drools Flow with Spring? Or nobody really knows the
answer?
-- 
View this message in context: 
http://n3.nabble.com/Drools-Flow-Spring-Integration-tp467383p594037.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] Sliding Windows - Error

2010-03-25 Thread Paul R.
Meant to say: using drools 5.0.1.

- Paul

On Fri, Mar 26, 2010 at 1:22 AM, Paul R.  wrote:

> Hi,
>
> I'm using an accumulate on a sliding window to count the number of events,
> which occur in a 30 second window;
> the events are inserted every 5 seconds - so with a 30 second window, I
> would expect 6 events to occur.
>
> The rule below never fires, though from the log output, it looks as though
> the condition has matched successfully?
>
> declare Foo
> @role ( event )
> @expires ( 60s )
> @timestamp ( date )
> end
>
> rule "Count Foo"
> when
> c : Number(intValue > 5) from accumulate
> $f : Foo()
> over window:time ( 30s )
> from entry-point ChannelDataStream,
> count($f))
> then
> System.out.println("Count [30s] = " + c);
> end
>
> OBJECT ASSERTED value:com.test.droolstest$...@c52200 factId: 1
> OBJECT ASSERTED value:com.test.droolstest$...@128edf2 factId: 3
> OBJECT ASSERTED value:com.test.droolstest$...@1dddba factId: 4
> OBJECT ASSERTED value:com.test.droolstest$...@c7e8a7 factId: 5
> OBJECT ASSERTED value:com.test.droolstest$...@7b4703 factId: 6
> ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0]
> declarations: c=6(2)
> OBJECT ASSERTED value:com.test.droolstest$...@1732ed2 factId: 7
> ACTIVATION CANCELLED rule:Count Foo activationId:Count Foo [2, 0]
> declarations: c=6(2)
> ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0]
> declarations: c=6(2)
> OBJECT ASSERTED value:com.test.droolstest$...@be76c7 factId: 8
> ACTIVATION CANCELLED rule:Count Foo activationId:Count Foo [2, 0]
> declarations: c=6(2)
> ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0]
> declarations: c=6(2)
>
>
> Can anybody explain why this is happening? I've attached a test case, which
> demonstrates the problem.
>
> Thanks in advance.
>
> - Paul
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Sliding Windows - Error

2010-03-25 Thread Paul R.
Hi,

I'm using an accumulate on a sliding window to count the number of events,
which occur in a 30 second window;
the events are inserted every 5 seconds - so with a 30 second window, I
would expect 6 events to occur.

The rule below never fires, though from the log output, it looks as though
the condition has matched successfully?

declare Foo
@role ( event )
@expires ( 60s )
@timestamp ( date )
end

rule "Count Foo"
when
c : Number(intValue > 5) from accumulate
$f : Foo()
over window:time ( 30s )
from entry-point ChannelDataStream,
count($f))
then
System.out.println("Count [30s] = " + c);
end

OBJECT ASSERTED value:com.test.droolstest$...@c52200 factId: 1
OBJECT ASSERTED value:com.test.droolstest$...@128edf2 factId: 3
OBJECT ASSERTED value:com.test.droolstest$...@1dddba factId: 4
OBJECT ASSERTED value:com.test.droolstest$...@c7e8a7 factId: 5
OBJECT ASSERTED value:com.test.droolstest$...@7b4703 factId: 6
ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0]
declarations: c=6(2)
OBJECT ASSERTED value:com.test.droolstest$...@1732ed2 factId: 7
ACTIVATION CANCELLED rule:Count Foo activationId:Count Foo [2, 0]
declarations: c=6(2)
ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0]
declarations: c=6(2)
OBJECT ASSERTED value:com.test.droolstest$...@be76c7 factId: 8
ACTIVATION CANCELLED rule:Count Foo activationId:Count Foo [2, 0]
declarations: c=6(2)
ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0]
declarations: c=6(2)


Can anybody explain why this is happening? I've attached a test case, which
demonstrates the problem.

Thanks in advance.

- Paul


DroolsTest.java
Description: Binary data
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Persitence configuration issue in Drools Flow 5.1.M1 (PersistenceException/AnnotationException)

2010-03-25 Thread Nol de Wit
I got a bit further on this: it appears that for 5.1 there are a couple of
extra mapped classes:

org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo
org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable

This got me much further, but no success yet: the tables are created in the
database, but apparently at the point some data is inserted an error occurs,
see below.
I've updated BTM to 1.3.3, but that didn't help.

Any ideas?
Thanks,
Nol

Mar 25, 2010 11:00:33 PM bitronix.tm.journal.DiskJournal open
WARNING: active log file is unclean, previous server crash ?
Mar 25, 2010 11:00:33 PM bitronix.tm.recovery.Recoverer run
INFO: recovery committed 0 dangling transaction(s) and rolled back 0 aborted
transaction(s) on 1 resource(s) [jdbc/processInstanceDS] (restricted to
serverId '192.168.178.32')
line 2:47 mismatched character '' expecting '\n'
Hibernate: insert into SessionInfo (dirty, lastModificationDate,
rulesByteArray, startDate) values (?, ?, ?, ?)
Mar 25, 2010 11:00:35 PM bitronix.tm.BitronixTransaction
fireAfterCompletionEvent
WARNING: Synchronization.afterCompletion() call failed for a
DeferredReleaseSynchronization of a JdbcPooledConnection from datasource
jdbc/processInstanceDS in state NOT_ACCESSIBLE wrapping
com.mysql.jdbc.jdbc2.optional.jdbc4mysqlxaconnect...@1d3c66d8
java.lang.IllegalArgumentException: null source
at java.util.EventObject.(EventObject.java:38)
at javax.sql.StatementEvent.(StatementEvent.java:39)
at
com.mysql.jdbc.jdbc2.optional.JDBC4PreparedStatementWrapper.close(JDBC4PreparedStatementWrapper.java:70)
at
bitronix.tm.resource.jdbc.JdbcPooledConnection.stateChanging(JdbcPooledConnection.java:205)
at
bitronix.tm.resource.common.AbstractXAStatefulHolder.fireStateChanging(AbstractXAStatefulHolder.java:61)
at
bitronix.tm.resource.common.AbstractXAStatefulHolder.setState(AbstractXAStatefulHolder.java:30)
at
bitronix.tm.resource.common.DeferredReleaseSynchronization.afterCompletion(DeferredReleaseSynchronization.java:33)
at
bitronix.tm.BitronixTransaction.fireAfterCompletionEvent(BitronixTransaction.java:416)
at
bitronix.tm.BitronixTransaction.rollback(BitronixTransaction.java:227)
at
bitronix.tm.BitronixTransactionManager.rollback(BitronixTransactionManager.java:104)
at
org.drools.persistence.session.SingleSessionCommandService.(SingleSessionCommandService.java:128)
at
org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)
at
org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)
at
pilot.tests.DroolFlowPersistenceTest.main(DroolFlowPersistenceTest.java:60)
java.lang.RuntimeException: Could not commit session
at
org.drools.persistence.session.SingleSessionCommandService.(SingleSessionCommandService.java:133)
at
org.drools.persistence.jpa.impl.JPAKnowledgeServiceProviderImpl.newStatefulKnowledgeSession(JPAKnowledgeServiceProviderImpl.java:44)
at
org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:93)
at
pilot.tests.DroolFlowPersistenceTest.main(DroolFlowPersistenceTest.java:60)
Caused by: java.lang.IllegalArgumentException: null source
at java.util.EventObject.(EventObject.java:38)
at javax.sql.StatementEvent.(StatementEvent.java:39)
at
com.mysql.jdbc.jdbc2.optional.JDBC4PreparedStatementWrapper.close(JDBC4PreparedStatementWrapper.java:70)
at
org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:563)
at
org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:291)
at
org.hibernate.id.insert.AbstractReturningDelegate.releaseStatement(AbstractReturningDelegate.java:82)
at
org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:60)
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2186)
at
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2666)
at
org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at
org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)
at
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at
org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
at
org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154)
at
org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110)
at
org.hibernate.event.def.DefaultPersistEvent

[rules-users] Activated rule not firing eventhough was never cancelled

2010-03-25 Thread H.C.

I have about a dozen rules across various ruleflow groups orchestrated
through a ruleflow. I am trying to troubleshoot why a particular rule in a
downstream ruleflow group is not firing. 

I see an activation created for this particular rule as facts are added to
working memory (by looking at the audit log). My ruleflow starts and I
insepct all cancelled activations for all subsequent fact
inserts/updates/retracts and don't see the rule's activation ever being
cancelled before it reaches the rule's ruleflow group activation. The rule's
ruleflow group is activated but the rule's activation isn't executed.

I would think I would see a cancellation of the rule if a prior fact change
had rendered the rule uneligible.

Why might this happen?
-- 
View this message in context: 
http://n3.nabble.com/Activated-rule-not-firing-eventhough-was-never-cancelled-tp526882p526882.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] Persitence configuration issue in Drools Flow 5.1.M1 (PersistenceException/AnnotationException)

2010-03-25 Thread Nol de Wit
Hi,

(using Droolw Flow 5.1.M1)

I've made a reasonably simple Drool Flow model, containing a ForEach,
a split and  and a couple of actions. Without Persistence it works
nicely: I start it with one variable/parameter, a class I call Report
with 4 Lines of data . Each of the lines get's worked on correctly in
the ForEach.

Next I want to add Persistence to the model; I made a persistence.xml,
which is based on the one as shown in chapter 5 of the online Drools
Flow documentation. See below.

I changed the H2 db to a mysql DB.

The firs call (after creating the datasource) in my test now gives an
exception. See the call and exception below.

1) what's wrong? I think my persistence.xml is correct. So what is the
error trying to tell me? Is saying that I should map my parameters
data (Report and Line)? I just read an article from salaboy about
variable persistence 5.1, but I'm not using that...

2) What puzzles me is the link between the persistence.xml (containing
mapping info), and the datasource (containing the credentials of the
DB). In the doc and PerformanceTest.java class in the examples I don't
see any link. Is creating the DataSource enough to get it in JNDI?

Thanks,
Nol


Some of my code and config:

// See makeDataSource() below
PoolingDataSource ds = makeDataSource();

// this call gives an exception:
EntityManagerFactory emf =
Persistence.createEntityManagerFactory( "nl.dnb.avb.drools.jpa" );


25-mrt-2010 14:30:00 org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class:
org.drools.persistence.processinstance.WorkItemInfo
25-mrt-2010 14:30:00 org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity org.drools.persistence.processinstance.WorkItemInfo
on table WorkItemInfo
javax.persistence.PersistenceException: [PersistenceUnit:
nl.dnb.avb.drools.jpa] Unable to configure EntityManagerFactory
at 
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:265)
at 
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
at 
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at 
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at 
pilot.tests.DroolFlowPersistenceTest.main(DroolFlowPersistenceTest.java:41)
Caused by: org.hibernate.AnnotationException: Use of @OneToMany or
@ManyToMany targeting an unmapped class:
org.drools.persistence.processinstance.ProcessInstanceInfo.variables[org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo]
at 
org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1071)
at 
org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:602)
at 
org.hibernate.cfg.annotations.MapBinder$1.secondPass(MapBinder.java:79)


Persistence.xml:


http://java.sun.com/xml/ns/persistence
 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
 http://java.sun.com/xml/ns/persistence/orm
 http://java.sun.com/xml/ns/persistence/orm_1_0.xsd";
  xmlns:orm="http://java.sun.com/xml/ns/persistence/orm";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns="http://java.sun.com/xml/ns/persistence";>

  
org.hibernate.ejb.HibernatePersistence
jdbc/processInstanceDS
org.drools.persistence.session.SessionInfo
org.drools.persistence.processinstance.ProcessInstanceInfo

org.drools.persistence.processinstance.ProcessInstanceEventInfo
org.drools.persistence.processinstance.WorkItemInfo


  
  
  
  
  
  

  




private static PoolingDataSource makeDataSource() {

PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/processInstanceDS");

ds.setClassName("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user", "drools");
ds.getDriverProperties().put("password", "drools");
ds.getDriverProperties().put("URL", 
"jdbc:mysql://DNB35362:3306/drools");
ds.init();

return ds;

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


[rules-users] Fosdem 50 minute introduction into Drools

2010-03-25 Thread Mark Proctor
http://blog.athico.com/2010/03/fosdem-50-minute-introduction-into.html
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] how can we find next nodes from current node in rule flow

2010-03-25 Thread Mauricio Salatino
With the following code snippet you can see how you can get the first next
node. You only need to iterate and create a recursive method to find out the
full path:

 RuleFlowProcessInstance processInstance = (RuleFlowProcessInstance)
ksession.startProcess("org.plugtree.XXX");

NodeInstance node =
processInstance.getNodeInstances().iterator().next();
long id = node.getNodeId();
NodeImpl nodeDef =
(NodeImpl)((RuleFlowProcess)processInstance.getProcess()).getNode(id);
List connections =
nodeDef.getOutgoingConnections().get(0);
Connection connection = connections.get(0);
Node firstNodeAfterTheCurrentNodeInstance = connection.getTo();

Greetings.

On Thu, Mar 25, 2010 at 8:47 AM, KiranP  wrote:

>
> suppose i have a rule flow which has a split node and before that split
> there
> is action node as below
>
> start --> action1 --> Split --> ** -->END
>
> now if i want to find all transitions after split that can happen then is
> tere some api available
>
> if not please provide some workaround.waiting eagerly for
> response.
>
> thanks
>
>
> -
> Keep Working >>:working:
> KiranP
> --
> View this message in context:
> http://n3.nabble.com/how-can-we-find-next-nodes-from-current-node-in-rule-flow-tp519949p519949.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
>



-- 
- 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] Call class method from LHS of a rule

2010-03-25 Thread HafeezurRehman

/* pass a hibernate session to the working memory as a 
global */
session = factory.openSession();
workingMemory.setGlobal("hibernateSession", session);

Login login = new Login();
workingMemory.insert(login);


the isssue was that i was doing it the wrong way that was 

Login login = new Login();
workingMemory.insert(login);

/* pass a hibernate session to the working memory as a 
global */
session = factory.openSession();
workingMemory.setGlobal("hibernateSession", session);


the order was wrong
-- 
View this message in context: 
http://n3.nabble.com/Call-class-method-from-LHS-of-a-rule-tp108383p519993.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-Gunvor

2010-03-25 Thread srikar.jillela

Hi, 
  
  I am new to Drools.I have installed Drools-Gunvor in weblogic.

  Can you please help in creating packages and rules

 Thanks in advance

Thanks
Sreekar
-- 
View this message in context: 
http://n3.nabble.com/Drools-Gunvor-tp519975p519975.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] Call class method from LHS of a rule

2010-03-25 Thread HafeezurRehman

I am using hibernate with drools ...


rule "login_validation"
when
userRole:UserRole() from hibernateSession.createQuery("select 
userRoles
from UserAccount ua where ua.name = :name AND ua.password =
:password").setProperties( {"name" : "Hafeez" , "password" : "asdasd"
}).list()
then
System.out.println( "The role " +
userRole.getRoleName()+" is owned by "+userRole.getAccounts());

end


this rule is fired and gives me correct userRole.getRoleName()+" is owned by
"+userRole.getAccounts()
Now i want to give dynamic input to LHS i.e. I want to replace "Hafeez"
and "asdasd" with some function ...
for the purpose i create a class "LoginAttribs" with "userName" and
"password"

I instert the LoginAttribs loginAttr obj in knowledgebase in A.java



WorkingMemory workingMemory = ruleBase.newStatefulSession();
LoginAttribs loginAttr = new LoginAttribs();
workingMemory.insert(loginAttr );


and change the rule in drl file like 

rule "login_validation"
when
$lg : LoginAttribs ($uN: userName , $pwd:password)
userRole:UserRole() from hibernateSession.createQuery("select 
userRoles
from UserAccount ua where ua.name = :name AND ua.password =
:password").setProperties( {"name" : $uN , "password" : $pwd }).list()
then
System.out.println( "The role " +
userRole.getRoleName()+" is owned by "+userRole.getAccounts());

end



And then this comes

Exception caught while executing action:
org.drools.reteoo.reteooworkingmemory$workingmemoryreteassertact...@1406eb6
[Error: unable to access property (null parent): createQuery]
[Near : {... Unknown }]
 ^
[Line: 1, Column: 0]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:861)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:316)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:138)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:133)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:107)
at org.mvel2.MVEL.executeExpression(MVEL.java:995)
at
org.drools.base.dataproviders.MVELDataProvider.getResults(MVELDataProvider.java:91)
at org.drools.reteoo.FromNode.evaluateAndPropagate(FromNode.java:124)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:104)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:145)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:57)
at
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:142)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
at 
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
at 
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
at org.drools.reteoo.Rete.assertObject(Rete.java:113)
at 
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:218)
at
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:291)
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1486)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1051)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)





by commenting the insert statement in the java file it works fine


-- 
View this message in context: 
http://n3.nabble.com/Call-class-method-from-LHS-of-a-rule-tp108383p519963.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] how can we find next nodes from current node in rule flow

2010-03-25 Thread KiranP

suppose i have a rule flow which has a split node and before that split there
is action node as below

start --> action1 --> Split --> ** -->END

now if i want to find all transitions after split that can happen then is
tere some api available

if not please provide some workaround.waiting eagerly for
response.

thanks


-
Keep Working >>:working:
KiranP
-- 
View this message in context: 
http://n3.nabble.com/how-can-we-find-next-nodes-from-current-node-in-rule-flow-tp519949p519949.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-guvnor, problem when creating test scenarios based on referenced domain model

2010-03-25 Thread kicho

Nicolas!

Thank you very very much! It works now! 
-- 
View this message in context: 
http://n3.nabble.com/drools-guvnor-problem-when-creating-test-scenarios-based-on-referenced-domain-model-tp471099p519882.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-guvnor, problem when creating test scenarios based on referenced domain model

2010-03-25 Thread Nicolas Héron
Hello
you must set to RoleAttr "=rr" and not just "rr"
In the new 5.1, you will have a guided way to set bound variables to each
other
Regards
Nicolas

2010/3/25 kicho 

>
> Hi Nicolas!
>
> Thank you for your quick answer! But, i was kind of hoping that that's not
> the solution...
>
> I'll attach screen shots of rule configuration and test scenario so that we
> could all see what am i doing wrong.
>
> Rule screen:
>
> http://n3.nabble.com/file/n519577/business_rule.jpg
>
> Rule source:
>
> http://n3.nabble.com/file/n519577/business_rule_src.jpg
>
> Test scenario:
>
> http://n3.nabble.com/file/n519577/test_scenario.jpg
>
> When i choose "Run scenario": this is what i get:
>
> http://n3.nabble.com/file/n519577/test_scenario_fail.jpg
>
> As you can see, i get a blank screen with no info at all, which points me
> to
> conclusion that something (not good) happend.
>
> In server log i found this:
>
> 2010-03-25 09:27:17,684 INFO  [STDOUT] ERROR 25-03 09:27:17,684
> (ServiceImplementation.java:runScenario:1942)[Error: could not
> access/write property (roleAttr) in: comExpert01.User]
> [Near : {... __fact__.roleAttr = __val_ }]
>   ^
> [Line: 1, Column: 0]
>
> I've tried to google this but with no success.
> I'm running guvnor as a standalone dist downloaded from jboss site, version
> 5.0.1 on jbossAS 4.2.3, for repository instead of derby i'm using mysql 5.x
>
> I should also mention that if i don't declare roleAttr in test scenario
> (something like this):
>
> http://n3.nabble.com/file/n519577/test_scenario_no_roleAttr.jpg
>
> I get another blank screen after running test with this exception in log
> file:
>
> 2010-03-25 09:49:38,295 INFO  [STDOUT] ERROR 25-03 09:49:38,295
> (ServiceImplementation.java:runScenario:1942)
> org.drools.RuntimeDroolsException: Exception executing predicate
> roleAttr.roleName == "ADMIN"
>
> Since there is no documentation about managing test scenarios i don't know
> what is wrong here.
>
> If you could give me some more directions or hints i would be very
> grateful.
> --
> View this message in context:
> http://n3.nabble.com/drools-guvnor-problem-when-creating-test-scenarios-based-on-referenced-domain-model-tp471099p519577.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] Mechanism to prevent redundant inferences

2010-03-25 Thread Swindells, Thomas
Why do you need to handcode a name unique to a particular activation of the 
rule?  Isn't the combination of (sentence, rulename) unique enough?

What I'm a bit confused about is what you are trying to achieve, is the RHS the 
same for all rules (or at least all combinations that match the same sentence)? 
If they are different then are you sure you don't want them all to fire?

If your rules share the same calculation logic then one approach you could look 
into is separating the selection logic from the calculation logic.
Your existing rules would insert logically an object 
"CalculationRequired(sentence, calculationName)" with multiple rules inserting 
the same fact.
Your calculations would be separate rules triggered by a LHS of the form s : 
sentence, exists(CalcuationRequired(calculationName = "SomeName", sentence = 
s)).

Don't know if that helps or not,

Thomas

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Tracey Lall
Sent: 24 March 2010 18:35
To: Rules Users List
Subject: Re: [rules-users] Mechanism to prevent redundant inferences

Thanks Thomas
 In the rhs I am doing some calculations and then inserting Proven objects. The 
calculations are significant so I would prefer to prevent the rule fires from 
occurring. My inclusion of
Piton(predicate == $sentence, rule="uniquerulename")

does work, but its quite a lot of work to handcode a name which is unique to 
the particular activation of the rule.

thanks for your help!
Tracey
2010/3/22 Swindells, Thomas mailto:tswinde...@nds.com>>
Presumably all your RHS do is insert your Proven objects.  If this is the case 
then my first question is do you actually need to put in an optimisation here?  
How much is the work of evaluating a few extra rule nodes compared to the work 
and memory that will be required to evaluate the shadow facts and prevent the 
rules from firing.

If you do want to try suppress rules firing couldn't you have the following LHS?
Piton(predicate == $sentence, rule="uniquerulename") or not Proven(predicate == 
$sentence)

What I would recommend is lots of reading up about performance, testing, trying 
different combinations and generating the rete graph that drools produces to 
see whether you have added more or less complexity to the graph.  Also make 
sure you order your conditions so that the ones which are most likely to stop 
processing are placed first.

Thomas


From: 
rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org]
 On Behalf Of Tracey Lall
Sent: 20 March 2010 20:55
To: rules-users@lists.jboss.org
Subject: [rules-users] Mechanism to prevent redundant inferences


Hi folks

  I am writing a logical inference engine in drools. Logical sentences (class 
Sentence) which are proven are indicated by the fact Proven( sentence = 
$sentence )

All Proven(sentence) facts are asserted using the drools logical mechanism 
(since logical backtracking is required).

For efficiency purposes I want to be able to suppress firing any rules which 
assert proof of a logical sentence which has already been proven (there may be 
multiple inferences which prove the same sentence).

If the non existence of a proof of a sentence (not exists 
Proven(sentence=$sentence) is included in the lhs conditions then that causes 
problems when the rule logically asserts Proven(sentence) since the insertion 
invalidates the lhs conditions and hence the rule causes its own retraction 
(the inserted fact handle return is null).

As a way around this I created a class Piton() to record whether a particular 
rule has fired. The lhs conditions then become:

(Proven( predicate == $sentence ) or Piton( fireName == $descriptor ) )
And then in the body of the rule the first thing it asserts is the fact:

Piton( fireName == $descriptor )

Where $descriptor is a string built from the rulename  + the set of facts which 
matched the lhs (ie a descriptor which is unique to the rule fire)

With this approach when a rule asserts Proven(sentence) because it has also 
asserted  Piton( fireName == descriptor ) ) the lhs of the rule still matches 
the the rule fire is not retracted.

This approach works, but it is rather tedious to implement since the descriptor 
must be defined in such as way to make it unique (or as far as possible unique) 
to the particular rule activation. Since the drools variable is not accessible 
in the lhs of a rule (and hence the activation details are not accessible in 
the lhs), this means that the descriptor must be handcoded to consist of all 
matching facts for that lhs.

Is this approach the only way to prevent multiple rule firings for the same 
proof, or is there a simpler way to achieve this?

Any advice greatly appreciated!

thanks

Tracey






*

Re: [rules-users] drools-guvnor, problem when creating test scenarios based on referenced domain model

2010-03-25 Thread david_nabble

Hi !


kicho wrote:
> 
> As you can see, i get a blank screen with no info at all, which points me
> to conclusion that something (not good) happend.
> 
> In server log i found this:
> 
> 2010-03-25 09:27:17,684 INFO  [STDOUT] ERROR 25-03 09:27:17,684
> (ServiceImplementation.java:runScenario:1942)  [Error: could not
> access/write property (roleAttr) in: comExpert01.User]
> [Near : {... __fact__.roleAttr = __val_ }]
>^
> [Line: 1, Column: 0]
> 

Does your model declare a setRoleAttr(Role r) Method for the user class?


kicho wrote:
> 
>  http://n3.nabble.com/file/n519577/test_scenario_no_roleAttr.jpg 
> 
> I get another blank screen after running test with this exception in log
> file:
> 
> 2010-03-25 09:49:38,295 INFO  [STDOUT] ERROR 25-03 09:49:38,295
> (ServiceImplementation.java:runScenario:1942) 
> org.drools.RuntimeDroolsException: Exception executing predicate
> roleAttr.roleName == "ADMIN"
> 
 
no idea on this so far..

Could you provide your (test-)model?


-- 
View this message in context: 
http://n3.nabble.com/drools-guvnor-problem-when-creating-test-scenarios-based-on-referenced-domain-model-tp471099p519650.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-guvnor, problem when creating test scenarios based on referenced domain model

2010-03-25 Thread kicho

Hi Nicolas!

Thank you for your quick answer! But, i was kind of hoping that that's not
the solution...

I'll attach screen shots of rule configuration and test scenario so that we
could all see what am i doing wrong.

Rule screen:

http://n3.nabble.com/file/n519577/business_rule.jpg 

Rule source:

http://n3.nabble.com/file/n519577/business_rule_src.jpg 

Test scenario:

http://n3.nabble.com/file/n519577/test_scenario.jpg 

When i choose "Run scenario": this is what i get:

http://n3.nabble.com/file/n519577/test_scenario_fail.jpg 

As you can see, i get a blank screen with no info at all, which points me to
conclusion that something (not good) happend.

In server log i found this:

2010-03-25 09:27:17,684 INFO  [STDOUT] ERROR 25-03 09:27:17,684
(ServiceImplementation.java:runScenario:1942)[Error: could not
access/write property (roleAttr) in: comExpert01.User]
[Near : {... __fact__.roleAttr = __val_ }]
   ^
[Line: 1, Column: 0]

I've tried to google this but with no success.
I'm running guvnor as a standalone dist downloaded from jboss site, version
5.0.1 on jbossAS 4.2.3, for repository instead of derby i'm using mysql 5.x

I should also mention that if i don't declare roleAttr in test scenario
(something like this):

http://n3.nabble.com/file/n519577/test_scenario_no_roleAttr.jpg 

I get another blank screen after running test with this exception in log
file:

2010-03-25 09:49:38,295 INFO  [STDOUT] ERROR 25-03 09:49:38,295
(ServiceImplementation.java:runScenario:1942)   
org.drools.RuntimeDroolsException: Exception executing predicate
roleAttr.roleName == "ADMIN"

Since there is no documentation about managing test scenarios i don't know
what is wrong here.

If you could give me some more directions or hints i would be very grateful.
-- 
View this message in context: 
http://n3.nabble.com/drools-guvnor-problem-when-creating-test-scenarios-based-on-referenced-domain-model-tp471099p519577.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] Deep Links in Guvnor

2010-03-25 Thread Jörg Herbst
Hi,

I'm currently evaluating Guvnor. The application is really great for
managing rools for none developers. But I've got a special requirement.
Is it possible to provide deep links for editing assets or a list of
assets?  I'm looking for a way to create something like a bookmarkable URL
when using the navigator which can be used in another web application.
The background is, I've got different usergroups editing different rules and
I'm looking for a way linking to guvnor and displaying "their" rules.
"Their" can be defined by a package or some naming convention.

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