Re: [rules-users] Adding .package files to a KnowledgePackage

2012-09-13 Thread Wolfgang Laun
You have serialized a Collection of KnowledgePackage, so I trust you
know how to do the reverse. Then, you simple call
   kBase.addKnowledgePackages( packages )

-W



On 12/09/2012, Paul Ryan pr...@infotrustgroup.com wrote:
 I guess I should also mention that by default we are using the expert API's
 so primarily we're creating the knowledge packages using a
 KnowledgeBuilder.

 Again thanks for any light you can shed on getting files with the extension
 .package loaded into the knowledge base.

 -- Paul Ryan

 On Sep 11, 2012, at 4:59 PM, Paul Ryan pr...@infotrustgroup.com wrote:

 So drools will respect files with a .package extension as a place for
 declared types, functions, etc. when used with these in the class path.
 How can a import these into a KnowledgePackage/KnowledgeBase so they can
 get compiled along with stuff when this is not in the class path at
 startup? My use case is such that these are not in the same space and
 can't be loaded at startup time in most cases.

 Any help is greatly appreciated,

 -- Paul Ryan


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Package footprint

2012-09-13 Thread JP Chemali
Hi all,

I'm trying to reduce the memory footprint of packages in my application (for
performance reasons they are dynamically loaded from disk), and I was
wondering if some of you had any experience with the subject?

So far the optimizations that I can come up with in 5.4.0.Final version are
all about reducing the sizes of generated classes:
- Package name in the drl file should be as small as possible, one letter is
best (even better that no package at all)
- Rule name should be as small as possible as it is used to generate the
consequence class name
- Write as less code as possible in the consequence
- Use as few as possible eval statements
- By using my own JavaDialectConfiguration and MVELDialectConfiguration when
building the knowledge, I can remove the random number on class names that
was added in the recent versions (don't understand why it was added in the
first place? Does anyone know?)

I see some leeway to shorten the names of the following generated classes
but the amount of overriding to change the default consequence name and
the suffixes is a bit too exotic for me:
- PackageName.RuleNameDefaultConsequenceInvoker
- PackageName.RuleNameDefaultConsequenceInvokerGenerated

Any advice, other leads some of you might have?

Thanks in advance



--
View this message in context: 
http://drools.46999.n3.nabble.com/Package-footprint-tp4019721.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] System problems

2012-09-13 Thread joy
hi 

here also while verifying rules in 5.3.0.final i am getting an error showing
   
500 The call failed on the server; see server log for details 
do anyone have any suggestions for this?

thanks 
joy



--
View this message in context: 
http://drools.46999.n3.nabble.com/System-problems-tp4018363p4019722.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] ETA on Drools Planner 5.5 beta?

2012-09-13 Thread Michael Anstis
Hi,

I'm building 5.5.0.beta1 today.

I'd expect it to become available within the following week.

With kind regards,

Mike

On 13 September 2012 08:42, Michiel Vermandel mverm...@yahoo.com wrote:

 Hi,

 I have a pending issue that should be solved in Drools Planner 5.5 Beta.
 (WARN : [2012-09-07 14:56:40,252] Cancelled step index (0), time
 spend (18375): there is no doable move. Terminating phase early.)
 I was informed that Drools Planner 5.5 Beta would be released one of these
 days.
 Any concrete delivery date available?
 I have a demo to give next week and would like to test my project on 5.5
 to see all is the same or better.

 Thanks a lot,

 Michiel Vermandel


 -
 http://www.codessentials.com - Your essential software, for free!
 Follow us at http://twitter.com/#!/Codessentials

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] ETA on Drools Planner 5.5 beta?

2012-09-13 Thread Geoffrey De Smet

  
  
Meanwhile, you can grab the latest snapshot.
In maven use
version5.5.0-20120912.141516-478/version and add the
jboss repository.
In ant, download:

https://repository.jboss.org/nexus/content/groups/public/org/drools/planner/drools-planner-distribution/5.5.0-SNAPSHOT/drools-planner-distribution-5.5.0-20120912.141516-478.zip

There won't be any big changes any more for 5.5.0.Beta1 as the
release is ongoing.

Make sure you're aware that the api is not backwards compatible but
that despite that, it's easy to upgrade, just follow these
instructions:

https://github.com/droolsjbpm/drools-planner/blob/master/drools-planner-distribution/src/main/assembly/filtered-resources/UpgradeFromPreviousVersionRecipe.txt#L1912
It's definitely worth upgrading and going through that recipe: the
new selector architecture is a very big step forward.

