Re: [rules-users] Conflict Resolvers in 5.0 M5

2009-02-04 Thread Mark Proctor

Dan Seaver wrote:

I'm in the process of upgrading drools from 4 to 5.0 M5 and ran into a
problem with setting the conflict resolver priority order. It doesn't appear
that KnowledgeBaseConfiguration supports the ability to use ConflictResolver
or CompositeConflictResolver as the old RuleBaseConfiguration did. How are
alternate agenda priorities handled in 5?
  
heh, didn't imagine anyone was actually using a conflict resolver :) We 
will migrate this to drools-api, but for 5.0 we are just trying to be as 
conservative as possible. As long as you don't mind using some potential 
going to change apis you can still do this.


If you look KnowledgeBaseConfiguration, for now, can be cast to 
ruleBaseConfiguration, so you can actually still set this, just be aware 
that it's been deprecated.


Mark




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] How to Handle Decision Table (XSL files) in Drools version 4.0.7

2009-02-04 Thread Hong-Qiang Gao
Is there a better way to handle Decision Table (XSL files) with Drools
version 4.0.7?

 

In Drools 2.1, I can do the following;

 

file = new File(dir, XSL_filename);

 InputStream stream = null;

 RuleBase ruleBase = null;

 WorkingMemory wm = null;

try {

stream = new FileInputStream(file);

} catch{...

}

try{

ruleBase = DecisionTableLoader.loadFromInputStream(stream);

WorkingMemory wm = ruleBase.newWorkingMemory();

} catch{ ...

}

 

In Drool 4.0.7, I tried the following  

 

file = new File(dir, XSL_filename);

 InputStream stream = null;

 RuleBase ruleBase = null;

try {

stream = new FileInputStream(file);

} catch{...

}

try{

ruleBase = RuleBaseFactory.newRuleBase();

PackageBuilder builder = new PackageBuilder();

SpreadsheetCompiler sCompiler = new SpreadsheetCompiler();



String drl = sCompiler.compile(stream, InputType.XLS);

builder.addPackageFromDrl(new StringReader(drl));

ruleBase.addPackage(builder.getPackage());



WorkingMemory wm = ruleBase.newStatefulSession();

} catch{ ...

}

 

 

Thanks,

 

Hong

 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools-solver -- solution questions

2009-02-04 Thread Andrew Waterman

Hello,

I'm starting to work with the drools-solver to help on a gaming  
project.  Basically, we have a game that works in two modes:  1) a  
competitive game where humans (or agents) compete with one another on  
a well defined game board to achieve 24 points by using three (or  
four) agricultural development tokens.  2.  A puzzle, where all 4  
players work cooperatively to create an equitable solution, where all  
4 players win with at least 24 points by means of our agricultural  
development tokens.


I am starting to work with drools-solver to address the puzzle part of  
our game.  Basically, we are interested in having the solver do two  
things for us:  a)  find the optimal solution for our game/puzzle,  
based upon our requirements [this part seems quite straightforward]  
and b) getting  the total number of solutions that satisfy our  
constraints.  We would like, as well, to be able to inspect these  
other, sub-optimal, solutions, in order to explore our game and puzzle  
further.  From my reading of the "Solver" API , it looks like we will  
only be able to get the optimal solution.  Does anyone have any  
suggestions for a workaround in this case?  Or is there some  
functionality in the solver that I am missing?


I look forward to your feedback.

best wishes,

Andrew

-
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico








___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] problem in Maven tests: class antlr CharStream not found, although it is there!

2009-02-04 Thread Edson Tirelli
You need antlr-runtime jar in your classpath, although maven should get
it as a transitive dependency.

Try running:

mvn help:effective-pom

That will show you what maven is using as pom after resolving
dependencies. If antlr-runtime jar is not there or if you have the wrong
version, that would be the problem.

[]s
Edson

2009/2/4 tim tim 

