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.
12 years, 9 months
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.
12 years, 9 months
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
12 years, 9 months
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.
12 years, 9 months
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
12 years, 9 months
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.
12 years, 9 months
Error during fetching rules via REST API
by abhinay_agarwal
Hi,
I am trying to access guvnor(on tomcat) through my application(on websphere)
through a rest API call using "HttpURLConnection", but when i use
connection.connect();
it throws me the following error. Any idea about this error or which jar
might I be missing,
java.lang.NoClassDefFoundError: org.drools.util.ServiceRegistryImpl
(initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:145)
at
org.drools.builder.KnowledgeBuilderFactory.loadServiceFactory(KnowledgeBuilderFactory.java:130)
at
org.drools.builder.KnowledgeBuilderFactory.getKnowledgeBuilderServiceFactory(KnowledgeBuilderFactory.java:124)
at
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:46)
Regards,
Abhinay
--
View this message in context: http://drools.46999.n3.nabble.com/Error-during-fetching-rules-via-REST-AP...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 9 months
Guvnor 6.0 User Security
by Dean Whisnant
Maybe it's too early to ask this question, but in reviewing 6.0 beta 2 I didn't see how user security would be managed.
In 5.1.1 we have 100+ packages with 100+ users assigned various roles from read only to authoring. Our packages are hierarchical in that we have an overarching and intermediary set that everyone can view, and then individual packages that a user may have authoring privileges.
Is there a similar sense in the new framework?
Thanks
Dean
12 years, 9 months