Op 13-09-12 09:45, Michael Anstis
  schreef:

Hi,
  
  I'm building 5.5.0.beta1 today.
  
  I'd expect it to become available within the following week.
  
  With kind regards,
  
  Mike
  
  On 13 September 2012 08:42, Michiel
Vermandel mverm...@yahoo.com
wrote:

  
Hi,
  
  I have a pending issue that should be solved in Drools
  Planner 5.5 Beta.
  (WARN : [2012-09-07 14:56:40,252] Cancelled step
index (0), time spend (18375): there is no doable move.
Terminating phase early.)
  I was informed that Drools Planner 5.5 Beta would be
  released one of these days.
  Any concrete delivery date available?
  I have a demo to give next week and would like to test my
  project on 5.5 to see all is the same or better.
  
  Thanks a lot,
  
  Michiel Vermandel
  

  
  -
http://www.codessentials.com
- Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials

  
  
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
  

  
  
  
  
  
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



  

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Package footprint

2012-09-13 Thread Wolfgang Laun
Most of these optimizations look very desparate to me; most likely
they are motivated by a very large number of rules. Perhaps some
techniques for reducing this number would show greater benefit.

-W

On 13/09/2012, JP Chemali jshem...@hotmail.com wrote:
 Hi all,

 I'm trying to reduce the memory footprint of packages in my application
 (for
 performance reasons they are dynamically loaded from disk), and I was
 wondering if some of you had any experience with the subject?

 So far the optimizations that I can come up with in 5.4.0.Final version are
 all about reducing the sizes of generated classes:
 - Package name in the drl file should be as small as possible, one letter
 is
 best (even better that no package at all)
 - Rule name should be as small as possible as it is used to generate the
 consequence class name
 - Write as less code as possible in the consequence
 - Use as few as possible eval statements
 - By using my own JavaDialectConfiguration and MVELDialectConfiguration
 when
 building the knowledge, I can remove the random number on class names that
 was added in the recent versions (don't understand why it was added in the
 first place? Does anyone know?)

 I see some leeway to shorten the names of the following generated classes
 but the amount of overriding to change the default consequence name and
 the suffixes is a bit too exotic for me:
 - PackageName.RuleNameDefaultConsequenceInvoker
 - PackageName.RuleNameDefaultConsequenceInvokerGenerated

 Any advice, other leads some of you might have?

 Thanks in advance



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Package-footprint-tp4019721.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Dynamic rule creation

2012-09-13 Thread Davide Sottara
Are those classes declared or imported in TestRule.drl? 
(Is TestRule.drl built without errors?)
Davide



--
View this message in context: 
http://drools.46999.n3.nabble.com/Dynamic-rule-creation-tp4019723p4019729.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Dynamic rule creation

2012-09-13 Thread kavitha86
Hi david,

Yes. Please find below the rule file details. It has one rule added in the
file. What I am trying, is to add a new rule dynamically to this file.

package datanet.minhours
import com.emlogis.policy.util.RuleAttribute;
import com.emlogis.egs.domain.employee.Employee;
dialect mvel;




rule 'Minhours_2'
dialect 'mvel'
salience 80
when
$p: RuleAttribute()
$g: Employee(employeeType.employeeTypeName == PartTime)
//eval($p.attribute[StructureLevel] =
$p.inParam[structure_1#PolicyStructure])
then
$p.outParam[MinimumHours] = $p.inParam[minhours_2];
$p.outParam[message] = Successfully read and match the age
value[+$g.value(age)+] from the Bussiness Object Employee;
$p.outParam[name] = $g.value(name);



end



--
View this message in context: 
http://drools.46999.n3.nabble.com/Dynamic-rule-creation-tp4019723p4019730.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Package footprint

2012-09-13 Thread Jean-Paul Shemali

Hi,

Thanks for the replies. I'm actually working with a big number of large rule 
sets (ranging from 100 rules to up to 3000), which are generated based on 
another proprietary language. These are not used system wide, but on a user per 
user basis and loaded dynamically

In itself, the system handles itself well, as compiled packages are persisted 
on disk and loaded only when a user requires it. Thing is, the memory footprint 
(and the size of the persisted packages) has increased significantly when 
migrating from 4.0.7 to 5.4.0.Final (20% to 30% for the large ones) and I am 
trying to find ways of trimming this down as much as I can. 

Going from a package name of 12 characters to 1 actually and rule names to 3-4 
characters shaved off 5-10% in most cases, so not so trivial :-)

