Drools with Guvnor
by bbarani
Hi,
I am very new to Drools and very very new to Guvnor.
I am in the process of creating a rule engine which will fetch the data from
a source (I am using Hibernate framework to fetch the data) and evaluate the
data using Drools rule engine. The rules supplied to the Drools rule engine
are stored in a Rules table in a database.
Now my question is that can I use Guvnor to store the rules (instead of me
creating a rule data model) and use Guvnor to supply rules to my Drools
engine?
I am trying to find out the best possible way to create / manage a rule
database (which stores all the rules).
Thanks,
BB
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-with-Guvnor-tp...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 9 months
Wrong flow script task executes when multiple flows are loaded
by H.C.
I am observing some strange behavior in drools 5.0.1 which behaved correctly
in 5.1.0-M1.
I have two different ruleflows defined, each with a script task at the
beginning fetching different types of data from DB. It seems that when both
flows are loaded by drools and I choose to execute the first flow, somehow
the script task from the second flow is executed instead of the script task
of the first flow. When I comment out the second flow from my changeset file
and only load the first flow, things behave correctly, but when both are
loaded, the wrong script task is executed. The strange thing is, just
judging by the audit trail, the correct flow and task names are being
executed except that the completely wrong objects are fetched by the script
task.
Both flows and tasks have different names and Ids.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Wrong-flow-script-tas...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 9 months
BPMN2 Timer Cycle
by tolitius
Per BPMN2 specification:
"The timer has a specific time-date or a specific cycle (e.g.,
every Monday at 9am) that can be set, so if the cycle is every day at 9
a.m."
BPMN2 was a recommended way to go, since DRF is going to become
obsolete soon.
Is this timer feature currently supported by Drools? I can see it
in XSD:
<xsd:element name="timerEventDefinition" type="tTimerEventDefinition"
substitutionGroup="eventDefinition"/>
<xsd:complexType name="tTimerEventDefinition">
<xsd:complexContent>
<xsd:extension base="tEventDefinition">
<xsd:choice>
<xsd:element name="timeDate" type="tExpression" minOccurs="0"
maxOccurs="1"/>
<xsd:element name="timeCycle" type="tExpression" minOccurs="0"
maxOccurs="1"/>
</xsd:choice>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
But not in Eclipse IDE properties.
/Anatoly
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/BPMN2-Timer-Cycle-tp8...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 9 months
Java Enums in Guvnor
by Ian-D.Jones@ubs.com
Hi All,
I've recently started using Drools and Guvnor, and so far really like
it!
I have one problem however, to do with Java enums in Guvnor.
I have a simple enum as follows:
public enum STPRuleAction
{
UNKNOWN, ACCEPT, REJECT
}
I can hand write a rule that works fine with this enum as follows:
rule "Retract rejected"
dialect "mvel"
when
o : CtasOrder( stpRuleAction == STPRuleAction.REJECT )
then
o.setStatus( 1 );
retract( o );
end
However, if I create a rule with Guvnor, it always puts quotes around
the condition, so seems to treat it as a string and it is never
triggered. I have created a Guvnor enumeration as follows:
'CtasOrder.stpRuleAction' : ['STPRuleAction.UNKNOWN=UNKNOWN',
'STPRuleAction.ACCEPT=ACCEPT', 'STPRuleAction.REJECT=REJECT']
Which gives me the correct drop down values in the Business Rule editor,
but the source of the rule looks like:
rule "Retract rejected"
dialect "mvel"
when
o : CtasOrder( stpRuleAction == "STPRuleAction.REJECT")
then
o.setStatus( 1 );
retract( o );
end
I've tried without the mapping in the enumeration (e.g ... :
['STPRuleAction.UNKNOWN', ...) and even removing the enumeration and
adding the text manually as a literal value. I can't see any way to
specfy a enum/qualifiedIdentifier as a condition in Guvnor. It works
fine as a consequence and produces a rule without quotes around (e.g.
o.setStpRuleAction( STPRuleAction.REJECT )...)
Many thanks for any assistance you can give.
Regards,
Ian
Visit our website at http://www.ubs.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mails are not encrypted and cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender
therefore does not accept liability for any errors or omissions in the
contents of this message which arise as a result of e-mail transmission.
If verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities
or related financial instruments.
UBS Limited is a company registered in England & Wales under company
number 2035362, whose registered office is at 1 Finsbury Avenue,
London, EC2M 2PP, United Kingdom.
UBS AG (London Branch) is registered as a branch of a foreign company
under number BR004507, whose registered office is at
1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
UBS Clearing and Execution Services Limited is a company registered
in England & Wales under company number 03123037, whose registered
office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
UBS reserves the right to retain all messages. Messages are protected
and accessed only in legally justified cases.
15 years, 9 months
Configuration file problem in Glassfish
by Zack Pederson
I've run into a problem with the 5.0 version of drools and it's interaction
with the Glassfish app server. When the drools engine is initializing it
looks for the drools.rulebase.conf file in the user.home directory. In my
company's app server environments, the applications are not allowed to write
to or read from the user.home directory so it throws an
AccessControlException saying access is denied and the application will not
start up. Is there any way to tell drools not too look for this file short
of downloading the source, modifying it and creating my own jars? I've
tracked the offending code down to the ChainedProperties class in the
drools-core jar so I know what to change if it comes down to that.
Thanks in advance.
Zack
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Configuration-file-pr...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 9 months
Re: [rules-users] Using Drools as a glorified Hashmap
by John Peterson
Hey Daniel,
My suggestion was that a single default rule could be fired to indicate
that the prescription was invalid if all the matching rules failed to
create a valid match.
Example:
- Match Rule 1, Salience 50, Activation-group "Match Rules"
- Match Rule 2, Salience 50, Activation-group "Match Rules"
- Match Rule 3, Salience 50, Activation-group "Match Rules"
- Match Rule 4, Salience 50, Activation-group "Match Rules"
- Match Rule 5, Salience 50, Activation-group "Match Rules"
- Match Rule 6, Salience 50, Activation-group "Match Rules"
- Match Rule 7, Salience 50, Activation-group "Match Rules"
- Match Rule 8, Salience 50, Activation-group "Match Rules"
- Match Rule 9, Salience 50, Activation-group "Match Rules"
- No Match Rule 1, Salience 0, Activation-group "Match Rules"
Activation-group allows only one rule to fire from all the rules sharing
that activation-group. By putting a positive salience (priority) on all
the match rules, if any one of them matches, that's all that can fire
per the activation-group. However, if the No Match rule is fired, that
means that the prescription was not matched by any of the match rules.
It is a default. The rule can be as simple as:
Rule "No Match"
salience 0
activation-group "Match Rules"
When
Eval(true) // Always true
Then
Do your "no match" logic
End
The activation-group is doing your "heavy lifting", so to speak....
jp
------------------------------------------------------------------------
------------------------------------
Message: 3
Date: Wed, 19 May 2010 06:20:39 -0700 (PDT)
From: djb <dbrownell83(a)hotmail.com>
Subject: Re: [rules-users] Using Drools as a glorified Hashmap
To: rules-users(a)lists.jboss.org
Message-ID: <1274275239719-829059.post(a)n3.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hi John, Wolfgang,
Thanks for your suggestions. Though I didn't use either of your
suggestions
as described, it helped me work it out. I added tokens describing the
prescriptions, then as they are matched (using RETE), the tokens are
retracted. Then any tokens left over are invalid. It is probably as
fast as
a HashMap. I don't think John's solution would have worked, because no
single rule can determine whether a prescription is invalid.
Regards,
Daniel
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Using-Drools-as-a-gl
orified-Hashmap-tp825851p829059.html
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 9 months
Dynamic generated list
by Giovanni Motta
I would like to generate a template that can output rules, as explained in
Drools expert user guide at chapter 5.2 (
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/ht...
).
My parameters are 2 lists of strings. In some case the list is to be
outputted as a "multi restriction", and that is no problem.
But, from one of this lists, i need also to generate a collection of strings
to then reason over.
As an example, suppose the list1 contains 3 productIds, "A","B","C", and the
list2 contains "X" and "Y".
In the generated rule, i need to check, for example, that:
- if a product with id 'X' or 'Y' exists (this part is easy),
and
- a tuple composed of products from the other list(one "A", one "B", one
"C") that individually satisfy some condition exists (this is tough for me)
then i will execute my code.
I think the generated rule should be something like:
when
$target: Product (id in ("X","Y"))
$list: ArrayList() from ???? #arrayList should contain the parameter
values "A","B","C"
forall ( $id: String() from $list
Product (id == $id, ....here some condition...)
)
then
.....
The difficult part is to generate the ArrayList dynamically, i don't know
how to accomplish that...
Any ideas? Is there a better approach than templates, to generate a rule
like this?
Do you have a suggestion on how the rule could be rewritten to avoid the use
of the ArrayList?
Thank you in advance
Giovanni
15 years, 9 months
Deployment ear with drools support
by Pedro Maria Buitrago Mantilla
Greatings,
Features:
1. jboss 4.2.1
2. jvm jdk1.5.0_13
3. drools 5.0.1
I deployed a EAR application over jboss, this application uses drools
support for work flow activities, without particular persistence definitions
, but I have the next error:
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName:
persistence.units:ear=DroolsSupport-Ear.ear,unitName=org.drools.task
State: FAILED
Reason: java.lang.RuntimeException: You have not defined a jta-data-source
for a JTA enabled persistence context named: org.drools.task
ObjectName:
persistence.units:ear=DroolsSupport-Ear.ear,jar=DroolsSupportEjb.jar,unitName=DroolsSupportJPA
State: FAILED
Reason: javax.persistence.PersistenceException:
org.hibernate.HibernateException: Errors in named queries:
TasksAssignedAsBusinessAdministrator, TasksAssignedAsTaskInitiator,
TasksAssignedAsExcludedOwner, TasksAssignedAsRecipient,
TasksAssignedAsPotentialOwner, TasksAssignedAsPotentialOwnerWithGroup,
SubTasksAssignedAsPotentialOwner, TasksOwned,
TasksAssignedAsPotentialOwnerByGroup, GetSubTasksByParentTaskId,
TasksAssignedAsTaskStakeholder, UnescalatedDeadlines
I Depend On:
jboss.jca:service=DataSourceBinding,name=DroolsDatasource
Depends On Me:
jboss.j2ee:ear=DroolsSupport-Ear.ear,jar=DroolsSupportEjb.jar,name=WorkFlowResultServices,service=EJB
DroolsSupportJPA is a persistence unit independient of drools
But I don't use anything for drools persistence, What happend?
PEDRO MARIA BUITRAGO MANTILLA
Bogotá, Colombia
15 years, 9 months