Rule Examples

R2ML supports Integrity Rules (or constraints), Derivation Rules, Production Rules and Reaction Rules (or ECA Rules).

Using Strelka you can model rules visually:

Strelka serialize rules into the rule markup language R2ML:

<r2ml:ProductionRuleSet r2ml:ruleSetID="UServProductionRulesSet" 
                           xmlns:r2ml="http://www.rewerse.net/I1/2006/R2ML"
                           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                           xmlns:userv="http://www.businessrulesforum.com/2005/userv#"          
                           xmlns:op="http://www.xpath2operations.org/op#" 
                           xmlns:swrlb="http://www.w3.org/2003/11/swrlb"> 
<r2ml:ProductionRule r2ml:ruleID="AP_10">    
 <r2ml:conditions>      
  <r2ml:ObjectClassificationAtom r2ml:class="userv:MedicalCoverageOption">
    <r2ml:ObjectVariable r2ml:name="medicalCoverageOption" r2ml:class="userv:MedicalCoverageOption"/>       
  </r2ml:ObjectClassificationAtom>    
 </r2ml:conditions>    
 <r2ml:producedActionExpr>      
 <r2ml:UpdateActionExpression r2ml:property="userv:VehicleInsurancePolicy.premium">
  <r2ml:contextArgument>
   <r2ml:ObjectVariable r2ml:name="vehicleInsurancePolicy" r2ml:class="userv:VehicleInsurancePolicy"/>
  </r2ml:contextArgument>        
  <r2ml:DatatypeFunctionTerm r2ml:datatypeFunction="op:numeric-add">
   <r2ml:dataArguments>            
    <r2ml:AttributeFunctionTerm r2ml:attribute="userv:VehicleInsurancePolicy.premium">
     <r2ml:contextArgument>                
      <r2ml:ObjectVariable r2ml:name="vehicleInsurancePolicy" r2ml:class="userv:VehicleInsurancePolicy"/>
       </r2ml:contextArgument>            
      </r2ml:AttributeFunctionTerm>            
      <r2ml:TypedLiteral r2ml:lexicalValue="600" r2ml:datatype="xs:integer"/>
     </r2ml:dataArguments>        
    </r2ml:DatatypeFunctionTerm>      
   </r2ml:UpdateActionExpression>    
  </r2ml:producedActionExpr>  
 </r2ml:ProductionRule>
<r2ml:ProductionRuleSet>

You can translate rules into platform specific rule languages and execute them.