Collect all occurrences of resulting data.
by Ephemeris Lappis
Hello.
I'm looking for the better way to write a rule that collects data only when
they have been all processed.
For example, two input objects classes as facts : *Data* and *Category*.
I declare a local type to memorize the result of the evaluation for each
pair of fact.
Some rule evaluates the Cartesian product of all *Data* by all *Category* :
Now I want to collect all the results, but only when the previous rule has
been fired for all the data.
Something like :
Any advice ?
Thanks in advance for your help.
Regards.
--
View this message in context: http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-da...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 8 months
Cannot find KieModule: org.default:artifact:1.0.0-SNAPSHOT
by waynemetcalfe
I've seen this problem a few places while searching for a solution. Is it
possible to overcome this issue?
Drools version:6.0.0.Final
Java version: 1.7.0_45
Code snippet:
...
final KieServices ks = KieServices.Factory.get();
final KieRepository kr = ks.getRepository();
final KieFileSystem kfs = ks.newKieFileSystem();
//ruleScript is simply a string containing the rules
kfs.write("src/main/resources/com/company/test/rules/rules.drl",
ruleScript);
KieBuilder kb = ks.newKieBuilder(kfs);
kb.buildAll();
if (kb.getResults().hasMessages(Level.ERROR)){
configuration.getLog().error("\nSomething wrong here!\n\n");
}
final KieContainer kContainer =
ks.newKieContainer(kr.getDefaultReleaseId());
session = kContainer.newKieSession();
Exception:
java.lang.RuntimeException: Cannot find KieModule:
org.default:artifact:1.0.0-SNAPSHOT
at
org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:86)
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Cannot-find-KieModule-org-default-artif...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 8 months
Drools 6 inject ksession with configured persistence
by Jan Šťastný
Hi,
I have a kjar with kmodule.xml, where my kbase and its ksession are defined.
Then I'd like to inject the ksession into my service component and work
with it. But. I don't know where to configure persistence for the
session. Well, in kmodule.xml there is not such an entry. And after
injection there is no way of setting the EntityManagerFactory.
Thanks
Jan
11 years, 8 months
Best practice with Guvnor repository
by Sean Su
If as an organization, we are using Guvnor to host our rules and we have
multiple rule based projects which may not have anything to do with each
other, what would be the recommended practice - having one web application
instance with different packages, or having multiple Guvnor instances
therefore the repository are totally separated?
Thanks
Sean
11 years, 8 months
Loading rules from the filesystem?
by Leonard93
Can anyone here give me a good documentation place or thingy where I can read
about how to implement the drools 6 method of loading your rules from a
folder in the file system instead of inside the jar.
I have it working currently with the knowledgebase class, but since that is
deprecated I want to use the new classes. Although I read the drools
documentation about KieBase and such and programmatically defining your
kmodule. I did not really understand how that will help me load my rules
from a folder.
Basically what I want is that the rules located in C:\RulesFolder\rules.drl
will be loaded into my application and available within a stateless session.
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Loading-rules-from-the-filesystem-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 8 months
KnowledgeBase caching
by krzysztofcislo
Hi,
In our project we would like to cache KnowledgeBase once it's created
because compilation of rules takes long time and we can't afford to do it
every time we need to process rules.
Generaly we use ehCache as caching mechanism, but I am not sure if it's the
best way to just put KnowledgeBase instance there. KnowledgeBase can have
many inner objects and total size calculation is not efficient (ehCache
complains about it). Setting count limit to cache object, and not memory
limit can lead to out of memory or at least application performance
degradation.
Did anyone try to cache this object and reuse it further?
Thank you in advance for answers.
--
View this message in context: http://drools.46999.n3.nabble.com/KnowledgeBase-caching-tp4029276.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 8 months
java.lang.VerifyError: Bad type on operand stack
by lvtenorio
Hello,
I am writing a rules file and unit tests to test each one of them. I am
getting this error during the execution
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
ConditionEvaluator81806ffb7242407db6e6d8f829f4fd4d.evaluate(Lorg/drools/core/common/InternalFactHandle;Lorg/drools/core/common/InternalWorkingMemory;Lorg/dr
ools/core/reteoo/LeftTuple;)Z @12: ireturn
Reason:
Type 'java/lang/Boolean' (current frame, stack[0]) is not assignable to
integer
Current Frame:
bci: @12
flags: { }
locals: { 'ConditionEvaluator81806ffb7242407db6e6d8f829f4fd4d',
'org/drools/core/common/InternalFactHandle',
'org/drools/core/common/InternalWorkingMemory',
'org/drools/core/reteoo/LeftTuple' }
stack: { 'java/lang/Boolean' }
Bytecode:
0000000: 2bb9 001b 0100 c000 1db6 0021 ac
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructor0(Class.java:2803)
at java.lang.Class.getConstructor(Class.java:1718)
at
org.drools.core.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:197)
at
org.drools.core.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:55)
at
org.drools.core.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:289)
at
org.drools.core.rule.constraint.MvelConstraint.access$200(MvelConstraint.java:53)
at
org.drools.core.rule.constraint.MvelConstraint$ConditionJitter.run(MvelConstraint.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
The tests don't stop running and keep working. Here is my pom in case it
helps
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>DroolsTest</groupId>
<artifactId>DroolsTest</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.1.8-01</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>6.1.0.Beta1</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>6.1.0.Beta1</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>knowledge-api</artifactId>
<version>6.1.0.Beta1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
</dependency>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.6</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<printSummary>true</printSummary>
<reportFormat>plain</reportFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.9</version>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.17</version>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</reporting>
</project>
I am using IntelliJ IDEA13.0.2
--
View this message in context: http://drools.46999.n3.nabble.com/java-lang-VerifyError-Bad-type-on-opera...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 8 months