Importing drl into BRMS
by Ojwang Wilson O
Need help on how one can do the following within drools 4.0.7 BRMS:
1. import DRL files into drools 4.0.7 BRMS
2. build package (*.pkg) from the imported DRL
3. Deploy the package (*.pkg) to a specified URL.
Thanks in advance for your professional help.
Regards
Wilson
15 years, 11 months
I am not sure if this is Bug in Guvnor - Please help
by Ashish Soni
Hi All ,
I have defined a function name *join *using guvnor guided editor which is
mentioned below
function String join(String firstname , String lastname) {
return firstname + " " + lastname;
}
then i created rule using guided editor which make use of the function and
when i validate the rule is validates successfully
rule "persontest"
dialect "mvel"
when
p : Person( firstname != "" && lastname != "" )
then
p.setFullname( join(firstname,lastname) );
end
now i created a test scenario for testing the rule which is like below
GIVEN
insert Person
firstname =Sujit
lastname =Sharma
EXPECT
fullname = Sujit Sharma
and when i run the test i am getting below error
[p] field [fullname] was [] expected [Sujit Sharma ]
Please help.
Regards,
Ashish
15 years, 11 months
Re: retract the items from accumulate
by niraj manandhar
Dear Sir
Thanks for the answer by the way is there any way to slove my free item
problem .
I want to make a decison table in excel where my client will fill in the
item and free item list as
Purchased ITem No of purchase Free Item
No of free
==========================================================
Pen 2
Rubber 1
Pen 5
Pencil 1
Pen 10
Pencil 3
Pen 12
Pencil 4
Ink bottle 3
Sticker 1
Ink bottle 5
Sticker 2
Ink Bottle 10
Sticker 5
When a customer buys 19 pen then
his free item will be
4 pencil (due to first 12 pens)
5 pencil (due to remaining 5 pens)
1 rubber (due to 2 pens)
I have been trying to write the rule and fit into excel since from 1 week
but due to my limited knowledge of drl and decision tables in excel it is
taking a lot of time than writing code with lookup table and JAVA if else
Please help me to slove this riddle
Thanks
Niraj
15 years, 11 months
Getting facts from external source using 'from' and parametrized method call
by Przemysław Różycki
Hi,
could I ask for some advice, please, how to use a parametrized method
call to get some data using 'from' element in LHS.
To be more precise, I would like to do something like this:
rule "My Rule"
when
$fact : Fact( ) from factSource.getSomeFacts("a","b","c")
then
// do something
end
where factSource is for example some global and
getSomeFacts(String,String,String) is a parametrized method that returns
some array of Fact objects.
Unfortunately, when I try to launch the following rule I have an error:
Exception in thread "main" org.mvel.PropertyAccessException: unable to
resolve property: factSource.getSomeFacts("a","b","c")
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:295)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:110)
at
org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:26)
at
org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:70)
at
org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:24)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
at org.mvel.MVEL.executeExpression(MVEL.java:252)
at
org.drools.base.dataproviders.MVELDataProvider.getResults(MVELDataProvider.java:55)
at org.drools.reteoo.FromNode.assertTuple(FromNode.java:68)
at
org.drools.reteoo.SingleTupleSinkAdapter.createAndPropagateAssertTuple(SingleTupleSinkAdapter.java:55)
at
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:181)
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1312)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:915)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:684)
at com.sample.DroolsTest6.main(DroolsTest6.java:29)
Caused by: java.lang.NullPointerException
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:530)
at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:261)
... 21 more
Documentation says:
"The from Conditional Element allows users to specify a source for
patterns to reason over. This allows the engine to reason over data not
in the Working Memory. This could be a sub-field on a bound variable or
the results of a method call."
so I assume that it is possible to do what I want. If not, could I ask
for an advice of some workaround, please?
Best regards,
--
Przemysław Różycki
IT Architect
AMG.net, A Bull Group Company
ul. Łąkowa 29
90-554 Łódź
www.amg.net.pl
15 years, 11 months
retract the items from accumulate
by niraj manandhar
Can i retract the objects from accumulate function
rule "Brand base free Item "
salience 10
when
brand_total:Number(doubleValue >=1500)
from accumulate ( sa:SLS_SALES_DTLS(
PK!=null,
PK.ITEM_ID.BRAND_CD.BRAND_CD=="N00"
) , init ( double single_total=0; ),
action (single_total=single_total+(sa.getTRN_QTY()*
sa.getPK().getITEM_ID().getSALES_TO_BASE_CONV()
// I want to retract the sa over here
);
),
result (single_total ) );
then
double item_discounted=brand_total.doubleValue()/ 1500;
System.out.println("The discount given qty "+item_discounted+" multiplied
slot 10");
double item_left=brand_total.doubleValue()%1500;
if(item_left>=1)
{
doit(item_left,"N00");
}
end
15 years, 11 months
Help writing DRL
by niraj manandhar
I have following condition
buying 3 pen gives 1 free pencil
buying 5 pen gives 1 free rubber
buying 10 pen gives 1 free chocolate
so if some one buys 19 pen then his free items will be
1 chocolate due to 10 pen
1 rubber due to remaining (19-10) pen
1 pencil due to remaining (9-5) pen
I have objects of sales_details where trnqty is the quantity purchased how
to calculate the free items using drl
15 years, 11 months
Cannot load Dialect..
by Kiran Narasareddy
Hi,
I am a drools 4.0.7 user.
I am working on a drools project. The code works fine when I run it as a
standalone application in Eclipse(all the rules fire as required)
However , when I deploy the same code as a web service on Axis2, I get as
exception as follows :-
* org.drools.RuntimeDroolsException: Unable to load dialect
'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel'*
I have included all the necessary Libraries in the archive file( .aar) of my
service. Still it is giving me a exception .
The exception occurs when I try to compile my Decision table in the
following line of code...
final SpreadsheetCompiler *converter* = new SpreadsheetCompiler();
final String drl1 = converter.compile( excelFile, InputType.XLS );
....The SpreadsheetCompiler object i.e. *converter* is created while the
web service is running ie itz not null. hence i think the drools library is
accesible to the service..
Can please anyone help me out here....
Thanks in advance...
Kiran Narasareddy
Computers make very fast, very accurate mistakes.
15 years, 11 months
Rwhklctt
by Returned mail
Your message was not delivered due to the following reason:
Your message could not be delivered because the destination server was
unreachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.
Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.
Your message was not delivered within 6 days:
Host 26.187.1.57 is not responding.
The following recipients could not receive this message:
<rules-users(a)lists.jboss.org>
Please reply to postmaster(a)lists.jboss.org
if you feel this message to be in error.
15 years, 11 months
guvnor fails deployment to jboss 5.0
by howard goldberg
described in email from j michael dean on 12/19--didn't see an entry in
jira.
Is there a workaround? or just stick with 4.2.3. for now
Howard
15 years, 11 months