To jest stara wersja strony!


R2ML – Reverse Rule Markup Language powstał z inicjatywy REWERSE Working Group I1, w celu ułatwienia wymiany reguł między różnymi systemami oraz narzędziami.

Aby można było użyć R2ML’a do przedstawiania reguł potrzebna jest wiedza jak zapisywać typowe dla nich elementy. Przykładowo w R2ML ver.0.4:

  • wartość logiczna: np: B
<r2ml:GenericVariable r2ml:name="B"/>
  • stałe argumenty: np: 300
<r2ml:TypedLiteral r2ml:lexicalValue="300" r2ml:datatype="xs:integer"/>
  • suma: n+1
<r2ml:DatatypeFunctionTerm r2ml:datatypeFunction="op:numeric-add">
   <r2ml:dataArguments>
   <r2ml:GenericVariable r2ml:name="n"/>
      <r2ml:TypedLiteral r2ml:lexicalValue="1" r2ml:datatype="xs:integer"/>
   </r2ml:dataArguments>
</r2ml:DatatypeFunctionTerm>
  • różnica: n-1
<r2ml:DatatypeFunctionTerm r2ml:datatypeFunction="op:numeric-subtract">
  <r2ml:dataArguments>
   <r2ml:GenericVariable r2ml:name="n"/>
       <r2ml:TypedLiteral r2ml:lexicalValue="1" r2ml:datatype="xs:integer"/>
  </r2ml:dataArguments>
</r2ml:DatatypeFunctionTerm>
  • równość: (wyr_1) = (wartosc)
<r2ml:EqualityAtomr2ml:isNegated="false">
   <r2ml:ObjectVariabler2ml:name="wyr_1"/>
   <r2ml:ObjectVariabler2ml:name="wartosc"/>
</r2ml:EqualityAtom>
  • nierówność: n > 0
<r2ml:DatatypePredicateAtomr2ml:datatypePredicateID="swrlb:greaterThan">
  <r2ml:dataArguments>
  <r2ml:GenericVariable r2ml:name="n"/>
    <r2ml:TypedLiteral r2ml:lexicalValue="1" r2ml:datatype="xs:integer"/>
  </r2ml:dataArguments>
</r2ml:DatatypePredicateAtom>
  • nierówność: n ⇐ 1
<r2ml:DatatypePredicateAtomr2ml:datatypePredicateID="swrlb: lessThanOrEqual ">
  <r2ml:dataArguments>
  <r2ml:GenericVariable r2ml:name="n"/>
     <r2ml:TypedLiteral r2ml:lexicalValue="1" r2ml:datatype="xs:integer"/>
  </r2ml:dataArguments>
</r2ml:DatatypePredicateAtom>
  • suma logiczna : (wyr_1) and (wyr_2)
<r2ml:GenericAtom r2ml:isNegated="false" r2ml:predicateID="wyr_1">
  <r2ml:arguments>
  </r2ml:arguments>
  </r2ml:GenericAtom>
  <r2ml:GenericAtom r2ml:isNegated="false" r2ml:predicateID="wyr_2">
  <r2ml:arguments>
  </r2ml:arguments>
</r2ml:GenericAtom>
  • warunek if : (conclusion) if (conditions)
<r2ml:DerivationRule>
<r2ml:conditions>
     (conditions)
</r2ml:conditions>
<r2ml:conclusion>
     (conclusion)  
</r2ml:conclusion>
</r2ml:DerivationRule>
  • funkcje: fun_name(B)
<r2ml:GenericFunctionTermr2ml:genericFunctionID=" fun_name ">
  <r2ml:arguments>
  <r2ml:GenericVariabler2ml:name="B"/>
  </r2ml:arguments>
</r2ml:FunctionTerm>

Teraz możemy spróbować zapisać nasz przykład (Jeżeli dzień=poniedziałek wtedy temp=20st) za pomocą R2ML. Przedstawmy go w postaci:

	temp = 20    if    day = monday

wówczas zapis w R2ML wyglada następująco:

<?xml version="1.0" encoding="UTF-8" ?>
<r2ml:RuleBase xmlns:r2ml="http://www.rewerse.net/I1/2006/R2ML"
          xmlns:r2mlv="http://www.rewerse.net/I1/2006/R2ML/R2MLV"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xs="http://www.w3.org/2001/XMLSchema" 
          xmlns:userv="http://www.businessrulesforum.com/2005/userv#" 
          xmlns:swrlb="http://www.w3.org/2003/11/swrlb"
          xsi:schemaLocation="http://oxygen.informatik.tu-cottbus.de/R2ML/0.5/R2ML.xsd">
 
<r2ml:DerivationRuleSet>
<r2ml:DerivationRule r2ml:ruleID="Rule" xmlns:swrlb="http://www.w3.org/2003/11/swrlb" xmlns:srv="http://www.services.org/EU-Rent/">
   <r2ml:Documentation>
    <r2ml:RuleText r2ml:textFormat="plain"  r2ml:ruleDiagram="examples:DR_scheduledService.gif">
      If day is a monday then temp is equal to 20 degrees.
    </r2ml:RuleText>
   </r2ml:Documentation>
   <r2ml:conditions>
     <r2ml:ObjectClassificationAtom r2ml:classID="monday">
      <r2ml:ObjectVariable r2ml:name="day"/>
     </r2ml:ObjectClassificationAtom>
   </r2ml:conditions>
   <r2ml:conclusion>
    <r2ml:DatatypePredicateAtom r2ml:datatypePredicateID="swrlb:equal">
     <r2ml:dataArguments>
      <r2ml:ObjectVariable r2ml:name="temp"/>
      <r2ml:TypedLiteral r2ml:lexicalValue="20" r2ml:datatypeID="xs:positiveInteger"/>
     </r2ml:dataArguments>
    </r2ml:DatatypePredicateAtom>
   </r2ml:conclusion>
  </r2ml:DerivationRule>
</r2ml:DerivationRuleSet>
</r2ml:RuleBase>

Powrót

Materiały

pl/miw/miw08_hml_rules/r2ml.1211196523.txt.gz · ostatnio zmienione: 2019/06/27 15:59 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0