getWorkingMemoryEntryPoint returns NULL
by Malinda Kaushalye
Dear All,
It appears to be that the getWorkingMemoryEntryPoint() method returns NULL in my code given below.
Note that EventProcessingOption = STREAM and ClockType = "realtime" if that is of any importance.
Cheers,
Malinda
public class EventKnowledgeBase { private KnowledgeBase kbase = null; private StatefulKnowledgeSession ksession = null; private WorkingMemoryEntryPoint globalStream = null;
public EventKnowledgeBase() throws Exception {
super();
kbase = readKnowledgeBase();
ksession = kbase.newStatefulKnowledgeSession();
KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
config.setOption( EventProcessingOption.STREAM );
KnowledgeSessionConfiguration kbSessionConfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
kbSessionConfig.setOption( ClockTypeOption.get("realtime") );
globalStream = ksession.getWorkingMemoryEntryPoint( "global" );
if(null == globalStream){
System.out.println("WorkingMemoryEntryPoint is Null"); //YEAH..! IT RETURNS NULL
}
}
}
14 years, 10 months
Negating a result
by djb
Hi,
I've been playing with Drools for a few weeks now, using rule templates, but
using mostly Java with eval(). I am now trying to re-write my program in
DRL, (to get that sweet RETE working).
I've got a situation where my rules are either "may not be" or "must be" in
the condition.
In Java, I work out everything assuming "may not be", and in the last line,
return (negationMod ? result : !result);
But in DRL... i'm a bit lost. I guess I'll have to split up the rule
templates, one for "may not be" and one for "must be"? Is there a better
way?
Regards
Daniel
--
View this message in context: http://n3.nabble.com/Negating-a-result-tp212559p212559.html
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 10 months
guvnor - dsl rule editor - using ":" in text box
by John Walker
All,
I have a DSL sentence that looks like this:
[when]- and var9 matches {v9}=field9!=null, field9 matches "{v9}"
When using the Guvnor guided rule editor, I add the "- and var9 matches
{v9}" DSL sentence to the rule, giving me a WHEN condition like this:
- and var9 matches [text box]
I want to put a URL in the text box, but anytime I use a value
containing a colon":",
I get a popup box with error message "The value [some value with a
colon] is not valid for this field"
Example:
DSL in rule, using guvnor guided editor: "- and var9 matches
[http://google.com]"
Popup error message: "The value http://google.com is not valid for
this field"
What needs to happen to allow a value with a colon? I did not have this
problem with drools4 and JBRMS.
Thanks,
John
14 years, 10 months
Similar question: changing operator from < to >
by djb
Hi,
I just asked a question about conditionally negating conditions, in the
DRL... and this question is similar, since it comes down to the lack of a
ternary operator.
I have rules where "LINK_OPERATOR" is either representative of >, == or <.
I am using a rule template, and the problem is that it's not the parameters
that change, but the conditions themselves that change based on this
LINK_OPERATOR.
If I call a function, then my chances for the RETE constant time evaluation
is shot.
Since this is a very fundamental part of the rules, must I again split my
rule template into 3 parts? Then with the negation option, I'll need to
double that to 6 templates? And if I have more operators, I'll have to
multiply that in too?
So, if speed is important, should I split the template?
Regards,
Daniel
--
View this message in context: http://n3.nabble.com/Similar-question-changing-operator-from-to-tp212583p...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 10 months
Verifier Question
by J Michael Dean
Does anyone have a succinct example of using verifier on a DRL or knowledge base? This is a nice feature in Guvnor and I thought it should be easy in the Eclipse environment to create a simple plugin that would gobble up the knowledge base and spit out the report. Thanks.
- Mike
14 years, 10 months
Ruleflow diagram customization
by J Michael Dean
Playing around on Macintosh I selected Drools preference to allow customization of nodes in Drools rule flows, and after restart, the properties view then had a color attribute. Changing the color attribute has no effect on the diagram, but then I received an error during execution indicating that the color attribute was not permitted. I manually deleted this attribute and all was the same as before.
Then I checked it out on a Windows machine which refused to open the rule flow because there was no toType on the constraints. (The Mac did not care). Went back and reproduced the behavior, which is that allowing customization and making a change in the color eliminated ALL references for toType="DROOLS_DEFAULT" in the rf file, and on the Windows platform, this was not readable.
Am sure that this is a "feature in evolution" but perhaps the preferences dialog should be altered so as to not allow the user to commit this crime.
J Michael Dean
mdean77(a)comcast.net
14 years, 10 months
How to query a stream of events with a dynamic event pattern
by Malinda Kaushalye
Dear All,
I have been trying to figure our the best strategy to query a stream of events.
Basically what I need to do is match a given event pattern based on the events injected to the working memory so far.
Event pattern is a simple expressions like (EventId=001 && EventId=023 ). I need to support AND, OR, XOR relationships of two pr more events.
e.g. (EventId=001 && EventId=023 ) || EventId=013
All the input events are of the same type but can be distinguished based on its Id attribute. They keep coming from a event source.
The event patterns are formed dynamically. These dynamic event patterns are evaluated like a query against the events so far recorded in working memory.
Im sure this is is usual requirement and there is a simple answer from Drools fusion. But so far failed to do it and now Im investigating drools template too.
If anyone has done this earlier OR know a solution for this I highly appreciate if you can share it.
Cheers,
Malinda
__________________________________________________________________________________
Yahoo!7: Catch-up on your favourite Channel 7 TV shows easily, legally, and for free at PLUS7. www.tv.yahoo.com.au/plus7
14 years, 10 months
Event Streams
by Glenn Macgregor
Hi All...again,
I am slowly working through my testcase and it seems to be going OK so far. My question is about stored events, @expires set to 1d for instance, and processing rules.
declare ParameterUpdateEvent
@role(event)
@expires(1d1h)
End
rule "Print Average"
no-loop true
when
ParameterUpdateEvent($paramName : name, $newParamValue : value)
from entry-point "ParamUpdateStream"
$param : Parameter(name == $paramName)
$averageUpdateValue : Number(doubleValue >= 1) from accumulate(
ParameterUpdateEvent(name == $paramName, $value : value)
over window:time(15m)
from entry-point "ParamUpdateStream", average($value))
#Number($averageUpdateValue : doubleValue)
then
#System.out.println("Here");
System.out.println("Average update value for " + $paramName +
" = " + $averageUpdateValue);
end
Inside my unit test I add a single event to the stream and this rule fires and prints the average value...which is the value of the last update because it is the first event is has seen. I send in another event with a different value and this rule fires twice and prints the correct value both times. From what I can gather this is due to the fact that there are 2 events on the stream at this point even though I have processed one already.
What is the best practice to handling only the last event on a stream? Since the documentation states that events should be immutable I can't add a processed flag.
Thank you for all your support thus far.
Glenn
14 years, 10 months
JMS/Pipeline how to get the result out of it?
by jschmied
Hi!
I'm implementing a architecture where Drools is behind a Oracle Message
Queue.
I have already done a OracleJmsMessenger because I use it without a
Appserver (JNDI/Context) and I'd like to use the Oracle XMLType as message
payload. (Dosn't work with vanilla JMS)
My pipeline consists of:
PipelineFactory.newStatefulKnowledgeSessionPipeline(ksession);
Action unwrapObjectStage = new OracleJmsUnwrapAdtObject();
PipelineFactory.newJaxbFromXmlTransformer(unmarshaller);
PipelineFactory.newStatefulKnowledgeSessionInsert();
Action resultHandlerStage = PipelineFactory.newExecuteResultHandler();
Service messenger = new OracleJmsMessenger(pipeline, ds, factory);
messenger.start();
new Thread(new Runnable() {
public void run() {
ksession.fireUntilHalt();
messenger.stop();
System.out.println("#### READY####");
}}).start();
I can send messages throu the queue and the they go into the KB and they are
processed.
But: how can I get the result out of the KB? The ExecuteResultHandler gets
executed immediately after the message in the KB and it gets a Map with the
current Objects from my Workspace. The KB is still fireing rules...
How can I retrive the result of the processing and where from do I know
which result is from which input message? Everything runs within one
seeesion...
Thanks
Jürgen
--
View this message in context: http://n3.nabble.com/JMS-Pipeline-how-to-get-the-result-out-of-it-tp20249...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 10 months