How can i delete any object after executing the rules from the memory.
by nkumar
Hi..
I want to delete the objects which i inserted earlier to execute the rules
upon. Why i want this is i have two lists containing 20 objects of two
different classes. for every combination i am assigning some values to the
class variables in the rule file. So at any single time i want to execute
rule on a single set of 2 classes.
ksession.insert(object1 of class1)
ksession.insert(object1 of class2)
then next time i want this on
ksession.insert(object1 of class1)
ksession.insert(object2 of class2)
and so on..
I can insert all the objects once and can execute the rules on the objects
but i have to save result of each combination in the list. No matter what
the output is.
Please suggest how can i solve this. if i have to insert only 2 objects at a
time then after inserting an object,there is no use to insert that again. So
how can i remove the objects from the memory after executing the rules.
Thansk...appreciate your help.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-can-i-delete-any-...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 5 months
Using Guvnor rule to check if page is in a list of pages (enumeration)? Contains?
by Kevin
Hi,
I'm investigating Drools Guvnor for use as both entitlements and
business rules where "entitlements" means I
am checking access to certain web pages (or partial page resources)
based on a pre-defined a resource (given a role for example) that I
would send in when executing the rule.
Is it possible to populate my Fact with the resource for the left hand
side and have the rule check to see if that value exists in
the right hand side (presumably populated from an Enumeration).
So far it seems to want me to pick a value. Instead, I want to say
that any of these values are OK.
I guess I'm asking if it can do a contains rather than equals from a list.
Fact example:
Fact name: Resource
field: resourceName
Enumeration name: Resources
'Resource.resourceName': ['somedirectory', 'foo/bar.html', 'etc/blah.html']
Rule Example:
When
There is a Resource.resourceName 'contains' a value from Resources
Then
Permit = true (or similar)
Sorry if this is covered in the manual and I missed it.
Using Guvnor 5.1.1.
Thanks!
K
15 years, 5 months
Drools examples don't run
by 赵侃侃
Hello,
I checked out the latest source from svn repository. It compiled OK and
imported the example projects to my eclipse workspace but the examples run
with error.
The two example projects are namely drools-examples-drl
& drools-examples-fusion.
org.drools.examples.pacman.Main gives the errors:
Exception in thread "main" java.lang.NoClassDefFoundError:
com/thoughtworks/xstream/XStream
at
org.drools.audit.KnowledgeRuntimeLoggerProviderImpl.newThreadedFileLogger(KnowledgeRuntimeLoggerProviderImpl.java:34)
at
org.drools.logger.KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(KnowledgeRuntimeLoggerFactory.java:69)
at org.drools.examples.pacman.Main.initKsession(Main.java:88)
at org.drools.examples.pacman.Main.main(Main.java:39)
Caused by: java.lang.ClassNotFoundException:
com.thoughtworks.xstream.XStream
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
org.drools.examples.broker.Main gives the errors:
java.lang.NullPointerException
at
org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at org.drools.examples.broker.Broker.loadRuleBase(Broker.java:95)
at org.drools.examples.broker.Broker.createSession(Broker.java:80)
at org.drools.examples.broker.Broker.<init>(Broker.java:57)
at org.drools.examples.broker.Main.main(Main.java:53)
Does anyone experience the similar issues and know how to fix that?
Best Regards,
Kevin
15 years, 5 months
Using Declared types in Decision Tables
by Uday Kodukula
Hello,
I have a question on how one can import declared types into a decision
table, that are declared in a separate DRL file.
Take for instance the following declared type which is defined in an
isolated DRL file:
declare Offer
id: String
name: String
isValid: boolean
end
This type can be used in Java code if we were to use the Knowledge base to
give us a FactType via code like:
FactType offerType = kbase.getFactType("package.to.model.offer", "Offer");
and then use them accordingly. However, i'm not sure if such an approach /
api exists for importing declared types from DRLs into decision tables.
How can something like this be done in Decision tables?
When I import the declared Offer, which isn't complied yet, the decision
table complains.
Thanks,
Uday
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Using-Declared-types-...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 5 months
Post XML requests to Drools Server 5.1
by Jeffrey Miller
I am attempting to setup the latest version of Drools Server. The sample on
the website uses a jsp to forward an xml request to the same server the jsp
is running on (using a camel-client.xml.) I am unclear what the
camel-client.xml is actually responsible for doing.
Is this camel-client.xml configuration necessary if you want to send fully
formed requests in xml to the server? I have tried to set this up, but, for
example, by doing something like this:
curl --data "<batch-execution lookup="ksession1"> <insert
out-identifier="message"><org.test.Message><text>msg</text></org.test.Message></insert></batch-execution>"
http://localhost:8080/drools-server/kservice/kservice/rest
but the tomcat log just shows this:
Oct 21, 2010 4:10:55 PM org.apache.cxf.jaxrs.utils.JAXRSUtils
findTargetMethod
WARNING: .No operation matching request path / is found, HTTP Method : POST,
ContentType : application/x-www-form-urlencoded, Accept : */*,.
Oct 21, 2010 4:10:55 PM
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: WebApplicationException has been caught : no cause is available
Does anyone know how to set this up properly?
Thanks,
Jeff
15 years, 5 months
Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder
by Jason van Zyl
Hi,
I have been following the documentation to create a RuleFlowProcess, and I went the route of creating the flow programmatically, but I can't find an example of adding this process to the knowledge builder. It seems to want an external resource of a given type. In my little code scenario below how would I add this programmatically created RuleFlowProcess?
DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();
RuleFlowProcess flow = flowGenerator.generateFlow( "flow" );
KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add( flow.getResource() /* this is null */, null /* what do i put here*/ );
Do I have to serialize to an external form and deserialize?
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------
Three people can keep a secret provided two of them are dead.
-- Unknown
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------
A language that doesn’t affect the way you think about programming is not worth knowing.
-— Alan Perlis
15 years, 5 months
Drools Sample Project Won't Execute on Spring STS IDE 2.3.2
by Jason Mihalick
Versions involved:
IDE: Spring STS 2.3.2.RELEASE
Eclipse Drools Plugin: 5.1.1 (Includes JBoss Drools Core, JBoss Drools
Guvnor, JBoss Drools Task)
Java: JDK 1.6.0_11
Platform: Windows XP
1) Create a sample Drools application using the New Project Wizard and
selecting "Drools Project"
2) Name it MyDroolsProject
3) Check all options on the add sample classes (e.g., 'Add a sample
HelloWorld rule file to this project', etc.)
4) Check to 'Use default Drools Runtime (currently Drools 5.1.0 runtime)'.
Also choose to Generate code compatible with 'Drools 5.1.x'. Click Finish.
5) In your newly created 'MyDroolsProject', drill down to
com.sample.DecisionTableTest.java, right click and choose to 'Run As | Java
Application'
The following stack trace ensues. (Note, yes, I do have the STS Groovy
plugin installed)
Warning: Cell at E21 not present - adding a blank
Build groovy files option has not been set one way or the other: use
'options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,
CompilerOptions.ENABLED);'
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Plugin
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at
org.eclipse.jdt.internal.compiler.Compiler.initializeParser(Compiler.java:755)
at
org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:312)
at
org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:177)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:349)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
at
org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
at
org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:677)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:640)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:254)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:484)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34)
at
com.sample.DecisionTableTest.readKnowledgeBase(DecisionTableTest.java:44)
at com.sample.DecisionTableTest.main(DecisionTableTest.java:25)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 27 more
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Sample-Project...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 5 months
Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder
by Jason van Zyl
Hi,
I have been following the documentation to create a RuleFlowProcess, and I went the route of creating the flow programmatically, but I can't find an example of adding this process to the knowledge builder. It seems to want an external resource of a given type. In my little code scenario below how would I add this programmatically created RuleFlowProcess?
DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();
RuleFlowProcess flow = flowGenerator.generateFlow( "flow" );
KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add( flow.getResource() /* this is null */, null /* what do i put here*/ );
Do I have to serialize to an external form and deserialize?
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------
Three people can keep a secret provided two of them are dead.
-- Unknown
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------
We know what we are, but know not what we may be.
-- Shakespeare
15 years, 5 months