FUSION jumping windows
by Ahmed Hafsi
Hi Guys,
I see that there is support of sliding windows in drools fusion , my
question is that is it possible to get jumping windows support ? i.e. the
interval gets from (0,10) to (10,20) and so on. instead of (0,10) to (1,11).
If not do you recommand implementing it using rules ? i.e will the
performance hits be too big compared with the builtin support ?
Thanks
k-
14 years, 11 months
Firing only changed object rules in stateful sessions
by Vinay
Hi All ,
I am trying to implement the stateful drools implementation with one big
object (This object has many objects inside needed for rules). I insert this
object in session and fire all rules.
In case the object exist in working memory , I update the object using
facthandler. My problem is as soon as the object gets updated using the fact
handler all rules again gets fired. My business requirement is to only fire
the rules whose value got changed in the update process.
I can't split the object into small objects , since it has all the
relationship and all the rules are already written based on this structure.
Could you please guide me how to implement this requirement. Any help is
really appreciated.
Let me know in case you need any details.
Thanks
Vinay
--
View this message in context: http://n3.nabble.com/Firing-only-changed-object-rules-in-stateful-session...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
Using a global list in a rule
by orchid
Hi All,
I have a question regarding using a global list. I have the following rule:
global java.util.List list List;
Rule "rule1"
when
A
then
list.add("rule1");
When I'm trying to check the list content in LHS of another rule I get a
compilation error: "mismatch input ...":
Rule "rule2"
when
list.contains("rule1") /*or: list contains "rule1"*/
then
...
How do I check the list content from LHS?
Thanks you in advance.
Any help would be appreciated :-)
--
View this message in context: http://n3.nabble.com/Using-a-global-list-in-a-rule-tp115746p115746.html
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
Decision table accessing my own methods
by djb
Hi there,
I have been trying for hours now to get a decision table that can call my
own methods.
Lets say I've got a Classroom, and a list of 4 students.
And my rule is to not have Bill and Bob in the same classroom.
I have a method Classroom.hasStudent(String name), which will say whether
the room has Bill or Bob.
But how do I call it???
Imagine this is my decision table:
classroom: Classroom
classroom.hasStudent("$param")
Bob
Bill
How in the world do I get it to not say "no viable alternative at input
"bob" for blah blah blah"?
I've also tried classroom.hasStudent("$param") == true with no success.
Please help,
Thank you...
Daniel
--
View this message in context: http://n3.nabble.com/Decision-table-accessing-my-own-methods-tp114250p114...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
Re: [rules-users] Using groovy classes as Fact Classes in Guvnor
by HonorGod
This seems to be a legitimate issue ....have you found a solution yet ?
Thanks
leesy84 wrote:
>
> Hi
>
> I am currently trying to implement Drools 5.0.CR1 with grails, I have
> created a couple of domain classes which are simple Groovy classes with a
> couple of fields. I want to load these classes as my model into Guvnor and
> then create rules using those classes. I am having a few problems when
> "Saving and Validating" my configuration. I have a war file that is
> generated using maven and it has my classes files inside it in
> /WEB-INF/classes/ . I load the war as my model and the classes are shown
> on the packages main page but the following error is given when pressing
> "Save and Validate configuration"
>
> [ERR 102] Line 1:10 mismatched input '-'
>
> I have also tried using groovyc to compile my class files then jar'ing
> them up and loading that as the model but got another error:-
>
> java.lang.ClassNotFoundException: groovy.lang.GroovyObject
>
>
> I was wondering if it is possible to use groovy compiled class files and
> if it is then does anyone know what my issue might be or how it is meant
> to be done correctly.
>
> Thanks in advance for any help
>
> Daniel Lees
>
--
View this message in context: http://n3.nabble.com/Using-groovy-classes-as-Fact-Classes-in-Guvnor-tp601...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
Fusion , timing and streams
by Khalil Hafsi
Hi guys,
I was experimenting with Drools fusion (last version) and I have a small
question :
What is the difference between the following (down the page) two rules :
(note the "and" between the patterns) , i.e : how one can understand the
"and" , is it a logical or temporal conjunction ? and finally what is
the implied "relation" between pattern as in rule "b" ? I think it is an
"and" , but using drools fusion to detect 2 stocks having a temporal
relation (using the after op.) , I found different results when
explicitly using "and" between the patterns and not using it.
One final question , what is the default event policy in fusion ? I can
not find any docu about that.
Thank you for your time -k
rule "a"
when
--pattern1
and
--pattern2
then
--action
end
rule "b"
when
--pattern1
--pattern2
then
--action
end
14 years, 11 months
Drools Persistence Problem
by dmiller44
I'm having a lot of trouble getting the default Drools persistence stuff
working as it's documented in the Drools Flow manual. Below I've included
the stack trace, my dependencies (only those related to drools persistence),
my code snipped (which gets compiled into a jar and used by a war) and the
persistence.xml file (which is also compiled into the jar under
META-INF/persistence.xml). Any help would be appreciated.
*Note: I tried posting this yesterday, but it doesnt seem to have made it
to the mailing list, so sorry for a double post if it did *
Stack trace:
2010-01-07
15:36:26,599|org.springframework.web.context.ContextLoader|main|ERROR||
Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'droolsEngineFactory' defined in ServletContext resource
[/WEB-INF/spring/summit/summit-specific.xml]: Invocation of init method
failed; nested exception is java.lang.RuntimeException: Could not commit
session
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.lang.RuntimeException: Could not commit session
at
org.drools.persistence.session.SingleSessionCommandService.<init>(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
com.versatile.mte.drools.engine.DroolsEngineFactory.init(DroolsEngineFactory.java:189)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 39 more
Caused by: javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:109)
... 49 more
2010-01-07
15:36:26,607|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mte-web-portal]|main|ERROR||
Exception sending context initialized event to listener instance of class
org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'droolsEngineFactory' defined in ServletContext resource
[/WEB-INF/spring/summit/summit-specific.xml]: Invocation of init method
failed; nested exception is java.lang.RuntimeException: Could not commit
session
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.lang.RuntimeException: Could not commit session
at
org.drools.persistence.session.SingleSessionCommandService.<init>(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
com.versatile.mte.drools.engine.DroolsEngineFactory.init(DroolsEngineFactory.java:189)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 39 more
Caused by: javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
org.drools.persistence.session.SingleSessionCommandService.<init>(SingleSessionCommandService.java:109)
... 49 more
Dependencies:
<file name="hibernate-3.3.1.ga.jar"/>
<file name="hibernate-annotations-3.4.0.ga.jar"/>
<file name="hibernate-commons-annotations-3.4.0.ga.jar"/>
<file name="hibernate-entitymanager-3.4.0.ga.jar"/>
<file name="javassist-3.4.ga.jar"/>
<file name="jta-1.1.jar"/>
<file name="dom4j-1.6.1.jar"/>
<file name="slf4j-jdk14-1.5.2.jar" />
<file name="btm-1.3.2.jar" />
<file name="h2-1.0.77.jar" />
<file name="postgresql-8.1-407.jdbc3.jar"/>
<file name="drools-persistence-jpa-5.1.0.M1.jar" />
<file name="commons-dbcp-1.2.2.jar" />
<file name="commons-logging-1.1.1.jar"/>
<file name="commons-pool-1.5.1.jar"/>
Code Snippet (part that should be loading via JPA):
//ADDED FOR DROOLS PERSISTENCE
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/testDS1");
ds.setClassName("org.h2.jdbcx.JdbcDataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user","sa");
ds.getDriverProperties().put("password", "sasa");
ds.getDriverProperties().put("URL",
"jdbc:h2:file:/var/tmp/process-instance-db");
ds.init();
try {
Context ctx = new InitialContext();
ctx.createSubcontext("jdbc");
ctx.rebind("jdbc/testDS1",ds);
ctx.close();
} catch (NamingException e) {
e.printStackTrace(); //To change body of catch statement use
File | Settings | File Templates.
}
Environment env = KnowledgeBaseFactory.newEnvironment();
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY,emf);
//grab a session
LOG.debug("Initializing a new StatefulKnowledgeSession...");
//this.ksession = this.kbase.newStatefulKnowledgeSession();
this.ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(kbase,null,env);
And finally the persistence.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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">
<!--persistence-unit name="ProcessService">
<jta-data-source>java:/DefaultDS</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
</properties>
</persistence-unit-->
<persistence-unit name="org.drools.persistence.jpa"
transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/testDS1</jta-data-source>
<class>org.drools.persistence.session.SessionInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
<class>org.drools.persistence.processinstance.WorkItemInfo</class>
<class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class>
<class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>
<class>org.drools.persistence.processinstance.variabletypes.SerializablePersistedVariable</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup" />
</properties>
</persistence-unit>
</persistence>
Any help would be appreciated. This is getting rather frustrating.
--
View this message in context: http://n3.nabble.com/Drools-Persistence-Problem-tp114186p114186.html
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
Re: [rules-users] Problem using BRMS and Knowledge Agent
by HonorGod
Is this issue resolved for you yet?
Thank You!
hockey_dave wrote:
>
> Changing the changeset xml doesn't work for me. I'm using 5.1.0.M1 and I
> now get this error.
>
> [#|2009-10-26T08:54:44.070-0400|INFO|sun-appserver2.1|javax.enterprise.system.st
> ream.out|_ThreadID=22;_ThreadName=RTSellersServlet;|
> (null: 4, 66): SchemaLocation: schemaLocation value =
> 'http://drools.org/drools-
> 5.0/change-set.xsd' must have even number of URI's.|#]
>
> [#|2009-10-26T08:54:44.070-0400|INFO|sun-appserver2.1|javax.enterprise.system.st
> ream.out|_ThreadID=22;_ThreadName=RTSellersServlet;|
> (null: 4, 66): cvc-elt.1: Cannot find the declaration of element
> 'change-set'.|#
> ]
>
--
View this message in context: http://n3.nabble.com/Problem-using-BRMS-and-Knowledge-Agent-tp47676p11479...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months