Hmm, this seems like a bug... may I ask you please to open a JIRA and
attach your test case?

  Thank you,
   Edson

2007/7/12, hare ram <[EMAIL PROTECTED]>:

Hello everyone,

The rules I wrote are


rule "Test 1 Rule"
    salience 1000
    when
        Line ( $admin : line)
        eval (
$admin.matches("[EMAIL PROTECTED]>]\\s*show\\s+interface[s]*\\s*$"))
        Line ( $lineSecond : line)
        eval (
$lineSecond.matches("^\\s*(\\S+)\\s+is\\s+(up|down|administratively
down),\\s*line\\s+protocol\\s+is\\s+(up|down)\\s*$"))
        device : Device()
    then
        System.out.println
("********************************************");
        device.setVendorType("Foundry");

end

rule "Juniper Show Interface CanIParse() Rule"
    salience 5000

    when
        Line ( $regex : line)
        eval (
$regex.matches("[EMAIL PROTECTED]>]\\s*show\\s+interface[s]*\\s*$"))
        Line ( $lineStr : line)
        eval (
$lineStr.matches("^.*\\s*Physical\\s+interface:\\s*([^,\\s]+),\\s+([^,]+),.*$"))

        device : Device()
    then
        System.out.println
("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        device.setVendorType("Juniper");
end


Basically the rules are searching for two regular expressions, of which
one is same for the both of the rules.But when i write the rules like the
above
I do not get the correct o/p, but however if i change my rules to (bold)
as below, I get the correct output.So is it necessary the the declaration
has
to be same if the both the rules have same regex

rule "Test 1 Rule"
    salience 1000
    when
        Line ( $regex : line)
        eval ( $regex.matches("[EMAIL 
PROTECTED]>]\\s*show\\s+interface[s]*\\s*$"
))
        Line ( $lineSecond : line)
        eval (
$lineSecond.matches("^\\s*(\\S+)\\s+is\\s+(up|down|administratively
down),\\s*line\\s+protocol\\s+is\\s+(up|down)\\s*$"))
        device : Device()
    then
        System.out.println
("********************************************");
        device.setVendorType("Foundry");

end

rule "Juniper Show Interface CanIParse() Rule"
    salience 5000

    when
        Line ( $regex : line)
        eval (
$regex.matches("[EMAIL PROTECTED]>]\\s*show\\s+interface[s]*\\s*$"))
        Line ( $lineStr : line)
        eval (
$lineStr.matches("^.*\\s*Physical\\s+interface:\\s*([^,\\s]+),\\s+([^,]+),.*$"))

        device : Device()
    then
        System.out.println
("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        device.setVendorType("Juniper");
end

Thanks
Shiva

_______________________________________________
rules-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-dev




--
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3529-6000
 Mobile: +55 11 9287-5646
 JBoss, a division of Red Hat @ www.jboss.com
_______________________________________________
rules-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-dev

Reply via email to