Help regarding populating values from presentation layer into Fact Typpes in drools
by Swapnil Sawant
Hi,
In drools, I have seen that following functionalities have been implemented :
- Creating a fact type which can be used in a rule
- Creating rule by declaring functions or by using DSL
- Testing the rule using test scenario
Here, I had a question regarding decoupling of fact types between my application and drools.
I wanted to whether writing a java code for adding values from form/database(i.e. my application) into fact types of drools package which I have created is must or is there any automated way for doing this ?
For example,
If new rule gets added which will result in changing fact (either modify existing or add new fact).
In this case one has to write a code for populating presentation layer values into this newly modified/created fact type. Can this be automated..?
>From client support perspective -How to manage addition of New Rule to existing Rule base..?
Thanks & Regards,
Swapnil Sawant | iLabs | L & T Infotech
Plot no. EL - 200,TTC Electronic Zone,Shil-Mahape road,Navi Mumbai - 400 701
Extn: +91 22 6795 4325
Mail: Swapnil.Sawant(a)lntinfotech.com<mailto:Swapnil.Sawant@lntinfotech.com>
www.lntinfotech.com
________________________________
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________
15 years, 8 months
Cannot work out how to get created fact to retract on change of 'when' conditions - help!
by Stephen Mcgruer
Hey,
We have the following situation: Fact1 and Fact2 both have a 'score'
property. They also both have a 'month' property. When a Fact1 and a
Fact2 have the same month (at most there will only be one such pairing
for each month), a Fact3 is created with a score made from adding the
two base Facts scores:
rule "ExampleRule"
dialect "mvel"
when
Fact1( fact1Month : month, fact1Score : score > 0)
Fact2( month == fact1Month, fact2Score : score > 0)
then
Fact3 fact3 = new Fact3();
fact3.setScore( fact1Score + fact2Score);
insertLogical(fact3);
end
Our problem is that if fact1Score or fact2Score is now changed, a new
Fact3 with a new score is created, *but* the old Fact3 is of course
not removed - the conditions in its when still hold true as well (the
new score is still above 0).
Can anyone think of a way to make sure that if either fact1Score or
fact2Score is changed, then the old fact3 is removed from memory?
The only way we could at all think to do this is to add a timestamp to
fact3, and to have another rule that retracts old fact3s if there is
one with a newer timestamp and the same month... but it seems horribly
messy.
Thanks,
Stephen
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
15 years, 8 months
KnowledgeAgent and OSGI
by mmarmol
Hi, I have managed to install Drools-core and Drools-compiler in my Equinox
osgi environment, I can compile rules and execute them just fine, I was just
wandering how to configure a KnowledgeAgent using
KnowledgeBuilderFactoryService and KnowledgeBaseFactoryService. I managed to
configure one but i am not able to reload rules when they change at runtime.
I have started ResourceChangeScannerService and
ResourceChangeNotifierService, changeset related to the rules file gets read
but no change gets implemented. An idea?
Here is the code:
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
ServiceReference serviceRef = bc
.getServiceReference(ServiceRegistry.class.getName());
ServiceRegistry registry = (ServiceRegistry) bc.getService(serviceRef);
KnowledgeBuilderFactoryService knowledgeBuilderFactoryService = registry
.get(KnowledgeBuilderFactoryService.class);
KnowledgeBaseFactoryService knowledgeBaseFactoryService = registry
.get(KnowledgeBaseFactoryService.class);
ResourceFactoryService resourceFactoryService = registry
.get(ResourceFactoryService.class);
KnowledgeBuilderConfiguration kbConf = knowledgeBuilderFactoryService
.newKnowledgeBuilderConfiguration(null, getClass()
.getClassLoader());
KnowledgeBuilder kbuilder = knowledgeBuilderFactoryService
.newKnowledgeBuilder(kbConf);
ResourceFactoryService resource = resourceFactoryService;
kbuilder.add(resource.newFileSystemResource(filePath),
ResourceType.CHANGE_SET);
if (kbuilder.hasErrors()) {
System.out.println(kbuilder.getErrors());
throw new RuntimeException(kbuilder.getErrors().toString());
}
KnowledgeBaseConfiguration kbaseConf = knowledgeBaseFactoryService
.newKnowledgeBaseConfiguration(null, getClass()
.getClassLoader());
KnowledgeBase kbase = knowledgeBaseFactoryService
.newKnowledgeBase(kbaseConf);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.agent.scanDirectories", "true");
aconf.setProperty("drools.agent.scanResources", "true");
aconf.setProperty("drools.agent.newInstance", "false");
kagent = KnowledgeAgentFactory.newKnowledgeAgent( "CoreDroolsAgent",kbase,
aconf);
kagent.applyChangeSet(resource.newFileSystemResource(filePath));
Thanks in advance!
Cheers
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/KnowledgeAgent-and-OS...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 8 months
Updating to 5.1 - what jars do I need to replace?
by Stephen Mcgruer
Hi guys,
Really struggling with what jars I need to replace to update to Drools
5.1. I've tried replacing just the "drools" jars, but I get a
"java.io.InvalidClassException:
org.drools.rule.DialectRuntimeRegistry; local class incompatible:
stream classdesc serialVersionUID = 5308493362083281112, local class
serialVersionUID = 510" error, so I assume I need to replace more -
but I don't know which. I tried replacing all of the ones that had new
versions in the drools 5.1 binaries, but this caused Hibernate to fail
on runtime, claiming it couldnt understand annotations! The following
is a list of the jars currently in the project for Drools 5.0 - I did
not put together this list originally, so some might not be needed but
I dont know which. I would much appreciate some help working out which
jars I need to change to get my code to talk to Guvnor 5.1...
Main lib:
activation-1.1.jar
antlr-2.7.6.jar
antlrworks-1.3.1.jar
btm-1.3.2.jar
com.springsource.org.apache.commons.pool-1.5.3.jar
commons-collections-3.1.jar
commons-dbcp-1.4.jar
commons-io-1.3.2.jar
commons-lang-2.4.jar
commons-logging.jar
core-3.4.2.v_883_R34x.jar
dom4j.jar
drools-ant-5.0.1.jar
drools-api-5.0.1.jar
drools-compiler-5.0.1.jar
drools-core-5.0.1.jar
drools-decisiontables-5.0.1.jar
drools-persistence-jpa-5.0.1.jar
drools-process-task-5.0.1.jar
drools-solver-core-5.0.1.jar
drools-templates-5.0.1.jar
drools-verifier-5.0.1.jar
drools-workitems-5.0.1.jar
ejb3-persistence.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-core.jar
hibernate-entitymanager-3.3.2.GA.jar
hibernate3.jar
janino-2.5.15.jar
jars.txt
javassist-3.9.0.GA.jar
joda-time-1.6.jar
jstl.jar
jta-1.1.jar
junit-3.8.1.jar
log4j-1.2.15.jar
mail-1.4.jar
mvel2-2.0.10.jar
mysql-connector-java-5.1.12-bin.jar
persistence-api-1.0.jar
servlet-api-2.3.jar
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.10.jar
spring-2.5.6.jar
spring-beans-2.5.6.jar
spring-context-2.5.6.jar
spring-context-support-2.5.6.jar
spring-core-2.5.6.jar
spring-test-2.5.6.jar
spring-web-2.5.6.jar
spring-webmvc.jar
spring.jar
standard.jar
xpp3_min-1.1.4c.jar
xstream-1.3.1.jar
WEBINF:
antlr-2.7.6.jar
antlrworks-1.3.1.jar
com.springsource.org.apache.commons.pool-1.5.3.jar
commons-collections-3.1.jar
commons-dbcp-1.4.jar
commons-lang-2.4.jar
commons-logging.jar
dom4j.jar
drools-ant-5.0.1.jar
drools-api-5.0.1.jar
drools-compiler-5.0.1.jar
drools-core-5.0.1.jar
drools-decisiontables-5.0.1.jar
drools-persistence-jpa-5.0.1.jar
drools-process-task-5.0.1.jar
drools-templates-5.0.1.jar
drools-verifier-5.0.1.jar
drools-workitems-5.0.1.jar
ejb3-persistence.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-core.jar
hibernate3.jar
javassist-3.9.0.GA.jar
jstl.jar
jta-1.1.jar
log4j-1.2.15.jar
mvel2-2.0.10.jar
mysql-connector-java-5.1.12-bin.jar
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.10.jar
spring-webmvc.jar
spring.jar
standard.jar
test.txt
xstream-1.3.1.jar
Cheers,
Stephen
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
15 years, 8 months
Is this a bug? when using Human Task.
by XiaoMiTang
When use the Human Task,some tables were created in DB automatic,but one SQL
statement occured error is this:
create table Notification_EmailNotificationHeader
(
Notification_id numeric(19,0) not null,
emailHeaders_id numeric(19,0) not null,
mapkey varchar(255) null,
primary key (Notification_id, mapkey),
unique (emailHeaders_id)
)
the mapkey is nullable,can not be defined as primary key~
Is this a bug? or something wrong with my development enviroment?
Eclipse + tomcat + MS SQL Server2008
Mina 2.0(hibernate-core-3.3.0.SP1.jar)
persistence.xml is this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence
version="1.0"
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"
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">
<persistence-unit name="org.drools.task">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.drools.task.Attachment</class>
<class>org.drools.task.Content</class>
<class>org.drools.task.BooleanExpression</class>
<class>org.drools.task.Comment</class>
<class>org.drools.task.Deadline</class>
<class>org.drools.task.Comment</class>
<class>org.drools.task.Deadline</class>
<class>org.drools.task.Delegation</class>
<class>org.drools.task.Escalation</class>
<class>org.drools.task.Group</class>
<class>org.drools.task.I18NText</class>
<class>org.drools.task.Notification</class>
<class>org.drools.task.EmailNotification</class>
<class>org.drools.task.EmailNotificationHeader</class>
<class>org.drools.task.PeopleAssignments</class>
<class>org.drools.task.Reassignment</class>
<class>org.drools.task.Status</class>
<class>org.drools.task.Task</class>
<class>org.drools.task.TaskData</class>
<class>org.drools.task.SubTasksStrategy</class>
<class>org.drools.task.OnParentAbortAllSubTasksEndStrategy</class>
<class>org.drools.task.OnAllSubTasksEndParentEndStrategy</class>
<class>org.drools.task.User</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.SQLServerDialect"/>
<property name="hibernate.connection.driver_class"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="hibernate.connection.url"
value="jdbc:sqlserver://192.168.101.91:1433;DatabaseName=BinTest" />
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value="sa"/>
<property name="hibernate.connection.autocommit" value="false" />
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
Can anyone help?
XiaoMiTang
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Is-this-a-bug-when-us...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 8 months
How to use Drools Flow?
by XiaoMiTang
Hi, I am tring to use Drools Flow in a B/S project,but get in trouble.
a simple ruleflow.rf file like this:
===Start====
Start------>Action----->Email----->End
====End==
User A log in the system by a browser,press a button,execute the code below:
================
StatefulKnowledgeSession session = …………
session.startProcess("com.sample.ruleflow");
================
it works ok. the "Action" has been done,the Email has been sent, the whole
of flow was finished.
the problem is how to do with the .rf file like this?
==========
Start--->Action1(need user A to do it)---->Action2(need user B to do
it)-->Email-->End
==========
Can anyone please give me an idea ?
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-to-use-Drools-Flo...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 8 months
Size of working memory
by Nick Heudecker
I'm working on some capacity planning and I need an accurate way to
determine the size of the working memory. Any suggestions on getting
visibility into the size of the WM?
Thanks.
15 years, 8 months
Reusing Rules in a Rule Flow?
by Jason Davidson
Is it possible to use a rule in a rule flow without a "ruleflow-group"?
Here's our use case: We have a base set of rules that are not part of
a ruleflow-group. But we want to allow the administrators of the
system to build custom rule flows that reuse these existing base
rules. In most instances the "base" rules will be fired but in some
instances the ruleflow will be executed too.
What's the best way to reuse a rule in this case?
Thanks!
Jason
15 years, 8 months
Decision table creation query
by Kripa Nathwani
Hello Admin,
I am new to Drools.
Kindly let me know the steps to create a decision table in Drools Guvnor.
Best Regards,
Kripa
Mail: Kripa.Nathwani(a)lntinfotech.com<mailto:Biswajit.Sahoo@lntinfotech.com>
________________________________
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________
15 years, 8 months