Guvnor: Accessing Bound Variable in "Then" Statement
by Vann_the_Red
Hello. I started with a search and didn't find an answer. I apologize if my
search-fu was lacking today.
I'm a non-developer tasked with rules creation and testing using guvnor. I
have found some scenarios where I can bind a variable to either the whole
input model or a fact in the input model and then later access those in the
output model by selecting "Bound Variable" from the popup box in the Then
statement. In other scenarios, "Bound Variable" is not an option (only
Literal or Formula). What must I do to be able to access the bound
variables from the When statement(s) in the Then statement(s)?
TIA,
Vann
This is a repost because I wasn't on the mailing list yet and I gather most
didn't see it. Apologies again.
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-Accessing-Bound-Variable-in-Then...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
Guvnor-5.5
by Ricardo
Is any one tried guvnor-5.5 in websphere application server?
What happen to the conponents.xml?
Why guvnor is tightly coupled with jbossAS even each version (jbossAS) got
separate war file?
this seems a big impediment for using guvnor as rule authoring tools.
Is one knows well aware these and already know how to deal this, please
advise me?
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-5-5-tp4022096.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
filtering object having max value
by mohan
Hi folks,
I want to filter object instance in WM when max value of an object field
(rental ) is less than X (reloadValue) . X will vary over time.
I tried to use below query but I couldn't get expected results. Could anyone
please help me?
Thanks.
--------------------------------------------
rule "Insuf-Balance-Reload Alert"
dialect "java"
when
$re : ReloadEvent($rechargeNum : rechargedNumber,$reloadVal :
reloadValue ) from entry-point "RELOAD-EVENT"
InsufBalFailFact(mobileNo == $rechargeNum,$reloadVal > rental, $pkgId :
pkgId,$rental : rental)
not InsufBalFailFact(mobileNo == $rechargeNum, rental > $rental)
then
System.out.println($rechargeNum+","+$pkgId +","+$rental);
end
--
View this message in context: http://drools.46999.n3.nabble.com/filtering-object-having-max-value-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Unable to resolve knowledgebase from classpath in JBoss 7 (VFS)
by dastraub
ClasspathKieProject isn't able to resolve knowledgebase from a JBoss 7
deployments :
17:34:02,419 INFO [stdout] (MSC service thread 1-5) kmodules:
vfs:/content/rtm-cep-impl.war/WEB-INF/classes/META-INF/kmodule.xml
17:34:39,089 ERROR
[org.drools.compiler.kie.builder.impl.ClasspathKieProject] (MSC service
thread 1-5) Unable to build index of kmodule.xml
url=vfs:/content/rtm-cep-impl.war/WEB-INF/classes/META-INF/kmodule.xml
null
To fix this (I have a presentation about a project prototype on monday ...),
I made the following changes:
After some NPE-Fixes in the same class, the ClasspathKieProject is able to
resolve the rules
--
View this message in context: http://drools.46999.n3.nabble.com/Unable-to-resolve-knowledgebase-from-cl...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Translate Drools to CLIPS rules
by Stadin, Benjamin
Hi,
I'm interested in possibilities to convert (one-way) Drools to CLIPS rules. I've followed the discussion about the canceled support for the CLIPS parser in Drools ("Drools Clips", last reply 2 Feb 2013). However, are there any options left to make a one-way conversion?
My interest in this is that I currently do a little research about how to fill the gap between central business rule engines and business process implementation and execution on smartphones / tablets (iOS, Android, Windows Phone 8). Currently I'm under the opinion that good old CLIPS could theoretically be a common denominator to enable common rule definition, and partial execution of these on mobile devices.
Regards,
Benjamin Stadin
13 years, 1 month
Drools 6.0.0.2 Beta uses different dependencies to antlr version
by dastraub
mvn dependency:tree
...
INFO] +- org.drools:drools-compiler:jar:6.0.0.Beta2:provided
[INFO] | +- org.drools:drools-core:jar:6.0.0.Beta2:provided
[INFO] | | +- org.kie:kie-api:jar:6.0.0.Beta2:provided
[INFO] | | \- org.kie:kie-internal:jar:6.0.0.Beta2:provided
[INFO] | +- org.antlr:antlr-runtime:jar:3.3:provided
[INFO] | +- org.antlr:antlr:jar:3.3:provided
[INFO] | +- org.antlr:stringtemplate:jar:3.2.1:provided
[INFO] | +- antlr:antlr:jar:2.7.7:provided
Is this correct ?
As far as I know, antlr 2.7 and 3.3 has different package names, so it's not
a problem to use both versions.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-0-2-Beta-uses-different-depe...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
NullpointerException in Multithreading at KnowledgeBuilde
by Bojan Janisch
Hi everyone,
I'm using Drools in a multithreaded environment where I need to create multiple KnowledgeBuilders, which each contains a different rule. But if I want to add the rule to the builder I'm getting the following exception:
-----------------------------------------------------------------------
Exception in thread "ECJ Evaluation Thread 3" java.lang.NullPointerException
at org.drools.rule.builder.dialect.mvel.MVELDialect.addStaticPackageImport(MVELDialect.java:416)
at org.drools.rule.builder.dialect.mvel.MVELDialect.addStaticImport(MVELDialect.java:372)
at org.drools.compiler.DialectCompiletimeRegistry.addStaticImport(DialectCompiletimeRegistry.java:96)
at org.drools.compiler.PackageRegistry.addStaticImport(PackageRegistry.java:94)
at org.drools.compiler.PackageBuilder.processFunctions(PackageBuilder.java:1270)
at org.drools.compiler.PackageBuilder.processOtherDeclarations(PackageBuilder.java:1225)
at org.drools.compiler.PackageBuilder.mergePackage(PackageBuilder.java:1220)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:829)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:467)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:673)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:45)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34)
at rulevolution.RulEvolution.getSession(RulEvolution.java:195)
at rulevolution.RulEvolution.runDrools(RulEvolution.java:159)
at rulevolution.RulEvolution.evaluate(RulEvolution.java:106)
at ec.simple.SimpleEvaluator.evalPopChunk(SimpleEvaluator.java:259)
at ec.simple.SimpleEvaluator$SimpleEvaluatorThreadCG.run(SimpleEvaluator.java:341)
at ec.util.ThreadPool$PoolThread.run(ThreadPool.java:57)
-----------------------------------------------------------------------
I'm getting the same exception in each thread so I only copied thread 3.
The Code I'm using to initiate my Session is the following:
-----------------------------------------------------------------------
public synchronized StatefulKnowledgeSession getSession(byte[] array){
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newByteArrayResource(array), ResourceType.DRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (!errors.isEmpty()) {
for (KnowledgeBuilderError knowledgeBuilderError : errors) {
logger.log(Level.SEVERE, "error while parsing grammmars in "+knowledgeBuilderError.getResource().toString()+":: "
+ knowledgeBuilderError.getMessage());
}
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase.newStatefulKnowledgeSession();
}
-----------------------------------------------------------------------
This method is called for each Rule I create one time. The rules are created
automatically and are syntactically correct, here is an example:
-----------------------------------------------------------------------
import function de.fraunhofer.scai.bio.uima.droolutils.FactChecker.*;
import function de.fraunhofer.scai.bio.uima.droolutils.ODMAnswerManager.*;
global org.apache.uima.util.impl.JSR47Logger_impl log
global org.apache.uima.jcas.JCas aJCas
rule '2'
when
$0: CoreAnnotation(
label_0:getActivityProvenance().toString(),
getConcept().identifierSource.contains('de.cloud4health.odm.eprd.bodySide'))
$1: CoreAnnotation(
label_1:getActivityProvenance().toString(),
getConcept().identifierSource.contains('de.cloud4health.odm.eprd.anatomy'))
$2: NormalizedNamedEntity(
label_2:getConcept().getPrefLabel().value,
getConcept().identifierSource.contains('de.cloud4health.odm.eprd.anatomy'))
eval (hasSameInstance($0, $1, $2))
eval (areEqual($0, $1, $2))
then
int start = getStart($0,$1,$2);
int ende = getEnd($0,$1,$2);
String attribute = label_0+label_1+label_2;
log.log(Level.FINE, 'Inserted de.cloud4health.odm.eprd.itemGroup.anatomy');
insert(annotate(aJCas, 'de.cloud4health.odm.eprd.itemGroup.anatomy', attribute, start, ende, null, null));
end
-----------------------------------------------------------------------
I appreciate any help. Thank you.
Bojan
13 years, 1 month
Guvnor and DSL i18n
by abluesongbird
Does Guvnor 5.5.0.Final provide i18n for created DSLs? If not, might this be
an upcoming Guvnor 6 feature?
I have seen the i18n/l10n of Guvnor's main UI, via the locale parameter, and
this is great. To fully support international customers, though, we need to
extend this to the the DSL that is authored by and presented to the user.
By i18n of the DSLs, I mean that
1. a single DSL can be expressed many times, once for each (supported)
locale,
2. each DSL expression is stored with its locale, and
3. the correct DSL expression is retrieved, based on the user's locale.
I don't see this in the UI or the documentation. I did see this, though, in
the "Drools Introduction and General User Guide", under "4.7.1. Language
Expressiveness Enhancements":
"* Complete rewrite of DSL engine, allowing for full l10n"
This sounds intriguing, but I can find no other information online.
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-and-DSL-i18n-tp4024032.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month