Re: Re: JBRMS Query, very imp for me
by jagaran das
Hi,
NIce to receive your reply.
I am running on jboss-4.0.4.GA.
Jagaran
rules-users-request(a)lists.jboss.org wrote: Send rules-users mailing list submissions to
rules-users(a)lists.jboss.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
rules-users-request(a)lists.jboss.org
You can reach the person managing the list at
rules-users-owner(a)lists.jboss.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."
Today's Topics:
1. Re: Re: JBRMS Query, very imp for me (Fernando Meyer)
2. Re: DSL to DRL File Conversion - Is it possible ? (kingston)
3. About Decision table (kranthikumar dalai)
4. Two Doubts (Joj)
5. Re: "Or" and Collect (Dirk Bergstrom)
6. Example for using globals in Drools3.0.6 (Joj)
7. Re: Example for using globals in Drools3.0.6 (JLL)
----------------------------------------------------------------------
Message: 1
Date: Wed, 30 May 2007 01:23:58 -0300
From: Fernando Meyer
Subject: Re: [rules-users] Re: JBRMS Query, very imp for me
To: Rules Users List
Message-ID: <535CD4A5-B9BE-441D-AD95-C7CD8279AC19(a)gmail.com>
Content-Type: text/plain; charset="us-ascii"
Howdy jagaran,
Can you please give me some informations about your application
environment?
are you running on jboss AS, tomcat or jetty ?
regards Fernando
Fernando Meyer
fmcamargo(a)gmail.com
GPG: 5A6D 3374 B055 A513 9A02 A03B 3DB3 7485 D804 DDFB
On May 30, 2007, at 12:54 AM, jagaran das wrote:
> Hi Mark,
> You are right I would try to use Hibernate to store data in MySql.
> But I have a different problem.
> For creating rule package through JBRMS I have done following stuffs:
>
> The project is really great.
> but i am unable to download the binary package.
> The steps followed by me is as below:
> 1. created a category.
> 2. created a package associated with that category.
> 3.Loaded a fact model which is a bean class and linked it with the
> package.
> 4. created some business rules.
> 5.imported the bean class in the configure package option and saved
> the changes.
> 6. created a new snapshot.
> 7. Build the package and it shown a success message too.
> 8. Now tried to download the package but it is giving package not
> found.
> Please let me know the solution.
> The message below is shown after i have created all the necessary
> stuffs.
>
> Building a package will collect all the assets, validate and
> compile into a deployable package.
>
> and the message that
> Package built successfully.
> But cant down load the package as it is giving the following menage.
>
> Status report
> message /drools-jbrms/org.drools.brms.JBRMS/package/com.sample/LATEST
> description The requested resource (/drools-jbrms/
> org.drools.brms.JBRMS/package/com.sample/LATEST) is not available.
> Please let me know of the solutions.
>
> Mark Proctor wrote:
> you lost me, sounds like you don't want to use jackrabbit
> persistence, but have your own way to store normalised rules in
> your own database schema - we don't have anything for that at the
> moment, you'd have to create this yourself.
>
> Mark
> jagaran das wrote:
>> Hey Mark,
>>
>> Nice to receive your post.
>> If we want to store data directly in the database we need some
>> specific rule table and ruleset table and other tables and a
>> persistence service like Hibernate.
>> But we need to pick the values from the gui and arrange it
>> accordingly.
>>
>> Regards
>> JAGARAN
>>
>> Download prohibited? No problem! CHAT from any browser, without
>> download.
>
>
>
> Did you know? You can CHAT without downloading messenger. Know how!
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070530/c72636e...
------------------------------
Message: 2
Date: Tue, 29 May 2007 22:14:14 -0700 (PDT)
From: kingston
Subject: Re: [rules-users] DSL to DRL File Conversion - Is it possible
?
To: rules-users(a)lists.jboss.org
Message-ID: <10867626.post(a)talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hi Mark ,
Can you just help me in converting this drl to dsl. ? How do i break lines
in DSL involving OR conditions.?
"[when]-" works for AND conditions . Do i really need give some english text
(DSL mapping) for each line of the when condition when i use "[when]-"
//Sample drl file.
package com.fruit;
import com.test.sample.*;
rule "FruitExample"
when
C: Customer();
Fruit ( name == "apple" , costinrupees == 10) ; &&
eval ( C.getNumOfCustomers() == 20 && ( C.getCityname() == "kanput" ||
C.getCityname() == "Disput" ))
then
System.out.println("Rule Success");
end
The above conditions could be wrriten on a single line using eval() . But
this looks pretty long. Are there any other options i coudl try for breaking
line.? Do we have any workarounds for this.?
Mark Proctor wrote:
>
> Its not straight forward but you can use the DRLDumper, one a
> PackageDescr, assuming it parses without errors:
> DrlParser parser = new DrlParser();
> PackageDescr pkg = parser.parse( source,
> dsl );
> final DrlDumper drlDumper = new DrlDumper();
> final String drlResult = drlDumper.dump( pkg );
>
>
>
> Michael Neale wrote:
>> no in 3.0 version unfortunately. You can tell the parser to print out
>> the DRL - but it will just write it out the System.out (only for
>> debuggin). Look in RuleParser for that option.
>>
>> In trunk - which will be the new version - there is a seperate step
>> which outputs DRL - but I don't think that made it into the M1 release
>> - should be in M2 though.
>>
>> On 3/7/07, *kingston*
>> > wrote:
>>
>>
>> Is there anyway to get the DRL syntax out of the DSL format?
>>
>> Is there any Convenient API method Which takes rule in DSL format
>> and the
>> DSL File Name as arguments and returns the DRL Syntax ?
>>
>> --
>> View this message in context:
>>
>> http://www.nabble.com/DSL-to-DRL-File-Conversion---Is-it-possible---tf336...
>> Sent from the drools - user mailing list archive at Nabble.com
>> .
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
:-/
--
View this message in context: http://www.nabble.com/DSL-to-DRL-File-Conversion---Is-it-possible---tf336...
Sent from the drools - user mailing list archive at Nabble.com.
------------------------------
Message: 3
Date: Wed, 30 May 2007 10:44:23 +0530
From: "kranthikumar dalai"
Subject: [rules-users] About Decision table
To: rules-users(a)lists.jboss.org
Message-ID:
Content-Type: text/plain; charset="iso-8859-1"
Hi to all,
we wrote some rules as follows
package com.leave
import com.leave.paternity;
rule "Paternity Approved"
salience 1000
when
paternity : paternity(gender == 'male',status =='married',role
=='permanent',tenure <= 2,year == 1,applied ==2);
then
paternity.eligible = 2;
paternity.available = 2;
System.out.println("leave approved for :" + paternity.getname());
System.out.println("Total eligible leaves are :" + paternity.getEligible());
end
rule "Paternity Approved1"
salience 800
when
paternity : paternity(gender == 'male',status =='married', role
=='permanent(Onsite)',tenure <= 2 , year ==1, applied ==2,withinmonth <=
30); //withinmonth means if applied with in a month after returning from
Onsite
then
paternity.eligible = 2;
paternity.available = 2;
System.out.println("leave approved for :" + paternity.getname());
System.out.println("Total eligible leaves for employee Onsite are :" +
paternity.getEligible());
end
And they are working fine in jboss 4.0
But we need help that in (from the above how can we write decision table for
user (non developer that he wants to change the rulse)
Pls give us some useful suggestions
Regards:
Kranthi Dalai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070530/09fbd62...
------------------------------
Message: 4
Date: Tue, 29 May 2007 22:16:58 -0700 (PDT)
From: Joj
Subject: [rules-users] Two Doubts
To: rules-users(a)lists.jboss.org
Message-ID: <10867640.post(a)talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hi,
I have two doubts :
1) Can't we use mathematical operations like average, sum, max, min, etc on
the LHS of rule? If, how can I use it? Please show me an example.
2) Can't we manipulate - add and lookup - on a List object on LHS and RHS?
If possible, how can I do it?
Please describe using a sample.
Thanks in advance
Jojan
--
View this message in context: http://www.nabble.com/Two-Doubts-tf3838282.html#a10867640
Sent from the drools - user mailing list archive at Nabble.com.
------------------------------
Message: 5
Date: Tue, 29 May 2007 22:33:13 -0700
From: Dirk Bergstrom
Subject: Re: [rules-users] "Or" and Collect
To: Rules Users List
Message-ID: <465D0C99.8080605(a)juniper.net>
Content-Type: text/plain; charset=ISO-8859-1
Edson Tirelli was heard to exclaim, On 05/29/07 17:13:
> $badBugs : List() from
> collect( Bug( (devOwner memberOf $group || supportOwner memberOf $group),
> severity == "hair-on-fire" )
> And use || and && for connecting constraints
> and "and" and "or" for connecting CE's.
Ahh, ok. From the examples I'd seen, it was hard to tell, and the docs still
show the two as equivalent for connecting CEs (section 3.15).
This will allow me to replace an ugly predicate hack with a clunky but workable
parenthetical grouping. Of course, if you'd care to implement yet another handy
Collections-based constraint, I could make it really clean:
We've got "contains", and now "memberOf" (thanks for implementing my
suggestion), so how about "intersects"?
CheeseCounter( stinkyCheeses intersects crumblyCheeses )
Then I could write my rule like so:
collect( Bug( (owners intersects $group), ...
This would save me from having to edit ten or twenty rules when management
inevitably decides that another kind of owner has to be included in the rules --
there are actually five "owners" now (which makes for a very ugly parenthetical).
Can I file a jira for "intersects", or should I quit being greedy, and enjoy the
shiny new "memberOf" that I am in fact very happy about? :)
--
Dirk Bergstrom dirk(a)juniper.net
_____________________________________________
Juniper Networks Inc., Computer Geek
Tel: 408.745.3182 Fax: 408.745.8905
------------------------------
Message: 6
Date: Tue, 29 May 2007 23:15:01 -0700 (PDT)
From: Joj
Subject: [rules-users] Example for using globals in Drools3.0.6
To: rules-users(a)lists.jboss.org
Message-ID: <10868057.post(a)talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hi,
In the document, its written that "They are typically used to return data"
under globals section. How can I return a global value to the calling
method? In other words, how can I receive it in Java code? Can anybody
explain with a simple example?
And please identify the changes required if I need to get the value of
global in the example below:
........
global String status
rule "FindStatus"
when
student: Student ( mark >= 50 )
then
status = "passed";
end
In this case, there's no need of a global variable, I know. But, anyway, how
can I get its value on the calling method?
Thanks in advance,
Jojan
--
View this message in context: http://www.nabble.com/Example-for-using-globals-in-Drools3.0.6-tf3838437....
Sent from the drools - user mailing list archive at Nabble.com.
------------------------------
Message: 7
Date: Wed, 30 May 2007 00:50:18 -0700 (PDT)
From: JLL
Subject: Re: [rules-users] Example for using globals in Drools3.0.6
To: rules-users(a)lists.jboss.org
Message-ID: <10869121.post(a)talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
hi
i thing using a string could cause some problems
better use your own object named like "Mock" containing a string with setter
and getter
in the java code assert the object in working memory with
MemoryManager.getWorkingMemory().setGlobal("mock", mock);
in the rule file
don't forget to import your Mock
and
global Mock mock
in the when
$mock : Mock( )
and other conditions
in the then statement
$mock.setMyString("hello world");
after the rule fire the value must have been changed ...
hope it's clear enough
friendly
JLL
Joj wrote:
>
> Hi,
>
> In the document, its written that "They are typically used to return data"
> under globals section. How can I return a global value to the calling
> method? In other words, how can I receive it in Java code? Can anybody
> explain with a simple example?
>
> And please identify the changes required if I need to get the value of
> global in the example below:
>
> ........
>
> global String status
>
> rule "FindStatus"
> when
> student: Student ( mark >= 50 )
> then
> status = "passed";
> end
>
>
> In this case, there's no need of a global variable, I know. But, anyway,
> how can I get its value on the calling method?
>
>
> Thanks in advance,
> Jojan
>
>
>
--
View this message in context: http://www.nabble.com/Example-for-using-globals-in-Drools3.0.6-tf3838437....
Sent from the drools - user mailing list archive at Nabble.com.
------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
End of rules-users Digest, Vol 6, Issue 73
******************************************
---------------------------------
Download prohibited? No problem! CHAT from any browser, without download.
17 years, 6 months
Example for using globals in Drools3.0.6
by Joj
Hi,
In the document, its written that "They are typically used to return data"
under globals section. How can I return a global value to the calling
method? In other words, how can I receive it in Java code? Can anybody
explain with a simple example?
And please identify the changes required if I need to get the value of
global in the example below:
........
global String status
rule "FindStatus"
when
student: Student ( mark >= 50 )
then
status = "passed";
end
In this case, there's no need of a global variable, I know. But, anyway, how
can I get its value on the calling method?
Thanks in advance,
Jojan
--
View this message in context: http://www.nabble.com/Example-for-using-globals-in-Drools3.0.6-tf3838437....
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 6 months
Two Doubts
by Joj
Hi,
I have two doubts :
1) Can't we use mathematical operations like average, sum, max, min, etc on
the LHS of rule? If, how can I use it? Please show me an example.
2) Can't we manipulate - add and lookup - on a List object on LHS and RHS?
If possible, how can I do it?
Please describe using a sample.
Thanks in advance
Jojan
--
View this message in context: http://www.nabble.com/Two-Doubts-tf3838282.html#a10867640
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 6 months
About Decision table
by kranthikumar dalai
Hi to all,
we wrote some rules as follows
package com.leave
import com.leave.paternity;
rule "Paternity Approved"
salience 1000
when
paternity : paternity(gender == 'male',status =='married',role
=='permanent',tenure <= 2,year == 1,applied ==2);
then
paternity.eligible = 2;
paternity.available = 2;
System.out.println("leave approved for :" + paternity.getname());
System.out.println("Total eligible leaves are :" + paternity.getEligible());
end
rule "Paternity Approved1"
salience 800
when
paternity : paternity(gender == 'male',status =='married', role
=='permanent(Onsite)',tenure <= 2 , year ==1, applied ==2,withinmonth <=
30); //withinmonth means if applied with in a month after returning from
Onsite
then
paternity.eligible = 2;
paternity.available = 2;
System.out.println("leave approved for :" + paternity.getname());
System.out.println("Total eligible leaves for employee Onsite are :" +
paternity.getEligible());
end
And they are working fine in jboss 4.0
But we need help that in (from the above how can we write decision table for
user (non developer that he wants to change the rulse)
Pls give us some useful suggestions
Regards:
Kranthi Dalai
17 years, 6 months
Re: JBRMS Query, very imp for me
by jagaran das
Hi Mark,
You are right I would try to use Hibernate to store data in MySql.
But I have a different problem.
For creating rule package through JBRMS I have done following stuffs:
The project is really great.
but i am unable to download the binary package.
The steps followed by me is as below:
1. created a category.
2. created a package associated with that category.
3.Loaded a fact model which is a bean class and linked it with the package.
4. created some business rules.
5.imported the bean class in the configure package option and saved the changes.
6. created a new snapshot.
7. Build the package and it shown a success message too.
8. Now tried to download the package but it is giving package not found.
Please let me know the solution.
The message below is shown after i have created all the necessary stuffs.
Building a package will collect all the assets, validate and compile into a deployable package.
and the message that
Package built successfully.
But cant down load the package as it is giving the following menage.
Status reportmessage /drools-jbrms/org.drools.brms.JBRMS/package/com.sample/LATEST
description The requested resource (/drools-jbrms/org.drools.brms.JBRMS/package/com.sample/LATEST) is not available.
Please let me know of the solutions.
Mark Proctor <mproctor(a)codehaus.org> wrote: you lost me, sounds like you don't want to use jackrabbit persistence, but have your own way to store normalised rules in your own database schema - we don't have anything for that at the moment, you'd have to create this yourself.
Mark
jagaran das wrote: Hey Mark,
Nice to receive your post.
If we want to store data directly in the database we need some specific rule table and ruleset table and other tables and a persistence service like Hibernate.
But we need to pick the values from the gui and arrange it accordingly.
Regards
JAGARAN
---------------------------------
Download prohibited? No problem! CHAT from any browser, without download.
---------------------------------
Did you know? You can CHAT without downloading messenger. Know how!
17 years, 6 months
Double
by Matthew Shaw
Hi there,
seeing some very strange behaviour from the following rule
rule "sum higher rate totals"
salience 970
no-loop true
when
timesheet : TimesheetTransferObject( )
total : SheetTotalTransferObject($ihrisType : ihrisType ->
($ihrisType.equals(ihrisType.getDutyHourTotal())), $payRate : payRate ->
($payRate.equals(timesheet.getOfficer().getSubstantiativeRate()) ==
false))
eval(total.getValue().doubleValue() > 0)
highDutyTotal : Double( )
then
highDutyTotal = new
Double(DateUtils.addElapsedTimes(highDutyTotal.doubleValue(),
total.getValue().doubleValue()));
modify(highDutyTotal)
end
In my test the rule fires twice when I don't call modify. Which is the
expected behaviour because I have two unqiue SheetTotalTransferObject
objects.
However when I call modify on the Double object the rule only runs once.
This is incorrect behaviour.
Can anyone offer any clues as to what may be happening here. Is it to do
with my use of the Double type?
This correspondence is for the named persons only.
It may contain confidential or privileged information or both.
No confidentiality or privilege is waived or lost by any mis transmission.
If you receive this correspondence in error please delete it from your system immediately and notify the sender.
You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient.
Any opinions expressed in this message are those of the individual sender except where the sender expressly,
and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.
17 years, 6 months
rule compilation problems
by Guillermo Arias del Rio
Hi all,
I am new to JBoss. I just finished making my first program with Rules and it
works fine, but when I try to integrate all that into my web application
(using Jetty), I get the following error:
[java] java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()
[Lorg/eclipse/jdt/core/compiler/IProblem;
[java] at
org.apache.jasper.compiler.JDTCompiler$2.acceptResult(JDTCompiler.java:341)
[java] at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:417)
...
I tried to fix the problem with:
conf = new PackageBuilderConfiguration();
conf.setCompiler(PackageBuilderConfiguration.JANINO);
...
PackageBuilder builder = new PackageBuilder(conf);
builder.addPackageFromDrl(new StringReader(rule.getText()));
ruleBase.addPackage(builder.getPackage());
as in
http://wiki.jboss.org/wiki/Wiki.jsp?page=RulesTomcat
but it's not working either. Same message.
Can you help me?
Thanks
G. Arias del RIo
17 years, 6 months
Sudoku Example Errors
by Ming Fang
Hi,
I'm getting many of these errors when running the Sudoku Example
java.lang.NullPointerException
at org.drools.reteoo.ReteTuple.get(ReteTuple.java:71)
at org.drools.common.InstanceNotEqualsConstraint
$InstanceNotEqualsConstraintContextEntry.updateFromTuple
(InstanceNotEqualsConstraint.java:112)
at org.drools.common.TripleBetaConstraints.updateFromTuple
(TripleBetaConstraints.java:146)
at org.drools.reteoo.NotNode.assertTuple(NotNode.java:108)
at org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
(SingleTupleSinkAdapter.java:29)
at org.drools.reteoo.NotNode.assertTuple(NotNode.java:121)
at org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
(SingleTupleSinkAdapter.java:29)
at org.drools.reteoo.NotNode.assertTuple(NotNode.java:121)
at
org.drools.reteoo.CompositeTupleSinkAdapter.createAndPropagateAssertTupl
e(CompositeTupleSinkAdapter.java:73)
at org.drools.reteoo.LeftInputAdapterNode.assertObject
(LeftInputAdapterNode.java:144)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:317)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:
183)
at org.drools.reteoo.Rete.assertObject(Rete.java:121)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:
201)
at org.drools.reteoo.ReteooWorkingMemory.doAssertObject
(ReteooWorkingMemory.java:70)
at org.drools.common.AbstractWorkingMemory.assertObject
(AbstractWorkingMemory.java:735)
at org.drools.base.DefaultKnowledgeHelper.assertObject
(DefaultKnowledgeHelper.java:72)
at org.drools.base.DefaultKnowledgeHelper.assertObject
(DefaultKnowledgeHelper.java:66)
at
org.drools.examples.sudoku.Rule_Rule_1__If_a_field_has_the_value_0__it_i
s_empty__remove_it_and_insert_the_PossibleValues_0.consequence
(Rule_Rule_1__If_a_field_has_the_value_0__it_is_empty__remove_it_and_ins
ert_the_PossibleValues_0.java:8)
at
org.drools.examples.sudoku.Rule_Rule_1__If_a_field_has_the_value_0__it_i
s_empty__remove_it_and_insert_the_PossibleValues_0ConsequenceInvoker.eva
luate
(Rule_Rule_1__If_a_field_has_the_value_0__it_is_empty__remove_it_and_ins
ert_the_PossibleValues_0ConsequenceInvoker.java:22)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:
497)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:461)
at org.drools.common.AbstractWorkingMemory.fireAllRules
(AbstractWorkingMemory.java:372)
at org.drools.common.AbstractWorkingMemory.fireAllRules
(AbstractWorkingMemory.java:353)
at org.drools.examples.sudoku.SudokuExample.testWithInput
(SudokuExample.java:52)
at org.drools.examples.sudoku.SudokuExample.main(SudokuExample.java:94)
Besides the fact that these errors are naturally bad,
this points out the issue of Drools being very difficult debug when
bad things happen.
Can somebody give some tips of Drool debugging techniques?
Thanks,
--ming
17 years, 6 months
A Suggestion
by jagaran das
Hi
I
n BRMS when you upload a Fact model it takes any input you give.
I mean let it be a simple file, a war file.
But I think it gets reflected if you give only a jar file as input.
So it would be nice if we have a check that we can upload only jar file and nothing else.
Regards
Jagaran
---------------------------------
Looking for people who are YOUR TYPE? Find them here!
17 years, 6 months