RE: [rules-users] drools appropriate for calculating uk tax
by Vinoth Kumar Somasundaram
Yes. It would perfectly suit your requirement.
thanks and regards,
vinoth s
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Carolyn Green
Sent: Wednesday, September 10, 2008 11:06 AM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] drools appropriate for calculating uk tax
I'm currently studying uk tax, and I was wondering whether drools would
be suitable for calculating an individuals tax liability.
There are lots of rules such as:
if age < 65
then
allowance = 5225
if age >= 65 and age < 75
then
allowance = 7550 - ((net income - 20,900) * 0.5)
if allowance < 5225
then allowance = 5225
if age >= 75
then
allowance =7690 - ((net income - 20,900) * 0.5)
if allowance < 5225
then allowance = 5225
if 1=1 (run always)
// calculate taxableOtherIncome (earnings, trading profits)
taxableOtherIncome = otherIncome - allowance
allowanceUsed = taxableOtherIncome - otherIncome
allowanceRemaining = allowance - allowanceUsed
allowance = allowanceRemaining
// calculate taxableSavingsIncome
taxableSavingsIncome = savingsIncome - allowance
allowanceUsed = taxableSavingsIncome - savingsIncome
allowanceRemaining = allowance - allowanceUsed
allowance = allowanceRemaining
// calculate taxableDividendIncome
...
There seems to be a fairly strict order to some of the calculations.
I.e. allowance should be deducted from otherIncome before savingsIncome
or dividend income.
Is drools suitable for this type of application?
Many thanks,
Chris
________________________________
Get Hotmail on your mobile from Vodafone Try it Now
<http://clk.atdmt.com/UKM/go/111354028/direct/01/>
17 years, 9 months
drools appropriate for calculating uk tax
by Carolyn Green
I'm currently studying uk tax, and I was wondering whether drools would be suitable for calculating an individuals tax liability.
There are lots of rules such as:
if age < 65
then
allowance = 5225
if age >= 65 and age < 75
then
allowance = 7550 - ((net income - 20,900) * 0.5)
if allowance < 5225
then allowance = 5225
if age >= 75
then
allowance =7690 - ((net income - 20,900) * 0.5)
if allowance < 5225
then allowance = 5225
if 1=1 (run always)
// calculate taxableOtherIncome (earnings, trading profits)
taxableOtherIncome = otherIncome - allowance
allowanceUsed = taxableOtherIncome - otherIncome
allowanceRemaining = allowance - allowanceUsed
allowance = allowanceRemaining
// calculate taxableSavingsIncome
taxableSavingsIncome = savingsIncome - allowance
allowanceUsed = taxableSavingsIncome - savingsIncome
allowanceRemaining = allowance - allowanceUsed
allowance = allowanceRemaining
// calculate taxableDividendIncome
...
There seems to be a fairly strict order to some of the calculations. I.e. allowance should be deducted from otherIncome before savingsIncome or dividend income.
Is drools suitable for this type of application?
Many thanks,
Chris
_________________________________________________________________
Discover Bird's Eye View now with Multimap from Live Search
http://clk.atdmt.com/UKM/go/111354026/direct/01/
17 years, 9 months
Facing an issue with Drools Query
by siddhartha banik
Hi,
I am facing an issue with Drools Query.
Our application serializes working memory after its each execution, to save
the rule engine state.
Our rule base contains a Query along with other rules:
query "GetFactsByValue" ( String $value )
Facts : DataObject( stringValue == $value )
end
With this query present in Rule Base, if I insert more then 900 instances of
DataObject & then try to serialize the working memory... serialization fails
with bellow error:
java.lang.StackOverflowError
at java.io.ObjectStreamClass.processQueue(Unknown Source)
at java.io.ObjectStreamClass.lookup(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
But if I remove the query from rule base, I can insert more then 60,000
objects & then serialize WM without any problem.
Not sure if this is a bug in Query feature or problem in the way I have
written the Query. I have attached test files.
We are using few more queries in our RuleBase like:
query "GetAllFacts" ( )
Fact : DataObject( )
end
query "GetFactsByDate" ( Calendar $startDate, Calendar $endDate )
Fact : DataObject( startDate >= $startDate, endDate <= $endDate )
end
query "GetFactsByParamIdTimeRange" ( ArrayList $paramIDs, Calendar
$startDate, Calendar $endDate )
Facts : DataObject( paramID memberOf $paramIDs, startDate >= $startDate,
endDate <= $endDate )
end
Not sure if they also may fail in some special scenarios. Atleast last 3
Queries we are planning to use in our production. Is it ok to use those?
Execution Environment:
OS: Windows/ Solaris
Drools 4.0.7
jre1.5.0_09
Thanks
Siddhartha
17 years, 9 months
Drools ruturn multiple results based on child objects data length
by Mohamed Riyaz
Hi,
In one-to-many relationship object type, Drools generate multiple results
based on child objects data length. ie. No of child records
belongs to parent object. I wanted the RHS part should be executed only if
conditions imposed
on child object satisfies.
I have two facts with 1-* relationship defined in object mapping.
class Invoice{}
class Order{
private Set<Invoice> invoices;
}
*I wanted RHS should be executed with only one result irrespective of child
records length.*
rule "Multiple results set"
when
order: Order()
invoice : Invoice() from order.invoices
then
System.out.println("Rule Example (Multiple results set)"+order.getId());
end;
Result:
Rule Example (Multiple results set)1000
Rule Example (Multiple results set)1000
Please help me in resolving this issue.
Regards,
Riyaz
17 years, 9 months
Excel sheet has immediate error
by J Michael Dean
This must be a ridiculous newbie issue, but I have working Sample.xls
and com.sample; when, however, I add a new decision table resource in
the Eclipse environment, the new spreadsheet is immediately marked by
Excel as having an error (with the error decoration). What is the
reason for this?
17 years, 9 months
Drools returns the duplicated results with 'OR' logical operator if both conditions are met.
by Mohamed Riyaz
Hi,
I have one more qurey on 'OR' logical operator for the following scenario:
I want the the boolen result from parent object which satisfies two
different condition sets with child objects. I made the rule which is
generated duplicated
results if both conditions are satisfied.
rule "test"
when
order: Order
(
exists ( condition-1 with child objects)
or
exists (condition-2 with child objects)
)
then
SOP("order id "+order.getId());
result :
order id 1000
order id 1000
return the results in twice if both the conditions (cond-1 & cond-2) are
satisfied. It just combine
both results and behaves like 'union all' instead of 'union' function.
Please provide me your suggestion on this.
regards,riyaz
17 years, 9 months
logging with WorkingMemoryEventListener
by thomas kukofka
Hello,
I tried to overwrite toString():
public String toString() {
System.out.println("Type: " + type);
return super.toString();
}
But the output ist the following:
Type: TypeXY
[ObjectInserted: handle=[fid:1:7:com.dssrules.InputObject@996cef];
object=com.dssrules.InputObject@996cef]
Is there any possiblity to configure the WorkingMemoryEventListener so that
it looks like:
[ObjectInserted: type=TypeXY:
handle=[fid:1:7:com.dssrules.InputObject@996cef];
object=com.dssrules.InputObject@996cef]
17 years, 9 months
invalid rule package
by Sascha
I'm a member of the drools mailinglist, so please answer me
am using jbpm with drools. my rules are defined in an excel sheet.
where must i install the class referenced in the excel sheet?
org.drools.rule.InvalidRulePackage: Rule Compilation error
formular(my class) cannot be resolved
17 years, 9 months
Returned mail: Data format error
by Post Office
Your message was undeliverable due to the following reason(s):
Your message could not be delivered because the destination server was
not reachable 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 5 days:
Host 204.45.179.129 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.
17 years, 9 months
Help with syntax for detecting when an object exists, none of whose children match a pattern
by Tom.E.Murphy@wellsfargo.com
As a newbie to Drools (using v4.0.7), I'm struggling a bit with the
right way to express the following concept
I have a ParentFactObject with an array of ChildFactObjects.
The ChildFactObjects have a boolean attribute "TestMe"
I want to pattern match all ParentFactObjects for whom all
ChildFactObjects have false for TestMe
Here's what I've tried:
rule "NoTestChildren"
when
$parentFactObject : ParentFactObject // parent exists
(
)
not ChildFactObject // no child exists that has
TestMe true
(
TestMe == true
) from $parentFactObject.childFactObjects
then
log("Rule NoTestChildren fired.");
end
I get the following:
org.drools.rule.InvalidRulePackage: [66,4]: unknown:66:4 mismatched
token: [@1085,4469:4472='from',<38>,66:4]; expecting type THEN
Also tried this:
rule " NoTestChildren "
when
$parentFactObject : Borrower // parent exists
(
)
forall ($childFactObject : ChildFactObject // no
child exists that has TestMe true
(
TestMe == true
) )from $parentFactObject. childFactObjects
then
log("Rule NoTestChildren fired.");
end
I've tried a series of variations with similar results.
Can anyone provide any guidance on how to do this?
Thanks in advance.
Tom Murphy
This message may contain confidential and/or privileged information. If
you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based on
this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation.
17 years, 9 months