To jest stara wersja strony!
R2ML – Rewerse 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ć RIF’a do przedstawiania regół potrzebna jest wiedza jak zapisywac typowe dla nich elementy. Przykładkowo w R2ML ver.0.4:
<r2ml:GenericVariable r2ml:name="B"/>
<r2ml:TypedLiteral r2ml:lexicalValue="300" r2ml:datatype="xs:integer"/>
<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>
<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>
<r2ml:EqualityAtomr2ml:isNegated="false">
<r2ml:ObjectVariabler2ml:name="wyr_1"/>
<r2ml:ObjectVariabler2ml:name="wartosc"/>
</r2ml:EqualityAtom>
<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>
<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>
<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>
<r2ml:DerivationRule>
<r2ml:conditions>
(conditions)
</r2ml:conditions>
<r2ml:conclusion>
(conclusion)
</r2ml:conclusion>
</r2ml:DerivationRule>
<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>