decision table problem Reg:
by Murali Venugopal
hi,
i'm facing a problem with decision tables. i've got a .drl working file.
but when i happen to take that into a .xls file ( decision table ) it
throws some errors.
my actual rule in .drl file has got something like this.
when
$event : RouteEvent( nodeIp == "192.168.1.12 )
$varbind : Varbind ( oid == ".1.3.6.1.2.1.2.2.1.1.0" && value ==
"5" ) from $event.varbindings
then
System.out.println("some text")
here in my decision table, my first cell would have the first condition
$event : RouteEvent
nodeIp == "$param"
that is, i've to omit my "(" and ")" braces.
so now, my second condition is
$varbind : Varbind
( oid == "$1" && value == "$2" ) from $event.varbindings
here i don't know how to omit the "(" and ")" braces. or should i add
and other layer of those braces.
anyway, the decision table is not working, where as my rule file does.
the error message is
error java.lang.RuntimeException: [10,55]: [ERR 102] Line 10:55
mismatched input 'FROM' expecting ')' in rule "210.210.122.100 GroupA"
in pattern Varbind[10,77]: [ERR 102] Line 10:77 mismatched input ')'
expecting 'then' in rule "210.210.122.100 GroupA"
my doubt is,
in the first case all my condition expression is contained with in
braces. where as in second case, it's not. so how do i've to handle
this. do i've have to omit the braces in the second case or not.
please help me. i've been struggling to solve this error. also, i
couldn't find references in the documentation.
thanks in advace.
_ _ _ _ |.
| | ||_|| (_||| \/
Whoever wants to be happy, let him be so: of tomorrow there's no knowing
Get your world in your inbox!
Mail, widgets, documents, spreadsheets, organizer and much more with your Sifymail WIYI id!
Log on to http://www.sify.com
********** DISCLAIMER **********
Information contained and transmitted by this E-MAIL is proprietary to
Sify Limited and is intended for use only by the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If this is a
forwarded message, the content of this E-MAIL may not have been sent with
the authority of the Company. If you are not the intended recipient, an
agent of the intended recipient or a person responsible for delivering the
information to the named recipient, you are notified that any use,
distribution, transmission, printing, copying or dissemination of this
information in any way or in any manner is strictly prohibited. If you have
received this communication in error, please delete this mail & notify us
immediately at admin(a)sifycorp.com
13 years, 10 months
Drools 5.1 JMX Monitoring.
by Benson Fung
Hi ,
As I understand, Drools 5.1 made API enhancement to support JMX standard and
enables knowledge base and knowledge session monitoring and inspection using
any JMX console.
It also can display the average firing time. How to implement this? Is
there any sample for this? Please advise.
Thanks
13 years, 10 months
how do I add not exists contraint in dslr
by maverik j
Hi,
I have been trying to add not exists constraint in dslr but its failing to
parse the dslr. Here is what I am trying to do in DSLR
[when][][*Tt*]here is at least one {entity}= not(exists {entity}:
{entity}())
If I simply use the exists constraint here then it works well. But then
after adding not to it, its not getting parsed correctly.
error I am geeting is:
[10,27]: [ERR 102] Line 10:27 mismatched input ',' expecting ')' in rule
"Rule1" in pattern Person
not sure whats going wrong here, if it is expected to work this way?
thanks,
-m
13 years, 10 months
Incorrect output for double values on German Window
by nagarajt
I have a drl file with contents
Sample.drl
------------------
package DecisionTable;
import bre.Number;
rule "DecisionTable #1: (Number.number <'4.3')"
salience 0
when
number:Number(
number< 4.3)
then
number.setText(number.getNumber().toString()+" < 4.3");
end
rule "DecisionTable #2: (Number.number >'10.0')"
salience 0
when
number:Number(
number> 10.0)
then
number.setText(number.getNumber().toString()+" > 10.0");
end
rule "DecisionTable #3: (Number.number 'between 4.3 and 10.0')"
salience 0
when
number:Number(
number>=4.3 ,
number<=10.0)
then
number.setText(number.getNumber().toString()+" is between 4.3 and 10.0");
end
Number.java
-------------------
package bre;
public class Number {
public Double number;
public Double getNumber() {
return number;
}
public void setNumber(Double number) {
this.number = number;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String text;
}
If I use Windows XP ( Regional Language settings in Control Panel to
English(United States)) rules are firing correctly
Input Output
4.6 4.6 between 4.3 and 10.0
3.3 3.3 < 4.3
7.5 7.5 between 4.3 and 10.0
11.2 11.2 > 10.0
But If use German Windows XP (Regional Language settings in Control Panel to
German(Germany) rules are not firing correctly
Input Output
4.6 4.6 < 4.3
3.3 3.3 < 4.3
7.5 7.5 < 4.3
11.2 11.2 < 4.3
I am using Drools 5.0.1 version. Any specific configuration settings
required for German Windows XP to get correct output?
Please reply back. it is urgent.
Thanks in advance
Nagaraj
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Incorrect-output-for-...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Drools Content Based Routing with Camel (John Ellis)
by Mark Proctor
http://blog.athico.com/2011/01/drools-content-based-routing-with-camel.html
Drools Content Based Routing with Camel (John Ellis)
<http://blog.athico.com/2011/01/drools-content-based-routing-with-camel.html>
John Ellis has done a nice writeup of his work on improving Drools to
work with Camel for CBR. You'll need to use the latest version of Drools
from trunk, which can be found in the maven repository that's
5.2.0-SNAPSHOT,
https://repository.jboss.org/nexus/content/groups/public/org/drools/.
For bonus points I'd love to see a further Drools and Camel tutorial
around OSGi's EventAdmin, http://camel.apache.org/eventadmin.html <http://>.
One of Camel's greatest strengths is the explicit support for Enterprise
Integration Patterns <http://www.eaipatterns.com/toc.html>. Drools
itself is particularly well suited to work alongside Camel to implement
two commonly used integration patterns: the Content Based Router and the
Dynamic Router. Both patterns leverage the ability of a Drools Endpoint
to rapidly evaluate properties of a message, while the Dynamic Router
can also integrate the Drools Policy as a dynamic rule based on feedback
from a control channel.
The Camel routes required for message routing do not differ much from
the previous Drools Endpoint example. You may even be able to omit the
Drools Policy if you wish to inspect only the headers of messages being
routed instead of interrogating the body of each message. For example, a
DRL could be defined that takes action on inbound messages such as:
import org.apache.camel.Message;
rule "WriteOperations"
when
$message : Message(headers["OPERATION"] == "WRITE");
then
$message.setHeader("routingSlip", "activemq:queue:op.write");
end
rule "ReadOperations"
when
$message : Message(headers["OPERATION"] == "READ");
then
$message.setHeader("routingSlip", "activemq:queue:op.read");
end
Example 1: DRL for Routing Based on Message Headers
Here the custom header "OPERATION" is evaluated to see if it is set to
the value "WRITE" or "READ." Depending on the value of this header, a
routing slip is defined for the message. The Routing Slip is another
Enterprise Integration Pattern supported by Camel that may contain one
or more URIs. The message is then sequentially sent to each URI defined.
The Camel routing itself is simply defined as:
<route>
<from uri="activemq:queue:router"/>
<to uri="drools:brokerNode/cbrKSession?action=insertMessage"/>
<routingSlip uriDelimiter="#">
<header>routingSlip</header>
</routingSlip>
</route>
Example 2: Camel Routes for Content Based Routing
Here we explicitly inform Camel that routing slips are defined as values
within the "routingSlip" header and each URI is delimited by a #
character. The headers set within the DRL are then interpreted as each
message exits the Drools endpoint.
Content based routing with a Drools Endpoint offers several advantages
over Camel's default implementation. The DRL format itself allows
routing to be specified more succinctly than Sprint DSLs or Camel
RouteBuilders. Conditional operations are also evaluated more
efficiently within Drools and are thread-safe, allowing a high volume of
messages to be routed concurrently.
13 years, 10 months
Guvnor and dynamic classes...
by bob.breitling
Hello all,
We have a situation where we need the Guvnor to extend a classes getters and
setters dynamically using Reflection, so the list of fields in the
Constraints GUI will show many fields that are not part of the concrete
class.
Is there an API to modify the Guvnor in this way? or do we need to just get
the sources and start hacking? Is this something that could be done easily?
I already have the code to dynamically add the getters and setters to a
class on the fly. I just need to add it to the Guvnor.
Thanks in advance.
Bob
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-and-dynamic-cl...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Integrating Guvnor with Oracle 11g
by ergh99
Has anyone tried this? I'm trying to configure Guvnor to store its
repository in an Oracle 11g database, but having no luck. Wanted to know if
anyone has had experience with this combination.
--
David Stern
Blaze & J2EE specialist
mobile: 904.874.2685
13 years, 10 months
Need help with Decision Table Conditions
by Jason Mihalick
I have a decision table with the conditions shown in the graphic below. When
Drools attempts to compile the spreadsheet I get the following errors:
nested exception is java.lang.RuntimeException: Unable to return Declaration
for identifier '$pgMeta' : [Rule name='Section Head Spacing_18']
Unable to create restriction '[VariableRestriction: == $pgMeta ]' for field
'pageMeta' in the rule 'Section Head Spacing_18' : [Rule name='Section Head
Spacing_18']
Unable to build expression for 'from' : [Error: Failed to compile: 2
compilation error(s):
- (1,7) unqualified type in strict mode for: $pgMeta
- (1,22) unable to resolve method using strict-mode:
java.lang.Object.getLineMetas()]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0] '$pgMeta.getLineMetas()' : [Rule name='Section Head
Spacing_18']
http://drools-java-rules-engine.46999.n3.nabble.com/file/n2195003/Picture...
The LHS of a hand-coded rule for this, is as follows:
when
$pageMeta : PageMeta()
$bodyLines : LineMeta( pageMeta == $pageMeta, lineType == LineType.BODY
)
from $pageMeta.getLineMetas()
$bodyLine : LineMeta( previousPageMetaComponent != null,
previousPageMetaComponent == previousLineMeta,
previousLineMeta.lineType ==
LineType.SECTION_HEAD,
verticalSpacingToPreviousPageMetaComponent <
5.9525 ) from $bodyLines
Can this rule be created in a Decision table or not? Your help is most
appreciated!
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decisi...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months