Unfortunately, reducing the number of rules is not a option in my case, so any 
advice (or explanation on the increase) is most welcome

 Date: Thu, 13 Sep 2012 01:42:47 -0700
 From: dso...@gmail.com
 To: rules-users@lists.jboss.org
 Subject: Re: [rules-users] Package footprint
 
 I agree with Wolfgang... can you give us an idea of the rules you are working
 with?
 Actually:
 - using shorter names might be a last-resort, unless you were using really
 long names in the first place
 - do not use redundant code is a good practice anyway!
 - agreed, evals are evils :)
 - changing the DialectConfigurations is absolutely dangerous, do that at
 your own risk :)
 
 
 
 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Package-footprint-tp4019721p4019735.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Cutom Attributes in Drools

2012-09-13 Thread dme1
Davide,

Thanks for the suggestions. I was considering using the MetaData as well,
since it allows both evaluation on the LHS (just like the example you have)
as well as on the RHS where I can get the MetaData through code and use it
in the application.

And like you have suggested I can use dedicated Fact Types for the RHS, the
requirement for us is also for our business users to be able to set these
attributes/properties when creating or updating a rule in Guvnor, so having
a predefined list (attribute name as well as the values) to choose from
makes it easier and error free, and since its not possible with MetaData I
was wondering if there is another way to achieve this with Custom
Attributes.

Also thanks for the heads up on Rule Overridability features being added.
The current scenario I was trying to solve is where certain rule would
generate a Hard Stop for the application process (Non Overridable), while
others would generate a Confirmation message for the users to acknowledge
and continue or to abandon processing (Overridable). And since all rules in
our environment have to set this property I was wondering if we could do
this with a Custom Attribute that could be set by the rule (only when it
fires) and evaluated in the application to determine the course of action to
take.

Again thanks for your response, and I now understand the options available.

dme



--
View this message in context: 
http://drools.46999.n3.nabble.com/Cutom-Attributes-in-Drools-tp4019692p4019744.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor example how to access rules in database instead sample.drl file?

2012-09-13 Thread Michael Anstis
Your best option would be to use a change-set.

There is such an example, using the mortgages-sample repository in
/guvnor/guvnor-examples.

You could also use the REST API to retrieve rules, but for now the above
should give you a starting point.

With kind regards,

Mike

On 12 September 2012 20:18, richard rx7...@yahoo.com wrote:

 Newbie here,

 How do I access the rules in mortgage/test in sample versus having the rule
 included in a .drl file?

 Guvnor is up and running in tomcat.

 Thanks for your help.




 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Guvnor-example-how-to-access-rules-in-database-instead-sample-drl-file-tp4019713.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools - Search and Reporting

2012-09-13 Thread dme1
Hi,

Is there any way to search and/or generate reports from the Rule Repository
based on different criteria like Facts, Field Values, Attributes, MetaData
etc. 

E.g. If I have a rule 

rule Test
when
  @SomeMetaData(value1)
  ruleflow-group abcd
  p : Person (age  25, country = XYZ)
then
  p.setSomeField(value);

I would like to search for all rules in the ruleflow-group abcd, and
MetaData=SomeMetaData;
or for rules which are defined for Person with age as a criteria; or for
Person with age  25 etc.

I would like to do this in Guvnor and Eclipse if possible.

If the features do not exist what would be the best way to write a custom
search feature to satisfy this requirement.

Thanks,
dme.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Search-and-Reporting-tp4019747.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools - Search and Reporting

2012-09-13 Thread Stephen Masters
How do,

It sounds a lot like what I was looking for recently. Mike provided the 
following thoughts:

http://lists.jboss.org/pipermail/rules-users/2012-July/027897.html

I haven't got stuck into any of it yet though, so I can't provide any feedback 
on what's working (or not) for me.

Steve


On 13 Sep 2012, at 15:39, dme1 meh...@hotmail.com wrote:

 Hi,
 
 Is there any way to search and/or generate reports from the Rule Repository
 based on different criteria like Facts, Field Values, Attributes, MetaData
 etc. 
 
 E.g. If I have a rule 
 
 rule Test
 when
  @SomeMetaData(value1)
  ruleflow-group abcd
  p : Person (age  25, country = XYZ)
 then
  p.setSomeField(value);
 
 I would like to search for all rules in the ruleflow-group abcd, and
 MetaData=SomeMetaData;
 or for rules which are defined for Person with age as a criteria; or for
 Person with age  25 etc.
 
 I would like to do this in Guvnor and Eclipse if possible.
 
 If the features do not exist what would be the best way to write a custom
 search feature to satisfy this requirement.
 
 Thanks,
 dme.
 
 
 
 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Drools-Search-and-Reporting-tp4019747.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Data Model Dependencies in Guvnor

