"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 <dsotty@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-bounces@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