Scala-Drools Guvnor
by swaroop
Hi ,
Does Guvnor or RuleWorkbench support the scala object model(Exported as jar)
? When i tried with simple scala case classes, I was able to upload the
model(After adding the scala lib to Guvnor Lib directory) but was not able
to see the classes when iam composing a rule . Any pointers would be helpful
Regards
Oggu
--
View this message in context: http://drools.46999.n3.nabble.com/Scala-Drools-Guvnor-tp4027855.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 10 months
SwapMove for Entities with different Value ranges
by jonathan.labin
I'd like to implement something like a swap move but in my domain each
Planning Entity has it's own value range provider. The value ranges are
completely disjoint sets of value instances although two values from
separate ranges can be considered equivalent for the purposes of the swap.
I have started implementing my move using ShiftAssignmentSwapMove as a
template however I want to be correct and efficient about how and when the
work of searching for the value from the leftEntity's value range that is
equivalent to the rightEntity's current value.
The methods isMoveDoable and doMove must both have this identification made.
Can they share the answer with a class variable in a way that is safe under
caching configurations?
Is there a recommendation for minimizing the repeated effort to identify
these equivalent values?
Thanks,
Jon
--
View this message in context: http://drools.46999.n3.nabble.com/SwapMove-for-Entities-with-different-Va...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 10 months
Dynamic rules in Drools 6
by jhusby
Looking at the test case from Edson, quoted below, it appears that there's no
way to reuse a current session when upgrading the kbase rules? I need to
add and remove rules on the fly, and so if I have a stateful session, does
this mean I need to dispose of the current session, upgrade the container,
create a new session, and repopulate it with all my objects?
I was hoping to simply rebuild the repository, call
kContainer.updateToVersion(), and have the the session (with all my objects
still populated) automatically use that new version of the rules repository.
Is this not possible?
Thanks,
Joseph
> Edson Tirelli-4 wrote
> Here is a code example of creating kie modules in memory and upgrading
> existing kbases/ksessions:
>
> https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test...
>
> It is a test case, but maybe it will be easier to follow. We are
> working
> on additional ways of doing similar things as well.
>
> Edson
--
View this message in context: http://drools.46999.n3.nabble.com/Dynamic-rules-in-Drools-6-tp4027833.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 10 months
Buggy query behavior in drools 5.6 and 6.1-SNAPSHOT ??
by Esteban Aliverti
Hi guys,
I was writing some rules using backward chaining and found a strange
behavior.
I managed to isolate the error in the test project I'm attaching.
In the project I have 2 classes: Parent and Child
Parent:
* String id
* String attribute1
* String attribute2
* List<Child> children
Child:
* String parentId;
* String name;
* String value;
In the test I'm creating 1 Parent object with just 1 child and then
inserting the Parent object into a drools session:
Parent p1 = new Parent();
p1.setId("1");
p1.setAttribute1("a1");
p1.setAttribute2(null);
Child c1p1 = new Child();
c1p1.setName("n1");
c1p1.setParentId(p1.getId());
c1p1.setValue("v1.1");
p1.addChild(c1p1);
kSession.insert(p1);
kSession.fireAllRules();
So far so good.
The rules I have in my session are the following:
declare Parent
@propertyReactive
end
query getChildWithName(String $parentId, String $name, Child $child)
$child:= Child(parentId == $parentId, name == $name)
end
rule "Insert Children"
when
$p: Parent() @watch(!*)
$c: Child() from $p.children
then
System.out.println("Inserting child "+$c);
insert($c);
end
rule "Rule A"
when
$p: Parent(attribute2 != null)
?getChildWithName($p.attribute2, "n1", $child;)
then
System.out.println("FOUND: "+$child+". The attribute 'parentId' of this
object must have the value '"+$p.getAttribute2()+"'. Does it?
"+$child.getParentId()+" == "+$p.getAttribute2()+" ??");
globalList.add($child);
end
rule "Copy Attribute1 into Attribute2"
when
$p: Parent(attribute1 != null, attribute2 == null)
then
modify($p){
setAttribute2($p.getAttribute1())
}
end
The important part here is 'Rule A' and 'Copy Attribute1 into Attribute2'.
The latter copies the value of attribute1 to attribute2 for any Parent
object present in the session. (Note that the parent I'm inserting has
attribute2 = null). 'Rule A' is then using a query to get a Child object
that has a parent with id = $p.attribute2 (where $p is a previously matched
Parent).
Given that I only have 1 Parent in my session and that its id is '1' I
don't expect 'Rule A' to be activated/executed. When I modify
parent.attribute2 in 'Copy Attribute1 into Attribute2' I'm setting its
value to 'a1'. 'Rule A' (via the query) should then look for a Child with
parentid = 'a1' and It shouldn't find anything.
Funny thing is that 'Rule A' activates and fires. The child object that is
'returned' by the query has a parentId of '1' so I don't know how this
behavior is possible. If you take a look at the System.out output you will
see that the activation makes no sense at all.
Am I doing something wrong in my project? Is this a bug? Is this the
expected behavior?
Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com
10 years, 10 months
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.
10 years, 10 months
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.
10 years, 10 months
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.
10 years, 10 months