2012-09-13 Thread dme1
Hi,

I have created 2 projects in Eclipse - the first one is the Base Project
with the Model defined for this as BaseModel.jar. The send one is the
Extension Project which inherits the BaseModel and extends it, this Model is
called ExtendedModel.jar.

In Eclipse I can set the dependency on BaseModel in the Extended Project and
can write rules using the Base and Extended Models.

Now I create 2  packages in Guvnor one to represent the Base Project, the
second to represent the Extended Project. I upload the BaseModel to the
BaseProject and the associated technical rules and this all works well.

In the Extended Package I upload the BaseModel.jar successfully, however
when I try to upload the ExtendedModel.jar it gives me an Error. The only
way I can resolve my error is to update the ExtendedModel.jar to include all
classes from BaseModel.jar, so it seems like the Guvnor requires all
dependencies to be resolved within the Model jar and cannot reference other
Data Models within the same package.

Is there a way for Guvnor to lookup the other Models for dependencies and
resolve the dependencies? If not what is the recommended approach for
specifying dependent models in Guvnor?

Thanks,
dme



--
View this message in context: 
http://drools.46999.n3.nabble.com/Data-Model-Dependencies-in-Guvnor-tp4019750.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools - Search and Reporting

2012-09-13 Thread dme1
Thanks. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Search-and-Reporting-tp4019747p4019751.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Cutom Attributes in Drools

2012-09-13 Thread GPatel
I would not store the result of the (missed) activation of a rule in a 
rule
attribute, anyway. Can't you just use a dedicated fact(s) for that?

I face a similar issue where the target audience are business users i.e 
users that dont really understanding or wish to get into logic. I am 
finding myself having to resort to all sorts of tricks (using 
categories/packages/standlone rule editor) to allow business users to 
easily specify which rules are for what purposes and when they should 
fire. I just cant rely on them using facts correctly to disable rules that 
should not fire. In fact, I am now down to using only the standalone 
editor and saving the rule xml in my tables (not guvnor) so that i have 
full control over itemized rule display, rule search, knowledgebase 
creation for different execution profiles, etc.

Overall, I increasingly tend to think rules for business users is a myth. 
The business users wants rule-driven systems, yet they dont want to learn 
drools. And drools DSL just doesnt cut it.



From:   Davide Sottara dso...@gmail.com
To: rules-users@lists.jboss.org, 
Date:   09/13/2012 01:57 AM
Subject:Re: [rules-users] Cutom Attributes in Drools
Sent by:rules-users-boun...@lists.jboss.org



You can add any metadata using the format @name( value ) or @name(
key=value ). You can then look them up using rule.getMetaData(). 
Please notice that there's a bug (solved by an open pull request) that 
does
not let you write just @name.

In order to use those attributes to control whether a rule fires or not, 
you
can use the declarative agenda, i.e. add meta-rules to your knowledge 
base
such as:

rule Meta
@activationListener('direct')
when
// assuming the attribute is @region( [value] )
$a : Activation( rule.metaData[ name ] != MyDesiredRegion, $objs :
objects )
// any condition on the tuple here, if needed
then
drools.cancelActivation( $a );
end

notice that you'll have to enable the corresponding option first:
KnowledgeBaseConfiguration kconf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kconf.setOption( DeclarativeAgendaOption.ENABLED );
KnowledgeBase kb = KnowledgeBaseFactory.newKnowledgeBase( kconf );


If you want to have rules override each other, watch out for an upcoming
feature, Defeasible logic.
I would not store the result of the (missed) activation of a rule in a 
rule
attribute, anyway. Can't you
just use a dedicated fact(s) for that?

Best
Davide



--
View this message in context: 
http://drools.46999.n3.nabble.com/Cutom-Attributes-in-Drools-tp4019692p4019736.html

Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



-
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Cutom Attributes in Drools

2012-09-13 Thread Vincent LEGENDRE
It is not a myth ... but indeed, it's hard. 
Most of times, you have to find one guy at client's side who is ready to learn 
at least the main principles of expert-systems. For my experience, it works 
well enough (ie most of rules dev time is done by the BA) in about 1 proj out 
of 3. For the others, an IT guy is still needed to help the BA (which is 
something doable if you have enough rules to author). 

DSL are hard to set, and harder to maintain, especially while using guvnor 
(using DSL in a dsrl rule is fine, but dsrl rules for non-IT guys is a myth). 
Usually I try as much as I can to set a business-compliant POJO model (ie 
simple, almost flat, with fields named in a way they understand what is behind) 
and no DSL at all... 
For the rules' firing control, it is harder ... 

