Need a way to import multiple pre-compiled kie-bases at runt ime.
by Soumya.plavaga
We have two set of rules. Some of them are static. Some of them changes
frequently. We need to find a way to keep the pre-compiled version of those
rules into filesystem and import them into knowledge base at run time. So
that over all performance to prepare the knowledge base will minimize.
I am trying the following approach with drools 6.0.1 -
Having two drools project say A & B. Both having 1 drl. I have stored the
serialized version of kiebases for project A & B in two different fiile
systems say a.txt & b.txt. Now at the run time I am De-serializing the
kiebases from the above text files and getting two kieBase objects. Now if I
need to include both the kiebases at run time to fire all the rules within
project A & project B what I need to do? Any help will be really
appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Need-a-way-to-import-multiple-pre-compi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Drools Support in IntelliJ
by mreynolds
I recently saw this video:
http://www.screenr.com/w9q8
There are some pretty advanced features being displayed that makes the
Eclipse editor pale in comparison. I assumed that there was a Drools plugin
for this and Googlefu seems to indicate that this is the case. However,
whenever I open a DRL file IntelliJ says it found a plugin that supports
that extension, but when I browse the plugin repo it turns up nothing.
Searching for JBoss revealed a JBPM pluginbut no mention of Drools. This
isn't an environment issue either as this happens to me on both Linux and
Windows.
Does anyone know how to get this plugin? Is there another repository that
needs to be added?
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Support-in-IntelliJ-tp4027784.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Drools 6.0.1: GC overhead limit exceeded, even though objects are retracted
by JarkkoMakela
We have a program that validates large amount of data. When changing this
program to use drools 6.0.1 instead of 5.5.0, this GC overhead limit
exceeded problem occurred.
Program reads one object to memory, then validate it and then retract it.
This is repeated thousands of times.
java version "1.7.0_45"
java options:
JVM_ARGS="$JVM_ARGS -Xmx256m"
JVM_ARGS="$JVM_ARGS -XX:+HeapDumpOnOutOfMemoryError"
JVM_ARGS="$JVM_ARGS -XX:HeapDumpPath=/home/heapdumps"
I also tried different java garbage collection options: -XX:+UseSerialGC,
-XX:+UseParallelGC and -XX:+UseConcMarkSweepGC, but it did not help.
Heapdump says that:
One instance of "org.drools.core.reteoo.JoinNodeLeftTuple" loaded by
"sun.misc.Launcher$AppClassLoader @ 0xf03a13a8" occupies 203,920,080
(98.40%) bytes.
This error is reproduced with rules below. These rules add one object to
memory, then there is one rule that evaluates that object, and after that
the object is retracted. This is repeated in continuous loop, but memory
runs out soon.
package com.cat
declare ValidationError
jee : String
end
declare cat2
name : String
age : Integer
end
rule 'add cat2'
dialect 'mvel'
salience 3000
when
not(exists(cat2()))
then
System.out.println("insert cat2");
$p = new cat2()
insert ($p);
modify ($p){
name = "mau"
};
end
rule 'this rule does not fire'
dialect 'mvel'
salience 4500
when
$k1 : cat2($name : name != "miau")
$k2 : cat2($nameofcat2 : name == "miau")
then
modify ($k1){
name = $nameofcat2
};
modify ($k2){
name = ("miau")
};
System.out.println("this rule does not fire");
end
rule 'retract cat2'
dialect 'mvel'
salience -50
when
$c2 : cat2()
then
retract($c2);
System.out.println("retract cat2");
end
query "getValidationErrors"
validationError: ValidationError()
end
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-1-GC-overhead-limit-exceeded...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
How to create object model (parse into object) from mvel string in drl file?
by neal
Below is the template to generate the rule statement (It is basic one).
What I want to do is to read the string and convert into object.
package @{package};
@foreach{importEntry : imports}
import @{importEntry};
@end{}
@foreach{importEntry : staticImports}
import static @{importEntry};
@end{}
rule "@{ruleName}"
dialect "@{dialectName}"
salience @{salienceValue}
enabled @{enableValue}
when
@foreach{modelObject : modelObjects} @{modelObject.referenceName} :
@{modelObject.referenceType} ( @foreach{ attribute : modelObject.attributes}
@{attribute.name} @{attribute.operator} "@{attribute.value}" @end{} ) @end{}
then
// tempate data to set attribute
end
/ code to run the tempate
TemplateRegistry RULE_REGISTRY = new SimpleTemplateRegistry();
RULE_REGISTRY.addNamedTemplate( "rules",
getCompiledTemplate(prepareSimpleTemplate()));
System.out.println(TemplateRuntime.execute(
RULE_REGISTRY.getNamedTemplate( "rules" ),
getMap(),RULE_REGISTRY ));
}
// method to get tempate in string
public static String prepareSimpleTemplate() {
return StringUtils.readFileAsString(new InputStreamReader(
MvelDemo.class.getResourceAsStream("RuleTemplate.mvel")));
}
The rule statement generated is:
package some;
import rout.Vo;
rule "Row_001"
dialect "mvel"
salience 10
enabled true
when
vo : Vo ( type_code == "S" )
then
vo.a_name = "X"
end
How to generate object model from String generated from MVEL template? Is
there any parser available to convert String into Object model in MVEL?
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-create-object-model-parse-into-o...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
named consequences for an or...
by pmander
I was using or in a rule for example
rule "or example"
when
$t : (Transaction(org == "us") or Transaction(acc == "111"))
then
insert(new Record($t, 1));
end
This would work but would create 2 Record objects which we sorted out later
on but now for performance reasons I don't want the second match to be
evaluated if the first one matches. I saw a post about named consequences
and came up with something like:
when
$t : Transaction(org == "us")
if ($t != null) break[t1]
$t1 : Transaction(acc == "111")
then
insert(new Record($t1, 1));
then[t1]
insert(new Record($t, 1));
end
This compiles but the "or" doesn't work. This is probably due to my "break".
Is there a way I can do what I need?
Note that the performance implication of performing the or is not apparent
in this example but it is there - I have simplified this example to make it
easier to talk about (and to protect the innocent)
--
View this message in context: http://drools.46999.n3.nabble.com/named-consequences-for-an-or-tp4027775....
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Unable to figure out few feature for tomcat7 deployment
by Mohit Srivastava
Hi,
I deployed drools workbench on tomcat. Guide only explains every thing on
Wildfly or JBOSS EPA cluster
But I am unable to figure out following things:
- How to add new user?
- How to change system properties?
Thanks
--
Mohit
12 years, 1 month
Issue with Kie-cli-config
by Soumya.plavaga
Hi,
I tried to use kie-cli-config tools but it is not getting worked. I have
downloaded the zip distribution of that as mentioned in doc but when I am
running the kie-clie-config.sh file it's not resolving the main method under
CmdMain class. I have also tried to add the maven dependency for
'kie-cli-config' in my java project and tried to execute the main method
it's giving some exception at the point where initializing the clicontext.
It's giving exception in the following line -
bootstrap.validateBeans(); (within -
org.jboss.weld.environment.se.Weld.initialize()).
Exception coming -
Unsatisfied dependencies for type [ServletContext] with qualifiers [@Named]
at injection point [[field] @Inject @Named private
org.uberfire.backend.server.plugin.RuntimePluginsServiceServerImpl.servletContext]
Hence I can not go forward after this. Looks like ServletContext is not
getting resolved within 'RuntimePluginsServiceServerImpl' class. Can you
please confirm if this is an issue ? In that case what will be the work
around we will use?
Any help will be really appreciated.
Many Thanks,
Soumya
--
View this message in context: http://drools.46999.n3.nabble.com/Issue-with-Kie-cli-config-tp4027737.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
How to generate rule statements using MVEL 2.0 template?
by neal
I came to know through drool user forum that a drl file can be created using
recursive MVEL 2.0 template.
I am trying like below.
public static String prepareRule(String RuleName){
String template = "\n rule \""+RuleName+"\" "+
"\n dialect \"mvel\" "+
"\n salience \"10\" " +
"\n when" +
"\n demo : Demo( one == \"N\" , two == \"C\" , three == 1005 )" +
"\n then" +
"\n demo.setFirst( 4003 );" +
"\n demo.setLast( 4003 );" +
"\n demo.setRuleID( \"SEQ_1\" );";
return template;
}
public static String getRuleAsString(String template){
Map vars = new HashMap();
return (String) TemplateRuntime.eval(template,vars);
}
public static void main(String[] args) {
System.out.println(getRuleAsString(prepareRule("Rule 1")));
}
When i am printing it out, It is generating rule skeleton. I am planning to
create whole rule stuff passing arguments like rule name in the example. Am
i doing correct?
How to do it correctly?
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-generate-rule-statements-using-M...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month