Problem with update(fact)
by Felipe Piccolini
I know I already asked this in a previous email, but no answer and
diferent subject... so I'll ask again
I have an issue using update in 2 rules that update the same
object... a loop is created even when I try to
avoid the loop adding an extra condition to each rule... Im inserting
an ArrayList as a fact too, so I can check
the extra condition...
Can anyone tell me how to fix this?
Consider this:
//-------RULES-----------------------------
package cl.bluesoft.test
#list any import classes here.
import java.util.List
import java.util.ArrayList
import cl.bluesoft.test.rules.Fact
#declare any global variables here
rule "test update A"
salience 699
no-loop
when
$f : Fact($n: number > 0)
$list: ArrayList( this excludes "key1")
then
System.out.println("A-fact number1:"+$f.getNumber()+" list 1:"+$list);
$list.add("key1");
$f.setNumber($n + 1);
update ($f);
update ($list);
System.out.println("A-fact number2:"+$f.getNumber()+" list 2:"+$list);
end
rule "test update B"
salience 699
no-loop
when
$f : Fact($n: number > 1)
$list: ArrayList( this excludes "key2")
then
System.out.println("B-fact number1:"+$f.getNumber()+" list 1:"+$list);
$list.add("key2");
$f.setNumber($n + 1);
update ($f);
update ($list);
System.out.println("B-fact number2:"+$f.getNumber()+" list 2:"+$list);
end
//-------FACT-----------------------------
public class Fact implements Serializable {
private static final long serialVersionUID = 331627137981862975L;
private int number;
public Fact(int number){
this.number = number;
}
public Fact(){
this(0);
}
/**
* @return the number
*/
public int getNumber() {
return number;
}
/**
* @param number the number to set
*/
public void setNumber(int number) {
this.number = number;
}
}
//------TEST---------
public class TestUpdateFact implements Serializable {
private static final long serialVersionUID = -574789596641083743L;
/**
* @param args
*/
public static void main(String[] args) {
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
Package pkg = builder.getPackage();
....
WorkingMemory session = ruleBase.getStatefulSession();
...etc etc...
List list = new ArrayList();
Fact fact1 = new Fact(1);
session.fireAllRules();
....etc, etc...
}
}
//--------OUTPUT------------
A-fact number1:1 list 1:[]
A-fact number2:2 list 2:[key1]
B-fact number1:2 list 1:[key1]
B-fact number2:3 list 2:[key1, key2]
A-fact number1:3 list 1:[key1, key2]
A-fact number2:4 list 2:[key1, key2, key1]
B-fact number1:4 list 1:[key1, key2, key1]
B-fact number2:5 list 2:[key1, key2, key1, key2]
A-fact number1:5 list 1:[key1, key2, key1, key2]
A-fact number2:6 list 2:[key1, key2, key1, key2, key1]
B-fact number1:6 list 1:[key1, key2, key1, key2, key1]
B-fact number2:7 list 2:[key1, key2, key1, key2, key1, key2]
A-fact number1:7 list 1:[key1, key2, key1, key2, key1, key2]
A-fact number2:8 list 2:[key1, key2, key1, key2, key1, key2, key1]
B-fact number1:8 list 1:[key1, key2, key1, key2, key1, key2, key1]
.... for ever.....
So I have a loop... only when I use update and both rules...
condition about the
list not containing "key1" and "key2" seems not properly chequed... I
dont know...
Can somebody help me? Am I missing something here?
Thanks.
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 5 months
Help with MR3
by s erel
Hello,
I've just started integrating MR3 into my project (I've previously
used 3.06). The
drl compiles and everything seems fine, but during
tests the following exception is thrown for time to time:
java.lang.ArrayIndexOutOfBoundsException: 17
at org.drools.util.AbstractHashTable$HashTableIterator.next(
AbstractHashTable.java:250)
at org.drools.reteoo.Rete$ObjectTypeConf.buildCache(Rete.java:434)
at org.drools.reteoo.Rete$ObjectTypeConf.getObjectTypeNodes(Rete.java:425)
at org.drools.reteoo.Rete.assertObject(Rete.java:172)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
at
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(
ReteooWorkingMemory.java:163)
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(
AbstractWorkingMemory.java:1135)
at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:781)
at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:584)
at org.drools.jsr94.rules.StatefulRuleSessionImpl.addObject(
StatefulRuleSessionImpl.java:162)
This only happens during high load tests.
Can anyone help me?
Thanks
17 years, 5 months
Running Drools on Sun Portal Server 7
by Tom Finlayson
Folks,
I'm having an issue running Drools 3.0.5 on Sun Portal Server 7. When our
rules are loaded and compiled, they come back as being invalid. Debugging
reveals this is because the consequence is null. As such, addRule in
AbstractRuleBase throws the following exception:
java.lang.IllegalArgumentException: The rule called Test Rule is not valid.
Check for compile errors reported.
This is very similar to a previously reported issue however all our rules
work fine under Eclipse when running JUnit. Additionally they have been
successfully run when deployed as a servlet to Sun Application Server 8.1.
This suggests the problem is due to classloading issues in the Portal
environment.
Has anyone else experienced this issue or can suggest a fix?
Cheers,
Tom Finlayson
17 years, 5 months
Retrieve a package from rule base
by Natraj Gudla
Hi Mark,
I could not find a method which would return a package object given a name
from a rule base. All that we have is the getPackages() method which returns
an array. Incases when i want to get a given package, i am forced to iterate
over the array checking for a given package name.
It would be a nice feature to have a getPackage() accepting a name and
returning a package object against it. As a work around i have extended the
ReotooRuleBase to add a new method which will do this. In turn i can have my
app use the new rule base. I am sure extending a rule base is not so
recommended.
Pl let me know the feasibility of this change. If required i can raise a
JIRA on this.
Thanks
Natraj Gudla.
17 years, 6 months
Problem while using the global - Drools 3.0.6
by Natraj Gudla
Hello,
I am using Drools 3.0.6. While using a global variable in a function, the
compiler complains it cannot resolve the global variable name. Something
like below
*
global* com.*sample*.ExampleLogger *customLogger*;
*
function* *void* logMessage(String msg){
customLogger.logMessage("Log Message from the function");
}
In the above code, it complains "customLogger cannot be resolved". I am able
to refer the global in the consequence of a rule directly. What is the
problem using the reference within a function.
On the other hand, i am able to do something like
* *
function *void* logMessage(ExampleLogger custLogger,String msg){
custLogger.logMessage(msg+" Accept gloabal as function parameter");
}
and call from the consequence of a rule : logMessage(customLogger); // I am
passing the global to the function as an argument and then use it to log a
message.
This way is working. But not the first way of using the global in the
function.
Any help??
Thanks
--
Natraj Gudla
17 years, 6 months
rete changing !!
by hypnosat7
What's the difference between the three expressions : (because I'm seeing the
rete tree changing when I change my expression) :
$ct : ControleTechnique(resultat == ControleTechnique.KO);Voiture(ct ==$ct)
and
$ct : ControleTechnique(resultat == ControleTechnique.KO) Voiture(ct ==$ct)
and
$ct : ControleTechnique(resultat == ControleTechnique.KO)
Voiture(ct ==$ct)
Thanks
--
View this message in context: http://www.nabble.com/rete-changing-%21%21-tf4024937.html#a11432535
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 6 months
4.0.0.MR3 Problems
by Ronald R. DiFrango
All,
I am in the process of migrating my 3.0. project to the 4.x series and when
I attempt to run my code I get the following exception when I attempt to
load my .drl files:
Caused by: org.drools.RuntimeDroolsException: Unable to load dialect '
org.drools.rule.builder.dialect.java.JavaDialect:java'
Here is my package builder code:
static
{
try
{
builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader(
RtvDecisionEngine.class.getResourceAsStream("rtv.drl" ) ) );
builder.addPackageFromDrl( new InputStreamReader(
RtvDecisionEngine.class.getResourceAsStream("modelDiscrepancyRules.drl" ) )
);
ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( builder.getPackage() );
}
catch(Exception e)
{
throw new RuntimeException("Failure loading the Rules", e);
}
}
Any thoughts appreciated.
Ron
17 years, 6 months
2nd CfP RuleML-2007, Springer Confirmed, Submission Deadline Extended to July 20th
by Adrian Paschke
[Apologies if you receive this more than once]
The International RuleML Symposium
on Rule Interchange and Applications (RuleML-2007)
October 25-26, 2007, Orlando, Florida
http://2007.ruleml.org
Dear Colleagues,
Due to numerous requests about conflicting deadlines, and with Springer
as confirmed publisher, online submissions to RuleML-2007 will be
allowed until July 20 (hard deadline):
Abstract submission before July 10, 2007
Paper submission due July 20, 2007
Notification of acceptance August 6, 2007
Final submissions due August 23, 2007
The International RuleML Symposium on Rule Interchange and Applications
(RuleML-2007) will take place, October 25-26, 2007, in Orlando, Florida
http://2007.ruleml.org, co-located with The 10th International Business
Rules Forum <http://www.businessrulesforum.com>. RuleML-2007 is devoted
to practical distributed rule technologies and rule-based applications
which need language standards for rules operating in the context of,
e.g., the Semantic Web, Web 2.0/3.0, Intelligent Multi-Agent Systems,
Event-Driven Architectures, Service-Oriented Computing Applications and
Rule-based Enterprise Application Systems. A RuleML-2007 Challenge with
prizes will be organized to demonstrate tools, use cases, and applications.
Call for Papers: http://2007.ruleml.org/cfp.pdf
Highlights:
- Accepted papers will be published as Springer LNCS proceedings
- 2 Keynote speakers; Confirmed Keynote by Jürgen Angele (Ontoprise):
"Rule-based Development Support in the Automotive Industry"
- In cooperation with ECCAI (confirmend) and IEEE Computer TCAAS
- Selection of revised papers will be resubmitted to a special journal issue
- Best Paper Award
- Prestigious prizes will be awarded to the first two best applications
of the Challenge
- Panel by world-class scientists and practitioners, featuring topics on
event and rule-based computing and industry success stories
Updates:
1) Modified Challenge Requirements:
"Submissions to the RuleML Challenge 2007 consist of a demo paper of 3-5
pages, describing the demo show case, and a link to more information
about the demo/show case, e.g. a project site, an online demonstration,
a presentation about the demonstration, or a download site for the
demonstration.
The show case should demonstrate the use of rules of various kinds in
interesting and practically relevant ways, preferably (but not
necessarily) embedded into a Web-based or distributed environment."
More information regarding submissions can be found in the RuleML-2007
web site:
http://2007.ruleml.org/index-Dateien/Page787.htm
2) Enhanced Topics:
- Rules in Web 2.0 and Web 3.0
- Rules in Semantic Web Technologies
- Rules in Web Intelligence Research
We invite submissions of full, short and demo papers related (but not
limited) to one or more of the topics listed at:
http://2007.ruleml.org/index-Dateien/Page431.htm
3) All papers and demos will be carefully peer-reviewed by 3 PC
members of the Program Committee:
http://2007.ruleml.org/index-Dateien/Page508.htm
Sincerely,
General Chair
Said Tabet, Inferware Corp.
stabet AT ruleml.org
Program Co-Chairs
Adrian Paschke, Technical University Munich, Germany
paschke AT in.tum.de
Yevgen Biletskiy, University of New Brunswick, Canada
biletski AT unb.ca
Challenge Co-Chairs
Alexander Kozlenkov, Betfair Ltd., London, UK
alex.kozlenkov AT betfair.com
Ralph Hodgson, TopQuadrant, Inc., Mountain View, USA
rhodgson AT topquadrant.com
Panel Chair
John Hall, Model Systems, UK
john.hall AT modelsys.com
Publicity Chair
Suzette Stoutenburg, MITRE Corporation, USA
suzette AT mitre.org
17 years, 6 months