@dme1 : May be you can think on an agenda filter that looks for the rule's 
package ? Or use category rules, which is a rule binded to a category, which 
acts as a parent rule for all rules under this category (so all rules of the 
same category will have the same common first conditions, which can be the test 
of your control fact). But beware of that, there was a bug on sub-categories, 
or when a rule has more than one category (one the first category is taken if I 
remember well). A last thing could be to use verifier to ensure that all rules 
have a first condition that test the control fact . 

@GPatel : your approach sounds great. How much time did you spent to write such 
a Guvnor alternative ? 


- Mail original -

De: gpa...@tsys.com 
À: Rules Users List rules-users@lists.jboss.org 
Envoyé: Jeudi 13 Septembre 2012 18:47:52 
Objet: Re: [rules-users] Cutom Attributes in Drools 

 I would not store the result of the (missed) activation of a rule in a rule 
attribute, anyway. Can't you just use a dedicated fact(s) for that? 

I face a similar issue where the target audience are business users i.e users 
that dont really understanding or wish to get into logic. I am finding myself 
having to resort to all sorts of tricks (using categories/packages/standlone 
rule editor) to allow business users to easily specify which rules are for what 
purposes and when they should fire. I just cant rely on them using facts 
correctly to disable rules that should not fire. In fact, I am now down to 
using only the standalone editor and saving the rule xml in my tables (not 
guvnor) so that i have full control over itemized rule display, rule search, 
knowledgebase creation for different execution profiles, etc. 

Overall, I increasingly tend to think rules for business users is a myth. The 
business users wants rule-driven systems, yet they dont want to learn drools. 
And drools DSL just doesnt cut it. 



From: Davide Sottara dso...@gmail.com 
To: rules-users@lists.jboss.org, 
Date: 09/13/2012 01:57 AM 
Subject: Re: [rules-users] Cutom Attributes in Drools 
Sent by: rules-users-boun...@lists.jboss.org 




You can add any metadata using the format @name( value ) or @name( 
key=value ). You can then look them up using rule.getMetaData(). 
Please notice that there's a bug (solved by an open pull request) that does 
not let you write just @name. 

In order to use those attributes to control whether a rule fires or not, you 
can use the declarative agenda, i.e. add meta-rules to your knowledge base 
such as: 

rule Meta 
@activationListener('direct') 
when 
// assuming the attribute is @region( [value] ) 
$a : Activation( rule.metaData[ name ] != MyDesiredRegion, $objs : 
objects ) 
// any condition on the tuple here, if needed 
then 
drools.cancelActivation( $a ); 
end 

notice that you'll have to enable the corresponding option first: 
KnowledgeBaseConfiguration kconf = 
KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); 
kconf.setOption( DeclarativeAgendaOption.ENABLED ); 
KnowledgeBase kb = KnowledgeBaseFactory.newKnowledgeBase( kconf ); 


If you want to have rules override each other, watch out for an upcoming 
feature, Defeasible logic. 
I would not store the result of the (missed) activation of a rule in a rule 
attribute, anyway. Can't you 
just use a dedicated fact(s) for that? 

Best 
Davide 



-- 
View this message in context: 
http://drools.46999.n3.nabble.com/Cutom-Attributes-in-Drools-tp4019692p4019736.html
 
Sent from the Drools: User forum mailing list archive at Nabble.com. 
___ 
rules-users mailing list 
rules-users@lists.jboss.org 
https://lists.jboss.org/mailman/listinfo/rules-users 

- The information contained in this 
communication (including any attachments hereto) is confidential and is 
intended solely for the personal and confidential use of the individual or 
entity to whom it is addressed. If the reader of this message is not the 
intended recipient or an agent responsible for delivering it to the intended 
recipient, you are hereby notified that you have received this communication in 
error and that any review, 

Re: [rules-users] Cutom Attributes in Drools

2012-09-13 Thread Davide Sottara
Thank you for reporting this user experience... and I think this is of
interest for other users too.
I would address your problem at different levels..

You basically are asking for a more declarative approach to writing business
rules, and that is perfectly
understandable. The DRL rules are technical rules and are somewhat in
between a purely declarative
language and a programming language.

This said, rules should fire or not depending on the context: if that
context is part of the business logic, i.e. lives at the same level of the
other preconditions, it should be added to the premises of the rules, 
and now the problem is finding a better language for your knowledge
engineers to model business rules.

