Stateless session and rule flows
by Yoni Mazar
Hi Guys,
We are trying to work with drools with stateless session (Sequential) and to
apply rule flows.
we use the following code:
//define diagnosis and patient here
...
StatelessSession session = ruleBase.newStatelessSession();
//Here we would like to use: session.startProcess("ruleflow id") but this is
a method which belongs to
//StatefullSession only.
session.execute(new Object[] {diagnosis, patient});
How can we do that in steteless mode?
Thanks,
Yoni
--
View this message in context: http://www.nabble.com/Stateless-session-and-rule-flows-tp17863849p1786384...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 months
problem escaping quote in eval
by samlotti
Hello,
I'm trying to construct a rule in drool V4 that contains and eval and a
literal string that may contain quotes. I've tried escaping the quote but
get the error below. The \" works outside an eval.
rule "evalList2"
when
Var( eval( "tt".equals("t\"t")))
then
System.out.println( "evalList2" );
end
Error:
java.lang.NullPointerException:
at
org.drools.rule.PredicateConstraint.createContextEntry(PredicateConstraint.java:201)
at org.drools.reteoo.AlphaNode.createMemory(AlphaNode.java:230)
...
It looks like a change was made to V3 to fix this but doesnt appear to work
in V4, does anyone know how to construct this type of rule?
Thanks
Sam
--
View this message in context: http://www.nabble.com/problem-escaping-quote-in-eval-tp19186015p19186015....
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 months
Drools 4.0.7 - Rules not fired
by Benoit VILLAUMIE
Hello,
I am using Drools engine 4.0.7 and Eclipse 3.3 drools plugin.
I have a very basic/dumb problem but I do not understand where my error is :
I have 2 rules
---------------------------------
package poc
import poc.FlashFact;
*rule "HP one"*
when
FlashFact( homepage == "one");
then
System.out.println("*** HP one");
end
*rule "HP commons"*
when
FlashFact();
then
System.out.println("*** HP commons ");
end
----------------------------------
I insert a FlashFact which homepage is set with "one" value.
In my understanding, both rules "HP one" and "HP commons" should be
fired. Instead, only "HP commons" is launched. I have compared with the
Drools State example (which works fine), but I do not notice nothing.
Thanks for your help.
The code of the FlashFact class
---------------------------------
package poc;
public class FlashFact {
public FlashFact() {
this(null);
}
public FlashFact(String homepage) {
this.setHomepage(homepage);
}
private String homepage;
/**
* @return the homepage
*/
public final String getHomepage() {
return this.homepage;
}
/**
* @param homepage the homepage to set
*/
public final void setHomepage(String homepage) {
this.homepage = homepage;
}
}
---------------------------------
The code of the launcher
---------------------------------
package poc;
import java.io.InputStreamReader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.audit.WorkingMemoryFileLogger;
import org.drools.compiler.PackageBuilder;
public class FlashUndeployedRulesMain {
public static void main(String[] args) throws Exception {
StatefulSession session = null;
WorkingMemoryFileLogger logger = null;
try {
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new InputStreamReader(
FlashUndeployedRulesMain.class.getClassLoader()
.getResourceAsStream(RULE)));
final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
session = ruleBase.newStatefulSession();
logger = new WorkingMemoryFileLogger(
session);
logger.setFileName("log/flash");
// inserting facts
FlashFact HPFrance = new FlashFact("one");
session.insert(HPFrance);
session.fireAllRules();
} finally {
if(session != null) {session.dispose();}
if(logger != null) {logger.writeToDisk();}
}
}
private static final String RULE = "poc/Flash.drl";
---------------------------------
15 years, 7 months
using matches in a collection
by ygaurav
Hi All
i am new to drools and I am hoping that some body can help me out here.
I data in string array and I would like to check if one of the entry starts
with the string I have. How can check it ?
Code is shown below
@java
class ABC {
String[] array = new String[]{"abcdef","ghijkl","mnopqrst"}
}
@drools
rule "check something"
when
$abc : ( ABC.array contains a single entry which start with "abc" )
Is there a way I can do it ? If it is not possible what is way I can achive
it
Thanks
--
View this message in context: http://www.nabble.com/using-matches-in-a-collection-tp18115893p18115893.html
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 months
JBoss Rules as a Daemon Service
by Arjun Dhar
Hi,
I uploaded the JBoss Rules 4 WAR; I saw the repository options but no admin
console to run a service. Maybe I'm missing something?!?!
Q) Being under the cover of the JBoss server am sure there must be some
fascility to run this as a daemon service 'out of the box'! Right?? <--
Important
(posted this 3 days ago but it got lost somwhere; prob deleted the approval
mail; FYI not being impatient :o) but its important so would like to know)
Thanks!
15 years, 9 months
Localization in DSL
by Shigeaki Wakizaka
Hello.
I'd like to use Japanese in DSL.
Is it possible?
Do you have a plan to do the localize-thing with DSL and
brand-new BRMS?
Thanks in advance
Shige
15 years, 9 months
Adding Rules and Packages to existing rule base (4.0.7)
by cfili
What is the proper way to add rules to existing packages that are already
part of a rule base?
When adding rules to the package directly, those rules are listed in the
rule base however they do not seem to be "active" and will never trigger. I
get the same results if I add rules to a package that was created by the
PackageBuilder but not part of an existing rule base. Allowing Drools to
"merge" the packages also seems to yield a similar result where the first
set of rules are active, but what was added later or merged will not be
active.
I know that this type of activity is supported I just want to make sure I do
it the right way.
Thanks.
--
View this message in context: http://www.nabble.com/Adding-Rules-and-Packages-to-existing-rule-base-%28...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 11 months
how to specify classpath dependencies in .drl files.
by Godmar Back
My question is how to manage a rule base that is composed from sets of
rules drawn from different sources.
Our goal is to supply sets of rules as .jar files - each .jar file
containing a related set of rules. For instance, consider an expert
system where different experts could export their expertise in such a
jar file. Such a .jar file would contain one or more .drl files and a
set of supporting .java classes. We'd like to be able to refer to
these .jar files using a URLClassLoader and/or JarURLConnection so
they can be referred to without a user having to download them prior
to starting their application.
Users should be able to combine those provided rules (that is, the
rules of those experts whose knowledge they wish to exploit) with
their own rules in their own .drl files.
My question is whether drools supports such a setup easily.
Specifically, is there a way for a user to import external .jar files
in their .drl files? A statement such as
use jar:http://expertbase.com/expert1/knowledge5.jar
which would instruct the rule compiler to load the classes from this
jar to its compile class path, and which would instruct the class
loader used to load the user's classes to delegate to the loader used
to load the jar file's classes? [Note that a given expert's knowledge
should only be loaded by one classloader.]
I browsed through the API and discovered that the package builder
configuration allows the specification of a class loader. Does this
mean the rule compiler will attempt to load related classes through
this loader as well? If so, it would need to use reflection to examine
those classes (which I'd find unlikely). If not, is there a way to
control the rule compiler's compiler classpath?
In our current prototype, we need to load everything through the
application classpath to avoid compile errors.
- Godmar
15 years, 11 months
Independent rule evaluations
by Yuri
Considering that I have a set of rules that can be time consuming to assert is
there a way to separate them from other rules without having to resort to
multiple working memories?
I basically want to be able to assert facts and evalute a set of rules as fast
as I can before actually having the time consuming set of rules evaluate.
thanks,
16 years, 1 month