> hello all
>
> my problem is that my tests work fine in eclipse, but they
> don't work in maven.
>
> when i execute my code via
>
> mvn test
>
> drools cant find the antl CharStream class.
>
> this is the error i get:
>
> java.lang.NoClassDefFoundError: org/antlr/runtime/CharStream
>at
> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:276)
>at
> com.hikuku.rules.util.TestHelperRules.getPackage(TestHelperRules.java:85)
>at
> com.hikuku.rules.util.TestHelperRules.readRules(TestHelperRules.java:48)
>at
> com.hikuku.rules.util.TestHelperRules.readRules(TestHelperRules.java:67)
>at
> com.hikuku.rules.TestMemoryInsertRetract.insertRetract(TestMemoryInsertRetract.java:126)
>at
> com.hikuku.rules.TestMemoryInsertRetract.testInsertRetractAlldifferent(TestMemoryInsertRetract.java:84)
> Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.CharStream
>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)
>... 32 more
>
>
>
> i have the antlr3.jar in my dependencies via the drools-compiler  pom.xml
> and the class  org.antlr.runtime.CharStream is definitely in the classpath.
> i can use it from my own code without problems.
>
> but the drools package builder does not seem to find it.
>
> this works (even under maven):
>
> final int a = org.antlr.runtime.CharStream.EOF;
>
> but this doesn't find CharStream:
>
> PackageBuilder builder = new PackageBuilder();
> builder.addPackageFromDrl(r);
>
>
> this is my dependency on drools as i have it in my pom:
>
>
>org.eclipse.jdt
>core
>3.4.2.v_883_R34x
>
>
>
>janino
>janino
>2.5.10
>
>
>
>org.drools
>drools-core
>5.0.0.SNAPSHOT
>
>
>org.drools
>drools-api
>5.0.0.SNAPSHOT
>
>
>org.drools
>drools-compiler
>5.0.0.SNAPSHOT
>
>
>
> the snapshot i use is the drools-5.0.0.20090203.112022-386
>
>
> does anyone have an idea what the problem might be?
>
> thanks, tim
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Conflict Resolvers in 5.0 M5

2009-02-04 Thread Dan Seaver

I'm in the process of upgrading drools from 4 to 5.0 M5 and ran into a
problem with setting the conflict resolver priority order. It doesn't appear
that KnowledgeBaseConfiguration supports the ability to use ConflictResolver
or CompositeConflictResolver as the old RuleBaseConfiguration did. How are
alternate agenda priorities handled in 5?

-- 
View this message in context: 
http://www.nabble.com/Conflict-Resolvers-in-5.0-M5-tp21840939p21840939.html
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] problem in Maven tests: class antlr CharStream not found, although it is there!

2009-02-04 Thread tim tim
hello all

my problem is that my tests work fine in eclipse, but they
don't work in maven.

when i execute my code via

 mvn test

drools cant find the antl CharStream class.

this is the error i get:

java.lang.NoClassDefFoundError: org/antlr/runtime/CharStream
at 
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:276)
at 
com.hikuku.rules.util.TestHelperRules.getPackage(TestHelperRules.java:85)
at 
com.hikuku.rules.util.TestHelperRules.readRules(TestHelperRules.java:48)
at 
com.hikuku.rules.util.TestHelperRules.readRules(TestHelperRules.java:67)
at 
com.hikuku.rules.TestMemoryInsertRetract.insertRetract(TestMemoryInsertRetract.java:126)
at 
com.hikuku.rules.TestMemoryInsertRetract.testInsertRetractAlldifferent(TestMemoryInsertRetract.java:84)
Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.CharStream
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)
... 32 more



i have the antlr3.jar in my dependencies via the drools-compiler  pom.xml
and the class  org.antlr.runtime.CharStream is definitely in the classpath.
i can use it from my own code without problems.

but the drools package builder does not seem to find it.

this works (even under maven):

 final int a = org.antlr.runtime.CharStream.EOF;

but this doesn't find CharStream:

 PackageBuilder builder = new PackageBuilder();
 builder.addPackageFromDrl(r);


this is my dependency on drools as i have it in my pom:


org.eclipse.jdt
core
3.4.2.v_883_R34x



janino
janino
2.5.10



org.drools
drools-core
5.0.0.SNAPSHOT


org.drools
drools-api
5.0.0.SNAPSHOT


org.drools
drools-compiler
5.0.0.SNAPSHOT



the snapshot i use is the drools-5.0.0.20090203.112022-386


does anyone have an idea what the problem might be?

thanks, tim
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users