If instead the logic can be understood to be a meta-level logic, so that
you'd have to create
innatural auxiliary control facts, you could possibly explore the
meta-rule approach I outlined in my previous comment. Of course, this still
suffers from the same technicality issue, but the rules would
be written by the business users and the meta rules by the technical ones...
(btw The reason for not updating metadata is that they are defined
statically at the rule level, whereas you would actually be interested in
the activations! and this is quite different)

Also remember that Drools is community driven: if you think that there is
some missing feature, please
submit a proposal (e.g. would something like SBVR be more suitable for
you?), maybe others will join
you in supporting that. A critical mass may help to get it done, and of
course you can help and contribute :)



--
View this message in context: 
http://drools.46999.n3.nabble.com/Cutom-Attributes-in-Drools-tp4019692p4019754.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Cutom Attributes in Drools

2012-09-13 Thread dme1
Thanks for the suggestions. However I have rules where the Control Fact is
not mandatory, as well as there is a choice between multiple elements (LHS
and RHS) so I have to come up with a Dummy which says something like does
not apply to this rule, a bit cumbersome but an approach that can be
explored.

@Davide - For the override rules, are you able to advise when this feature
will be available? Also in the interim is there a workaround that can be
used to simulate this feature?

Thanks,
dme



--
View this message in context: 
http://drools.46999.n3.nabble.com/Cutom-Attributes-in-Drools-tp4019692p4019755.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Adding multi-select listbox to Guvnor for entering array of values in 'IN' condition

2012-09-13 Thread Michael Anstis
Hi Ken,

This requirement, I believe, is already captured here:
https://issues.jboss.org/browse/GUVNOR-1858

Please be sure to add your comments, to ensue when it is implemented your
use-case is supported.

With kind regards,

Mike

On 12 September 2012 20:56, Ken Archer karc...@telogical.com wrote:

 To author LHS conditions that use an array of values, like IN or NOT IN,
 Guvnor requires entry of a comma-delimited list of values in a textbox.

 I would sure like to provide the same type of db-enabled list box for
 selecting multiple values that Guvnor supports for selecting single values.
 However, I can't seem to find a way to do this.  Any thoughts?

 Ken



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Adding-multi-select-listbox-to-Guvnor-for-entering-array-of-values-in-IN-condition-tp4019714.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor example how to access rules in database instead sample.drl file?

2012-09-13 Thread richard
I am able to get a list of the rules from the mortgage in the database, but
how do I set up the java when I fire the rules, to get them to execute the
underage rule?

Viewing source for: Underage
1.  |   rule Underage
2.  |   salience 10
3.  |   dialect mvel
4.  |   when
5.  |   application : LoanApplication( )
6.  |   Applicant( age  21 )
7.  |   then
8.  |   application.setApproved( false );
9.  |   application.setExplanation( Underage );
10. |   retract( application );
11. |   end

I assume I need an application class and Applicant class, but where does
LoanApplicatiion come from.
I do not see it anywhere in the examples in the docs?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-example-how-to-access-rules-in-database-instead-sample-drl-file-tp4019713p4019759.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor example how to access rules in database instead sample.drl file?

2012-09-13 Thread Michael Anstis
The fact types/classes are declarative. Look in the model definition in
Guvnor.

When you come to use your own classes you will need to upload the JAR to
Guvnor as a new JAR model and also include in your client classpath. Models
uploaded to Guvnor only serve to drive the UI and are not included in the
rule package the change set downloads from Guvnor.

This will make mire sense when you get to that stage, but please feel free
to drop by when you get there.

sent on the move

On 13 Sep 2012 20:53, richard rx7...@yahoo.com wrote:

 I am able to get a list of the rules from the mortgage in the database, but
 how do I set up the java when I fire the rules, to get them to execute the
 underage rule?

 Viewing source for: Underage
 1.  |   rule Underage
 2.  |   salience 10
 3.  |   dialect mvel
 4.  |   when
 5.  |   application : LoanApplication( )
 6.  |   Applicant( age  21 )
 7.  |   then
 8.  |   application.setApproved( false );
 9.  |   application.setExplanation( Underage );
 10. |   retract( application );
 11. |   end

 I assume I need an application class and Applicant class, but where does
 LoanApplicatiion come from.
 I do not see it anywhere in the examples in the docs?



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Guvnor-example-how-to-access-rules-in-database-instead-sample-drl-file-tp4019713p4019759.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor example how to access rules in database instead sample.drl file?

2012-09-13 Thread richard
I guess I don't understand, I am able to pull the rules from the db.

I can see how the helloworld example works because i see stuff being used in
sample.drl. 

