Performing Hibernate NativeSQLQuery in Drools
by Roopa
Hi,
I need some inputs on integrating Hibernate with Drools platform.
Please do help me executing nativeSQLQuery of Hibernate in Drools DRL file
In Java file, setting the session as global parameter in Drools
droolsSession.setGlobal("hibernateSession", session);
and in the DRL file, in when clause I am trying to execute the Native SQL
Query
Order() from hibernateSession.createSQLQuery("SELECT id FROM
Order").list(); // this query will give the list of orderId s from RDBMS.
Here, Order() is a POJO class (Entity) mapping to Order table.
When executed, I found the Order() entity is not populated with the id
values from the query.
Can some one help me with the tutorial which speaks about Quering DB via
Hibernate NativeSQL Query in Drools.
--
View this message in context: http://drools.46999.n3.nabble.com/Performing-Hibernate-NativeSQLQuery-in-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
new Kie API and RuleMatrixSheetListener()
by Ramon Buckland
Hi,
I am looking at the new Kie API and I am trying to work out how I tell it / Drools that I have a RuleMatrixSheet ..
https://github.com/droolsjbpm/drools/blob/master/drools-decisiontables/sr...
This was the old way (a bit manual)
final SpreadsheetCompiler converter = new SpreadsheetCompiler();
final InputStream stream = this.getClass().getResourceAsStream( "/path/to/spreadsheet.xls" );
final String drl = converter.compile( stream,
InputType.XLS,
new RuleMatrixSheetListener() );
Is there an example of a matrix style Spreadsheet being used to generate the rules, with the new Kie APIs ?
I can't seem to find similar concepts on the ResourceFactory API, or on "Resource"
Version 5 and version 6 don't really "support" the Configuration object understanding the Matrix Style Rules table.
If it were to be implemented, it looks like :
org.kie.api.builder.KieFileSystem
needs some changes, to support the compilation of a Rule Matrix where write* is taking a Resource,
If there is not an Example, what do I need to "wire" together for this.
Any pointers are much appreciated.
Kind regards
Ramon
Ramon Buckland
ramon(a)thebuckland.com
11 years, 7 months
Using XMLGregorianCalendar for @timestamp metadata
by ScalaEnthusiast
I have an object that comes into a stream as an event and I want to use
@timestamp to specify the event time from the object.
Then field that has this information is an XMLGregorianCalendar called
timeStamp. If I specify this attribute with @timestamp(timeStamp) I get and
error saying that conversion to long from the XMLGregorianCalendarImpl is
not supported. Ok, I get that.
now, I can get a java Date by calling the following method chain on the
timeStamp object:
timeStamp.toGregorianCalendar().getCalendarDate()
specifying this in the @timestamp does not validate, presumably because
@timestamp is looking for an attribute (or chain of attributes) and not a
chain of method calls.
Is there anyway to specify a timestamp in the rule using an
XMLGregorianCalendar?
--
View this message in context: http://drools.46999.n3.nabble.com/Using-XMLGregorianCalendar-for-timestam...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Drools Accumulate function
by lyally
Hi,
I am new to Drools so please excuse me if this is a simple question.
I currently have several rules that look as follows (one for each entry
point):
The intention of these rules is to average the speed, occupancy and flow of
traffic at a particular road location over a 30 second sliding window. The
rule works fine as it is, however it is not very scalable since I currently
need a similiar rule and associated input stream for each road location that
I am monitoring. There may be 100s of these.
What I was really after was one rule that would perform the same averaging
calculations over the 30 second window. My first thoughts were that I would
need to lose the individuall input streams per location and thereby place
all of the TrafficData facts from all locations into working memory. But
then I was unsure how I would change the rule to group relevant TrafficData
instances by their location (Note that the TrafficData instance has a
location identifier within it) together before doing the averaging.
Any assistance would be much appreciated.
Regards,
Steve
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Accumulate-function-tp4023718.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Restricting the items included in a snapshot
by Lance Leverich
I am aware of how Guvnor can be told to only include assets with a given
state, during the build process. What I haven't been able to figure out is
a way to tell Guvnor to only include the items that were part of the latest
build, when creating a snapshot. Is there a way to do this? I am using
Guvnor 5.3.5.Final.
~ Lance
11 years, 7 months
How to find rules, that use special fields in their Condition
by mdzaebel
Hi,
the following code traverses rules and their conditions. However, I did not
find a method to find conditions, that match over a certain field of a
declared class. I know, that the rule API should be hidden for good reasons
(Mark Proctor).
for(Rule ruleDef : kb.getKnowledgePackages().iterator().next().getRules()) {
for(RuleConditionElement rce :
((RuleImpl)ruleDef).getRule().getLhs().getChildren()) {
for(Map.Entry<String, Declaration> entry :
rce.getInnerDeclarations().entrySet()) {
??
Thanks, Marc
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-find-rules-that-use-special-fiel...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Ways to list the globals
by Sonata
Hi, I am trying to list out the globals but I am confused, please help.
I wrote this line in my drl file
((MapGlobalResolver)drools.getKnowledgeRuntime().getGlobals()).getGlobals()
this gives me ONLY the globals that I have added in drl through
drools.getWorkingMemory().setGlobal()
this does not list out the globals that I have added in java before firing
the rules.
Then I tried this line in my drl file
drools.getKnowledgeRuntime().getKnowledgeBase().getKnowledgePackages().getGlobalVariables()
this gives me BOTH the globals that I have added in drl through
drools.getWorkingMemory().setGlobal()
AND the globals that I have added in java before firing the rules.
My question is, to list the useable globals in the current rule, what is the
correct method call?
Thank you
--
View this message in context: http://drools.46999.n3.nabble.com/Ways-to-list-the-globals-tp4023616.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months