[rules-users] Re: Re: JBRMS Query, very imp for me

jagaran das jagaran_das at yahoo.co.in
Wed May 30 06:24:41 EDT 2007


Hi,

NIce to receive your reply.
I am running on jboss-4.0.4.GA.

Jagaran 
rules-users-request at lists.jboss.org wrote: Send rules-users mailing list submissions to
 rules-users at 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 at lists.jboss.org

You can reach the person managing the list at
 rules-users-owner at 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 at 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 at 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 at 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/c72636e9/attachment-0001.html

------------------------------

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 at lists.jboss.org
Message-ID: <10867626.post at 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---tf3360408.html#a9347582
>>     Sent from the drools - user mailing list archive at Nabble.com
>>     .
>>
>>     _______________________________________________
>>     rules-users mailing list
>>     rules-users at lists.jboss.org 
>>     https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>   
> 
> 
> _______________________________________________
> rules-users mailing list
> rules-users at 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---tf3360408.html#a10867626
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 at 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/09fbd625/attachment-0001.html

------------------------------

Message: 4
Date: Tue, 29 May 2007 22:16:58 -0700 (PDT)
From: Joj 
Subject: [rules-users] Two Doubts
To: rules-users at lists.jboss.org
Message-ID: <10867640.post at 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 at 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 at 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 at lists.jboss.org
Message-ID: <10868057.post at 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.html#a10868057
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 at lists.jboss.org
Message-ID: <10869121.post at 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.html#a10869121
Sent from the drools - user mailing list archive at Nabble.com.



------------------------------

_______________________________________________
rules-users mailing list
rules-users at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070530/eab4654a/attachment.html 


More information about the rules-users mailing list