Dummy rule : mortgages : RULE
Underage : mortgages : RULE
Bankruptcy history : mortgages : RULE
No bad credit checks : mortgages : RULE
no NINJAs : mortgages : RULE
Row 3 Pricing loans : mortgages : RULE
Row 1 Pricing loans : mortgages : RULE
Row 2 Pricing loans : mortgages : RULE
CreditApproval : mortgages : RULE
RegexDslRule : mortgages : RULE

using the changeset.xml

and using this loop

   for( KnowledgePackage kpkg : kbase.getKnowledgePackages() ) {
CollectionRule rules = new ArrayListRule( kpkg.getRules() );
for( Rule rule : rules ) {
System.out.println( rule.getName().toString() +  :  +
rule.getPackageName().toString() +  :  +
rule.getKnowledgeType().toString());

}
}
   
   

   




--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-example-how-to-access-rules-in-database-instead-sample-drl-file-tp4019713p4019761.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor example how to access rules in database instead sample.drl file?

2012-09-13 Thread Michael Anstis
Did you look at the model in Guvnor and the Guvnor example I referenced?

If things still aren't clear pop by to #guvnor on IRC tomorrow (9:00 GMT
onwards) and it will be easier to talk you through your problems.

sent on the move

On 13 Sep 2012 21:57, richard rx7...@yahoo.com wrote:

 I guess I don't understand, I am able to pull the rules from the db.

 I can see how the helloworld example works because i see stuff being used
 in
 sample.drl.

 Dummy rule : mortgages : RULE
 Underage : mortgages : RULE
 Bankruptcy history : mortgages : RULE
 No bad credit checks : mortgages : RULE
 no NINJAs : mortgages : RULE
 Row 3 Pricing loans : mortgages : RULE
 Row 1 Pricing loans : mortgages : RULE
 Row 2 Pricing loans : mortgages : RULE
 CreditApproval : mortgages : RULE
 RegexDslRule : mortgages : RULE

 using the changeset.xml

 and using this loop

for( KnowledgePackage kpkg : kbase.getKnowledgePackages() ) {
 CollectionRule rules = new ArrayListRule( kpkg.getRules()
 );
 for( Rule rule : rules ) {
 System.out.println( rule.getName().toString() +  :  +
 rule.getPackageName().toString() +  :  +
 rule.getKnowledgeType().toString());

 }
 }








 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Guvnor-example-how-to-access-rules-in-database-instead-sample-drl-file-tp4019713p4019761.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] exception jitting problem

2012-09-13 Thread brendanneff
Hello, 

I recently inherited drools management of our system when the previous
code owner left the company unexpectedly, and sure enough, as soon as he
left, I found the errors posted below.  Being new to drools, I'm pretty lost
about how to begin troubleshooting this issue. 

I read a few forum posts about updating to 5.4 CR1 (we're using 5.4 Final),
but wanted to ask and see if that's really the cause before I start changing
the version.  I also saw that casting as an Integer, which we do, could
solve the problem.  Could someone take a look at this and let me know if
changing to CR1 would fix the issue or if there's a simpler solution? 

A little more info:   
We recently started increasing our traffic, which may be why we didn't see
this issue before.   
I can't tell if this happens every 21st call or not, as was noted in other
forum posts.  We have multiple rules in each .drl file, and it seems like
only these two rules are referenced, and none of the others.  All rules in
the file are called, so shouldn't the others cause the exceptions too? 
As far as I can tell, we're passing valid values each time to the rules. 

If there's any other information I can provide, please let me know. 
Thanks 

Exception in thread Thread-69 java.lang.RuntimeException: Exception
jitting: !getActiveLender($loan.getCurrentLender().getName()).canMakeLoan 
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:219)
 
at
org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41) 
at
org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201) 
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
at java.lang.Thread.run(Thread.java:722) 
Caused by: java.lang.VerifyError: (class:
ConditionEvaluator30c1aafd8a5c4402813396a1ab9f4739, method: evaluate
signature:
(Ljava/lang/Object;Lorg/drools/common/InternalWorkingMemory;Lorg/drools/reteoo/LeftTuple;)Z)
Expecting to find integer on stack 
at java.lang.Class.getDeclaredConstructors0(Native Method) 
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404) 
at java.lang.Class.getConstructor0(Class.java:2714) 
at java.lang.Class.getConstructor(Class.java:1674) 
at
org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:173)
 
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)
 
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:217)
 
... 5 more 
Exception in thread Thread-70 java.lang.RuntimeException: Exception
jitting: new Integer(getCustomer().getLatestEmployer().monthlySalary)  1251 
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:219)
 
