3 Replies Latest reply on Nov 28, 2007 12:20 PM by Jeff DeLong

    DRool syntax

    David Sun Newbie

      rule "Missing Executing Broker "
      salience 10
      when
      m : Message ()
      xpathEmpty "/olcmf/olcmfMessage/messageData/dataRecord/tradeRecord/tradeParties/executingBroker"
      then
      m.getBody().add("DiscountObject","10%");
      Log : "~~~~1 Missing Executing Broker";

      end

      WHat's wrong with the above rule syntax? It can't get parsed.

        • 1. Re: DRool syntax
          Jaroslaw Kijanowski Newbie

          Do you have:
          expander XPathLanguage.dsl
          after your import statements?

          Moreover xpathEmpty is not defined yet, please see the Content Based Routing Guide for more informations, define "xpathEmpty" and share with us :)

          • 2. Re: DRool syntax
            David Sun Newbie

            rule "Missing Executing Broker "
            salience 10
            when
            xpathEmpty "/olcmf/olcmfMessage/messageData/dataRecord/tradeRecord/tradeParties/executingBroker"
            then
            Log : "~~~~1 Missing Executing Broker";

            end

            The above rule works perfect. I defined xpathEmpty in my own class.

            But after I added m : Message() in when section, I get rule parse problem.

            rule "Missing Executing Broker "
            salience 10
            when
            m : Message()
            xpathEmpty "/olcmf/olcmfMessage/messageData/dataRecord/tradeRecord/tradeParties/executingBroker"
            then
            Log : "~~~~1 Missing Executing Broker";

            end

            • 3. Re: DRool syntax
              Jeff DeLong Master

              While it would help to see the error, most likely it is a result of mixing DRL syntax with DSL syntax. I.e.,

              m : Message()
              


              is DRL syntax.

              If you want to add a constraint that the message exists (not sure why you would want to do this since the CBR will always insert a message), you would need to add this to the XPathLanguageDSL.

              [when]There is a message=m : Message()