Re: [rules-users] Need help related to collection of data accessing in rule file.
by prasad raju sagi
Hi ,
I am trying to create rule on a fact , which contains arraylist of collection and the object in the collection internally contains an arraylist of another collection of objects.
This looks like object A contains collection of objects B and B contains collection object C
A -> blist ( Arraylist<B> )
B -> clist (ArrayList<C> )
C-> dlist( ArrayList<D>)
D-> type ( string)
I am inseting A as fact to the working memory.
I am in confusion state like how to write the rule to place conditions on collection C.
Can I use from in the form of nested from in rule statment.
Thanks
Prasad Raju Sagi
Mobile: 847-644-4103
________________________________
From: Aziz Boxwala <boxwala(a)yahoo.com>
To: rules-users(a)lists.jboss.org
Sent: Thursday, June 11, 2009 1:58:28 PM
Subject: [rules-users] process order example not working fully
I am trying to execute a ruleflow and use rules to assign tasks within the ruleflow in Drools 5.0.1. I have a drl file included in my knowledge base that tries to assign a task to a user when a new human task is created. This is based on the example in org.drools.example.process.order. I can't get my code to work. I don't the rules in the example are working either (dslr for the task assignment or the drl for dynamic logging). After some attempts, I found that this condition
WorkItemNodeInstance()
does not evaluate to true ever.
Do I have to do anything special to make the WorkItemNodeInstance appear in working memory?
Thanks for any help.
--Aziz
14 years, 12 months
unable to resolve Type Declaration class
by richarda
So, my code is doing this:
KnowledgeBaseConfiguration conf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
conf.setOption(EventProcessingOption.STREAM);
KnowledgeBuilder builder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
try {
File f = new File("/tmp/my.pkg");
InputStream stream = new FileInputStream(f);
if (stream == null) {
jlog.fatal("Unable to find rule pkg");
} else {
jlog.info("adding pkg");
builder.add(ResourceFactory.newInputStreamResource(stream),
ResourceType.PKG);
}
} catch (Exception e) {
e.printStackTrace();
}
KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase(conf);
kbase.addKnowledgePackages(builder.getKnowledgePackages());
jlog.info("setup creating knowledge session");
ksession = kbase.newStatefulKnowledgeSession();
jlog.info(" setup ksession created");
The pkg was created from Guvnor.
If in the package declaration area in Guvnor, (where you put the import
statements)
If I put
declare Signature
@role ( event )
end
then build the package, save it to disk /tmp/my.pkg
on startup I get:
[#|2009-11-24T14:50:38.944+0000|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=pool-1-thread-3;_RequestID=7c35064d-757e-4519-b5eb-433db89e168d;|org.drools.RuntimeDroolsException:
unable to resolve Type Declaration class 'Signature'
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
I need to declare 'Signature' as an 'event'
Am I doing this wrong?
If I do this all in Eclipse and load the DRL files manually it all works.
--
View this message in context: http://old.nabble.com/unable-to-resolve-Type-Declaration-class-tp26497326...
Sent from the drools - user mailing list archive at Nabble.com.
14 years, 12 months
How to store the rules data into RDBMS, like mysql, oracle
by Sinboy Zhang
Hi,all:
Guvnor is a BRMS,it can manage the rules through Jackrabbit
Repository.The default,Guvnor work well with derby database.But i want it
work with my database,just like MySQL.
My step is :
1.Run Guvnor with default,and generate the repository.xml and repository
dictionary at JBOSS_HOME\bin dictionary
2.delete repository dictionary and edit repository.xml,only replace the
content in <PersistenceManage> label ,just like this:
<PersistenceManager
class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://localhost:3306/guvnor_db"/>
<param name="user" value="root" />
<param name="password" value="a123456" />
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="${wsp.name}_"/>
<param name="externalBLOBs" value="false"/>
</PersistenceManager>
3.install Mysql database,and create the guvnor_db database instance,and
copy mysql driver to JBOSS_HOME\server\deploy\lib
4.Restart the JBoss ,i get the exception:
org.drools.repository.RulesRepositoryException:
javax.jcr.RepositoryException: Invalid repository configuration:
repository.xml: Replacement not found for ${wsp.name}.: Replacement not
found for ${wsp.name}.
Why?Please help me,thanks!
14 years, 12 months
Drools with Web Application
by Sahid Khan (সাহিদ)
Hello,
Drools is very new to me. So please excuse me if this question sounds too naive.
Basically my requirement is: I have a web based (3-tier j2ee)
application which is
deployed in JBoss AS. Now I want to incorporate some business rule
implementations with this application so that end users, who are not
very technical, can add/modify the rules according to their need. I
suppose Drools Guvnor will be the front end and rules repository and
Drools Expert will be
the back end for such requirements. Please correct me if I am wrong.
I had gone through the drools documentation. That talks about
stand-alone application for guvnor itself, but I want to use Guvnor
inside my existing application itself, preferably by using some Guvnor API.
Can some one please provide some insight on how to do this. Also, I'll
appreciate if some one can point me to some getting started/best
practice documents for these stuffs?
Many thanks in advance,
--
Sahid
Argue with idiots, and you become an idiot. - PG
14 years, 12 months
Import and Export at Package level
by krishna.cj
Hi,
We are running Guvnor on two machines, out of which one is used for
developing and testing rules, say test environment, and another is
used for providing rules for production application. Our test
environment typically contains more than one package and each in turn
contains multiple snapshots. When we use Export and Import to
provide updated rules to production environment, all the packages and
snapshots are imported to the production environment.
Is there any way to use Export and Import at package level so that we
can export only the package we want and no other package or snapshot?
Any help would be a great help to us..
Best Regards,
Chaitanya.
14 years, 12 months
Stateful session and non-existence of Facts
by Leonardo Gomes
Hi Guys,
I have the following situation while running a stateful session with Drools
4.0.7:
- I want to test that a fact with a given state doesn't exist;
- It works fine
- At a certain point I have to retract all facts and reinsert them at the
stateful session - some of them actually changed and I don't want to
recreate the session b/c it's expensive
- Again the fact that didn't exist when I first created the session still
doesn't exist
** Problem: This time the rule that verified the non-existence is not fired
because I didn't insert any fact that would retrigger it.
Rule example:
rule "022"
when
SiteLanguage(language : languageCode)
t : SiteSpecialServiceType(type : specialServiceType)
not SiteLanguageSpecialServiceType(specialServiceType == type, languageCode
== language)
then
<<consequence>>
end
How could I solve or workaround that?
Thanks in advance,
Leo.
14 years, 12 months
Server Compatibility of Drools
by ramram
Hi All,
I am currently using the Drools Flow with the GWT web console and I could
create many rule flow processes using the JBOSS 4.2.3 version.
But what I am concerned about is that there will be problems if I changed
the application server?
Please can you help me and tell me if the Drools Flow and GWT web console
are compatible with the following application servers:
1- OC4J
2- Bea Weblogic 9.0
3- IBM Websphere
4- Tomcat 6.0
--
View this message in context: http://n3.nabble.com/Server-Compatibility-of-Drools-tp52146p52146.html
Sent from the Drools - user mailing list archive at Nabble.com.
14 years, 12 months
Class Cast Exception
by ramram
I am creating a process using the Fluent API
I am using A START > LOG > USER TASK > END
I have in the process the following:
.workItemNode(14)
.workName("Log")
.inMapping("index", "index")
.inMapping("user", "user")
.outMapping("index", "index")
.outMapping("createUser", "createUser")
.outMapping("user", "user")
.done();
Once running it I have the following exception in the JBUILDER
Exception in thread "main" java.lang.ClassCastException:
org.drools.workflow.core.node.ActionNode cannot be cast to
org.drools.workflow.core.node.WorkItemNode
at
org.drools.ruleflow.core.factory.WorkItemNodeFactory.getWorkItemNode(WorkItemNodeFactory.java:52)
at
org.drools.ruleflow.core.factory.WorkItemNodeFactory.workName(WorkItemNodeFactory.java:76)
at sample.CreateProcess.createProcess1(CreateProcess.java:236)
at sample.CreateProcess.main(CreateProcess.java:31)
can anyone provide support??
--
View this message in context: http://n3.nabble.com/Class-Cast-Exception-tp52113p52113.html
Sent from the Drools - user mailing list archive at Nabble.com.
14 years, 12 months
Constraint Editors of the Rule Flow
by ramram
Hi All,
I have the following situation where I am passing a parameter to the .rf
file called createUser
how I can define it in the constraint editor of the XOR
I am currently using dialect: java type: code and using return createUser;
how can this be transformed using dialect: mvel type: rule
I tried eval(createUser) but its not working?? can someone help in this
issue??
Regards
--
View this message in context: http://n3.nabble.com/Constraint-Editors-of-the-Rule-Flow-tp52072p52072.html
Sent from the Drools - user mailing list archive at Nabble.com.
14 years, 12 months