at
org.drools.rule.constraint.MvelConstraint.access$000(MvelConstraint.java:41) 
at
org.drools.rule.constraint.MvelConstraint$1.run(MvelConstraint.java:201) 
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
at java.lang.Thread.run(Thread.java:722) 
Caused by: java.lang.VerifyError: (class:
ConditionEvaluatorcc9abc72a67b4dd2bbde979a1a2baa48, method: evaluate
signature:
(Ljava/lang/Object;Lorg/drools/common/InternalWorkingMemory;Lorg/drools/reteoo/LeftTuple;)Z)
Expecting to find integer on stack 
at java.lang.Class.getDeclaredConstructors0(Native Method) 
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404) 
at java.lang.Class.getConstructor0(Class.java:2714) 
at java.lang.Class.getConstructor(Class.java:1674) 
at
org.drools.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:173)
 
at
org.drools.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:53)
 
at
org.drools.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:217)
 
... 5 more 


Here are the rules that seem to be causing the errors: 


rule Cashcure - Average Monthly Income Less Than 1251 
when 
$loan : CMVNewLoanBean( new
Integer(getCustomer().getLatestEmployer().monthlySalary)  1251) 
then 
$loan.setLenderError($loan.getCurrentLender().getName(), 20253); 
end 


rule Cashcure - Loan Cap Has Been Reached 
when 
$loan : CMVNewLoanBean(
!getActiveLender($loan.getCurrentLender().getName()).canMakeLoan ) 
then 
$loan.setLenderError($loan.getCurrentLender().getName(), 20259); 
end



--
View this message in context: 
http://drools.46999.n3.nabble.com/exception-jitting-problem-tp4019764.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___

[rules-users] problem with pesisted stateful knowledge session and Length Sliding Window

2012-09-13 Thread henrychen
Hi all,

nbsp;nbsp;I am facing a problem with  persisted stateful knowledge
session, please help me. My rule is listed as below:

package com.sample

import com.sample.Event;

import java.util.List;


declare Event

nbsp;nbsp;@role(event)

end


rule test

nbsp;nbsp;when

nbsp;nbsp;nbsp;nbsp;$list : List() from collect(Event() over window:
length(2))

nbsp;nbsp;then

nbsp;nbsp;nbsp;nbsp;System.out.println(print out in rule, size of
the list collected from window is: + $list.size());

end

nbsp;nbsp;The problem is,
 

when use a normal stateful session(created by the calling
kbase.newStatefulKnowledgeSession()), *when a third fact inserted, the
session working memory only retains list of 2, as expected.*

when use a persisted stateful session(created by the calling
JPAKnowledgeService.newStatefulKnowledgeSession()), insert 2 facts first.
Then restore this session by
JPAKnowledgeService.loadStatefulKnowledgeSession(), and *insert a third
fact, the session working memory grows to list of 3?* 


nbsp;nbsp;By the way, I am using version 5.2.0.Final. And after I upgrade
to version 5.4.0.Final, the test result of persisted session becomes to
normal.*The attachment is my test program and you can repeat it.*

 nbsp;nbsp;I want to ask you if there is something missing that I need to
do in 5.2.0.Final?

 nbsp;nbsp;Thank you in advance, any help will be appreciated. 
http://drools.46999.n3.nabble.com/file/n4019766/drools-session-persis-demo.zip
drools-session-persis-demo.zip 



--
View this message in context: 
http://drools.46999.n3.nabble.com/problem-with-pesisted-stateful-knowledge-session-and-Length-Sliding-Window-tp4019766.html
Sent from the Drools: User forum mailing list archive at Nabble.com.___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Changing the java compiler level in drools

2012-09-13 Thread balaji.govindarajulu
I want to change the java compiler level to 1.6 but it doesn't seem to work
for me. I am trying to use generics in the consequence part.

Following is my code that I used to change the compiler level.

*Drools Version: 5.2.1 GA 
JDK Version : 1.6*

*final Properties properties = new Properties();
properties.setProperty(drools.dialect.java.compiler, JANINO);
properties.setProperty(drools.dialect.default, java);
properties.setProperty(drools.compiler.lnglevel, 1.6);


PackageBuilderConfiguration packageBuilderConfiguration =
  new PackageBuilderConfiguration(properties,(ClassLoader[]) null);

final KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder(packageBuilderConfiguration);*

Let me know where I am going wrong.

Thanks for the help.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Changing-the-java-compiler-level-in-drools-tp4019770.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users