<?xml version="1.0" standalone="no"?>
<!DOCTYPE rulebase SYSTEM "http://www.dfki.de/ruleml/dtd/0.8/ruleml-hornlog.dtd">


<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  The RuleML Discount Example using Hornlog                    -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->


<rulebase>


<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  Rule label: discountrule1b                                   -->
<!--  The discount for a customer buying a product is 5.0 percent  -->
<!--  if the customer is premium and the product is regular.       -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->

<imp>
   <_head>
      <atom>
         <_opr><rel>discountrule1b</rel></_opr>
         <var>Customer</var>
         <var>Product</var>
         <cterm>
            <_opc><ctor>percent</ctor></_opc>
            <ind>5.0</ind>
         </cterm>
      </atom>
   </_head>
   <_body>
      <atom>
         <_opr><rel>premium</rel></_opr>
         <var>Customer</var>
      </atom>
      <atom>
         <_opr><rel>regular</rel></_opr>
         <var>Product</var>
      </atom>
   </_body>
</imp>


<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  Rule label: statusrule1b                                     -->
<!--  A customer is premium if their spending has been             -->
<!--  at least  5000 dollars in the previous year.                 -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->

<imp>
   <_rlab><ind>statusrule1b</ind></_rlab>
   <_head>
      <atom>
         <_opr><rel>premium</rel></_opr>
         <var>customer</var>
      </atom>
   </_head>
   <_body>
      <atom>
         <_opr><rel>spending</rel></_opr>
         <var>customer</var>
         <cterm>
            <_opc><ctor>atleast</ctor></_opc>
            <cterm>
               <_opc><ctor>dollar</ctor></_opc>
               <ind>5000</ind>
            </cterm>
         </cterm>
         <ind>"previous year"</ind>
      </atom>
   </_body>
</imp>

<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  FACT 1: A Honda is regular.                                  -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->

<fact>
    <_head>
       <atom>
          <_opr><rel>regular</rel></_opr>
          <ind>Honda</ind>
       </atom>
    </_head>
</fact>

<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->
<!--  FACT 2: Peter Miller's spending has been                     -->
<!--          at least 5000 dollars in the previous year.          -->
<!--  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  -->

<fact>
   <_head>
      <atom>
         <_opr><rel>spending</rel></_opr>
         <ind>"Peter Miller"</ind>
         <cterm>
            <_opc><ctor>atleast</ctor></_opc>
            <cterm>
               <_opc><ctor>dollar</ctor></_opc>
               <ind>5000</ind>
            </cterm>
         </cterm>
         <ind>"previous year"</ind>
      </atom>
   </_head>
</fact>

</rulebase>
