generic properties
by thomas kukofka
Hello ,
I just recognized, that this doesn't work. But it is possible to use plain
Java code in the rule, also if-conditions and for and while-loops etc..
However more Java code makes the rule less readable and elegant.
Is there another possibility to use generic input objects?
Thomas
16 years, 5 months
Problems building Package
by thomas kukofka
Hello,
I get the following Nullpointer exception when building the package:
java.lang.NullPointerException
at
org.drools.rule.AbstractCompositeRestriction.getRequiredDeclarations(AbstractCompositeRestriction.java:29)
at
org.drools.rule.MultiRestrictionFieldConstraint.getRequiredDeclarations(MultiRestrictionFieldConstraint.java:27)
at org.drools.rule.Pattern.setConstraintType(Pattern.java:279)
at org.drools.rule.Pattern.addConstraint(Pattern.java:157)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:340)
at
org.drools.rule.builder.PatternBuilder.buildConstraint(PatternBuilder.java:199)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:168)
at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:93)
at
org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:69)
at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:53)
at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:446)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:304)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)
at
com.dssrules.RuleEngineAdapter.initRuleBase(RuleEngineAdapter.java:71)
at
com.dssrules.TestRuleEngineAdapter.main(TestRuleEngineAdapter.java:17)
Exception in thread "main" java.lang.NullPointerException
at com.dssrules.RuleEngineAdapter.insert(RuleEngineAdapter.java:42)
at
com.dssrules.TestRuleEngineAdapter.main(TestRuleEngineAdapter.java:35)
Debugging shows the programm get stuck in this line (the resource drl-file
was found):
* builder0.addPackageFromDrl(new
InputStreamReader(resource.getInputStream()));
I have further the error message: Missing package name for rule package."
Although the package declaration in the drl-file should be ok, it worked in
the previous drl version. I don't know why it doesn't work anymore.
Regards
Thomas
*
16 years, 5 months
Accessing Hashmap values and keys in LHS
by thomas kukofka
Hello,
I have a Hashmap<String, Double> hm as Input and want to execute the rule
for each key respectively value.
when
hm: HashMap()
value: Number() from hm.values()
key: String() from hm.keySet()
then ...
But unfortunately it doesn't work like this. Any ideas?
Regards
Thomas
16 years, 5 months
Measuring Drools Memory Usage
by Roger Tanuatmadja
Hi,
Has anyone attempted to measure the incremental memory usage of using
Drools? Anyone cares to share their methodology?
I am currently following the following methodology:
1. Prevent garbage collection from happening by using large Xms Xmx (1024m
in my case), a NewRatio of 2 (I am sure other sizes will work as well) and
verbogegc enabled to confirm that no garbage collection is happening.
2. Use Runtime.freeMemory before and after fireAllRules and measuring the
difference.
The problem with my methods so far has been that after a positive memory
usage (indicating you are using memory), subsequent use case (the same one)
incurs zero memory usage which is very strange.
So I guess my question is 2 fold: anyone care to share their methodology,
and can anyone see what's wrong with mine?
Thanks,
Roger
16 years, 5 months
enums
by thomas kukofka
Hi,
I tried this. No problem at all.
I can use enums also like this:
io: InputObject(type == InputObject.Parameter.PARAMETERNAME)
Only this causes the error:
private HashMap<Parameter, String> stringParameters;
public HashMap<Parameter, String> getStringParameters() {
return stringParameters;
}
public void setStringParameters(HashMap<Parameter, String> stringParameters) {
this.stringParameters = stringParameters;
}
*
io: InputObject (
stringParameters[InputObject.Parameter.ParameterName] ==*
*"something") -**> Field/method 'InputObject' not found for class
'com.rules.InputObject'Rule
*>* Compilation error**
*
If I use String instead of Parameter it works again:
private HashMap<String, String> stringParameters;
* io: InputObject ( stringParameters["somestring"] ==* *"something") *
Thomas
*Scott Reed*
sreed at avacoda.com
<rules-users%40lists.jboss.org?Subject=%5Brules-users%5D%20enums&In-Reply-...>
*Mon Jul 28 09:10:48 EDT 2008*
Try a simple rule that just checks for any InputObject to make sure you
have the class imported correctly.
Rule "x"
when
InputObject()
then
end
thomas kukofka wrote:
>* Hello,
*>*
*>* If have an input object Inputobject which contains an enum
Parameter which contains all allowed parameters of InputObject:
*>*
*>*
*>* The entries for the parameters are stored in a map:
*>* private HashMap<Parameter, String> stringParameters;
*>*
*>* If I try:
*>* io: InputObject ( stringParameters[InputObject.Parameter.ParameterName] ==
*>*
*>*
*>* "something")
*>*
*>* I got the error
*>* =>Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule
*>* Compilation error
*>*
*>* Kind Regards
*>* Thomas*
16 years, 5 months
query or global
by thomas kukofka
Hello again,
what are disadvantages and advantages of the following possibillities to to
get access to working memory facts from outside:
- -uses a query:
in drl:
query "queryname"
...
end
in java code
queryResults results = workingMemory.getQueryResults( "queryname" );
- -use globals that store facts:
global java.util.HashMap service
rule "XY"
when
f: FactX ()
then
ResultFact resultFact = new ResultFact();
service.put(f.getName(), resultFact);
insert(resultFact);
end
kind regards
tom
16 years, 5 months
database access via JDBC
by thomas kukofka
Hello,
is it possible to access a database from within the rule file via JDBC?
I only read about access via Hibernate. Is there any JDBC example?
regards
Tom
16 years, 5 months
enums
by thomas kukofka
Hello,
If have an input object Inputobject which contains an enum Parameter
which contains all allowed parameters of InputObject:
The entries for the parameters are stored in a map:
private HashMap<Parameter, String> stringParameters;
If I try:
io: InputObject ( stringParameters[InputObject.Parameter.ParameterName] ==
"something")
I got the error
=>Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule
Compilation error
Kind Regards
Thomas
16 years, 5 months
Function import problem in BRMS
by Poornima
Hi All,
I am still a novice in using jboss BRMS web based tool, i have a
question regarding static function imports. I have added rule file using
technical rule-text editor.
Any function imports added to this file gives validation errors, with
error message "unknown:4:0 mismatched token" and there is no option to
add import
function in package header. How am i suppose to use static function
imports from a helper class when BRMS web based tool is used?
Thanks a lot.
Poornima.
--
regards,
* Poornima P S
Openstream Technologies (India) Private Limited
#13, 30th cross, Thilak Nagar Main Road,
Jayanagar (E), Bangalore - 560 041
Tel: +91-80-26545713 Extn:215
Fax: +91-80-26657928
* www.openstream.com <http://www.openstream.com>
16 years, 5 months
what does drools-verifier use for
by 周进刚
Hi,
I've found that a subproejct named drools-verifieer in the Drools source proejct,
what does this module use for?
Thanks
Robin
----------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) is intended only for the use of the intended recipient and may be confidential and/or privileged of Neusoft Group Ltd., its subsidiaries and/or its affiliates. If any reader of this communication is not the intended recipient, unauthorized use, forwarding, printing, storing, disclosure or copying is strictly prohibited, and may be unlawful. If you have received this communication in error, please immediately notify the sender by return e-mail, and delete the original message and all copies from your system. Thank you.
-----------------------------------------------------------------------------------------------
16 years, 5 months