How to do validation of facts in a Stateful Session?
by Stephen Mcgruer
Hi there,
My project uses Drools to (among other things) validate new
facts/updates to old facts, according to a set of rules. (For example,
we might have a rule that says "No two people can be named the same
thing".) Our method of validation and error reporting was originally
chosen for a stateless session (before we had the requirement of doing
checks like the above), and I feel I've had to hack it a bit much to
get it working with stateful sessions. The current methodology is:
1. (Website) The user inserts/updates a fact.
2. (Java) If the fact is new, an object is created for it. If it is an
update, the pre-existing object is fetched from the object repository
(the interface to the database) and a backup copy of the object is
taken.
3. (Java) This fact is either inserted into the KnowledgeBase (KB) or
a pre-existing fact in the KB is updated depending.
4. (Rules) If the new/updated object fails a validation rule, it will
be retracted and a ValidationError object will be inserted into the KB.
5. (Java) The code then searches for ValidationError objects that
match the just inserted/updated object. If it finds any it records
them and then retracts them from the KB.
6. (Java) If there are no errors, then that's it - a success report is
generated and passed back to the website.
7. (Java) If there were errors, then if the user was updating a fact
the backup of it (before the changes) is inserted back into the KB.
The website is then passed a failure report.
It just feels very hacky to do so much manual insertion/retracting
from the Java side of the code.
So, is there a 'correct' way to do stateful validation? And does our
current way even work, or are there hidden problems that we've not
spotted?
Cheers,
Stephen
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
15 years, 3 months
Drools Guvnor
by Rajesh R.V - ESA
I am working with OTA model, and I have around 2800 classes in my model.
When I open the technical editor, looks like it introspects all classes
to show the fact types.
It is taking a long time. I want to switch off this and I don't want to
see the fact types at all. Which class I need to change.
Regards
RV
15 years, 3 months
Fwd: Retrieve values from a Map
by Wolfgang Laun
Since this was sent to me only, I feel I ought to forward it to the list.
I do like "f*u*ntastic" :-)
-W
---------- Forwarded message ----------
From: Manav <manav7574(a)yahoo.com>
Date: 12 August 2010 05:41
Subject: Re: [rules-users] Retrieve values from a Map
To: Wolfgang Laun <wolfgang.laun(a)gmail.com>
[snip]
Really appreciate it . I must the Drools is just funtastic and the Drools
Team
even better :)
Regards,
Manav
15 years, 3 months
Retrieve values from a Map
by Manav
I am new to drools and currently using version 5.1 for my testing.
I am facing an issue with retrieving a value from Map if a key is present
In my drl if i do this
$c : Client (language contains "Japanese" , lang : language ->
(language.get("Japanese").equals("Expert")))
it works ...but if i want to retrieve the value of the key i am not sure how to
go about it . I tried various approaches but none of them worked
i would like to do something like
$c : Client (language contains "Japanese", $langValue :
language.get("Japanese"))
Can some one please guide me how to go about it .
Regards,
Manav
15 years, 3 months
Drools 5.1 Update Site
by Georg Maier
Hi,
is there any reason why 5.1. final Eclipse Workbench is not put into an
Update Site? Sure it is possible just to drop in the content of the zip, but
I think Update Sites are far more comfortable :-)
Furthermore, there actually is an Update Site - but it's kind of empty...? On
purpose?
Any information would be appreciated :-)
Thanks in advance!
Cheers
Georg
15 years, 3 months
JpaManager - SingleSessionCommandService
by drooRam
Hi,
I am using bitronix transaction manager for oracle through tomcat... i
have set the transaction manager as follows :
<bean id="BitronixTransactionManager"
factory-method="getTransactionManager"
class="bitronix.tm.TransactionManagerServices"
destroy-method="shutdown" />
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="BitronixTransactionManager" />
<property name="userTransaction" ref="BitronixTransactionManager" />
</bean>
and finally passing this wrapped JtaTransactionManager to drools:ksession
tag, the following code has been invoked on SingleSessionCommandService for
the transactionManager ...
method initTransactionManager() on SingleSessionCommandService.java line #
218.
this tm class starts with "org.springframework", so it enters this block of
code..but it doesn't contains "jpa"
hence JPAManager (jpm) is not being initialized...i cud see the else block
is hanging in this code....
Result : NullPointerException on calling the reference this.jpm.....
Question is that how should i configure JpaTransactionManager or
JtaTransactionManager for Drools ?
i think that i followed a correct approach and there is a bug in
SingleSessionCommandService.java code?
Please advice. Thanks
-drooRam
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/JpaManager-SingleSess...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 3 months
Can't see process in gwt-console after changing guvnor to authenticator
by Han Ming Low
Hi,
I'm having problems with seeing the process in gwt-console. :p
This time the difference is I change the guvnor components.xml authenticator
to "other" and role based authorization as "true" and set the
login-config.xml authentication to a users.properties
The steps and difference in setup I have made is as follows
1) change guvnor and flow persistence to mysql instead of h2
2) Build defaultPackage, ABLE to see process in Drools Flow console
3) Shutdown both human task and jboss
4) Configure role-base authorization and users.properties file
authentication
5) Start human.task and jboss
6) Not able to see process in Drools Flow console
7) Rebuild defaultPackage
8) Not able to see process in Drools Flow console
9) Restart both human task and jboss
10) Not able to see process in Drools Flow console
11) Delete process in guvnor and delete archive
12) Copy process from local file system to guvnor through WebDAV
13) Build defaultPackage
14) Not able to see process in Drools Flow console
15) Shutdown both human task and jboss
16) Change login back to defaultAuthenticator.authenticate
17) Start human.task and jboss
18) ABLE to see process again
What should I do to allow the process to be seen when other authenticator is
used?
Any advice is greatly appreciated.
Thanks.
Han Ming
15 years, 3 months
drools in a SOA environment
by Dieter D'haeyere
I have some questions regarding the overall view of what is happening where
when using Drools in a service oriented environment.
This is the idea:
Some applications are making use of rules for some calculations. The idea
is to be able to call the rule engine as a service. Meaning: passing all
facts to the rule base and based on that, rules will be fired and the facts
will be updated. Rules will be called a lot so scalability is important.
Next to that: the conclusion part should be able to call other services, eg.
to do some calculations. An ESB is available so communication could go over
that bus.
Now: this is how I see it:
Drools Guvnor is the place where the rules are stored and managed. (war)
Drools Server is where the actual calculations take place. (war but... when
more load must be handled, multiple instance could be deployed).
The application does a SOAP call to Drools Server (passes facts and
commandos) and all is ok...
Well .. now the problem starts... I don't get it :)
I mean: how does Drools Server talk to the rule base ? I haven't found a
clear article (but probably it does exist, just didn't find it yet) where
this cooperation is demonstrated.
Also: I read about Camel / Spring / Rest which would be the new way to call
a service... So SOAP is no longer supported (or will be deprecated as of
Drools v5.x ?)
An overview and / or some best practices on how to design the architecture
would be welcome.
Btw, as I understand it now, Drools - grid will be the way to go. But that
will probably will be for version > 5.2.
And then again, I am confused about the split between the rule 'engine' (I
have been told that there is not such a thing as a big calculating engine)
and the rule repository.
I kind of would expect that those two could be coupled tightly together (ok,
there is probably a good reason why choices are made as they are, I am way
too newbie to interfere in any such discussion).
Sincerely,
Dieter D'haeyere.
15 years, 3 months