Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
pl:miw:miw08_xtt_r2ml [2008/06/14 21:20]
miw
pl:miw:miw08_xtt_r2ml [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Opis ======
 +__**Projekt zakończony**__
 +
 +Tomasz Pałosz - <​tomekpalosz@o2.pl>​
 +
 +
 +translacja XTTML -> R2ML 8-)
 +
 +XTTML - format, który ma powstać na bazie XTT. [[https://​ai.ia.agh.edu.pl/​wiki/​hekate:​hekate_concepts?​s=xtt#​xtt | XTT]] jest tabelarycznym sposobem reprezentacji wiedzy.
 +
 +R2ML - jest obszernym i wygodnym zestawem zasad XMLowych pozwalającym na
 +  * wymianę zasad pomiędzy różnymi systemami i programami.
 +  * wzbogacanie ontologi za pomocą zasad.
 +
 +====== Spotkania ======
 +[[https://​ai.ia.agh.edu.pl/​wiki/​pl:​miw:​miw08_xtt_r2ml:​spotkania|Spotkania]]
 +
 +
 +
 +
 +====== Projekt ======
 +
 +
 +
 +
 +
 +
 +
 +====== Sprawozdanie ======
 +
 +
 +XTTML - format, który ma powstać na bazie XTT.  XTT jest tabelarycznym sposobem reprezentacji wiedzy.
 +
 +R2ML - jest obszernym i wygodnym zestawem zasad XMLowych pozwalającym na
 +
 +    * wymianę zasad pomiędzy różnymi systemami i programami.
 +    * wzbogacanie ontologi za pomocą zasad.
 +
 +===== Przykład =====
 +Rule 1: (AE_PTC04): If all of the following are true, then the car's Potential Theft Rating is moderate:
 +    * car's price is between $20000 and $45000.
 +    * car model is not on the list of "High Theft probability Auto".
 +
 +Kod opisujący słownik dla podanej reguły:
 +<code xml>
 +   <​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://​www.rewerse.net/​I1/​2006/​R2ML ​
 +                             ​http://​oxygen.informatik.tu-cottbus.de/​R2ML/​0.4/​R2ML.xsd>​
 +    <​r2mlv:​Vocabulary>​
 +     <​r2mlv:​Class r2mlv:​ID="​Car">​
 +      <​r2mlv:​Attribute r2mlv:​ID="​price">​
 +       <​r2mlv:​range><​r2mlv:​Datatype r2mlv:​ID="​xs:​integer"/></​r2mlv:​range>​
 +      </​r2mlv:​Attribute>​
 +      <​r2mlv:​Attribute r2mlv:​ID="​fabricationYear">​
 +       <​r2mlv:​range><​r2mlv:​Datatype r2mlv:​ID="​xs:​integer"/></​r2mlv:​range>​
 +      </​r2mlv:​Attribute>​
 +     </​r2mlv:​Class>​
 +    </​r2mlv:​Vocabulary>​
 +    <!-- ... -->
 +   </​r2mlv:​RuleBase>​
 +</​code>​
 +
 +Kod opisujący podaną //​regułę//​ (R2ML):
 +<code xml>
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​AE_PTC04">​
 +    <​r2ml:​conditions>​
 +      <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​lessThanOrEqual">​
 +        <​r2ml:​dataArguments>​
 +          <​r2ml:​TypedLiteral r2ml:​datatypeID="​xs:​integer"​ r2ml:​lexicalValue="​20000"/>​
 +          <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​userv:​Car.price">​
 +            <​r2ml:​contextArgument>​
 +              <​r2ml:​ObjectVariable r2ml:​name="​car"​ r2ml:​classID="​userv:​Car"/>​
 +            </​r2ml:​contextArgument>​
 +          </​r2ml:​AttributeFunctionTerm>​
 +        </​r2ml:​dataArguments>​
 +      </​r2ml:​DatatypePredicateAtom>​
 +      <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​lessThanOrEqual">​
 +        <​r2ml:​dataArguments>​
 +          <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​userv:​Car.price">​
 +            <​r2ml:​contextArgument>​
 +              <​r2ml:​ObjectVariable r2ml:​name="​car"​ r2ml:​classID="​userv:​Car"/>​
 +            </​r2ml:​contextArgument>​
 +          </​r2ml:​AttributeFunctionTerm>​
 +          <​r2ml:​TypedLiteral r2ml:​datatypeID="​xs:​integer"​ r2ml:​lexicalValue="​45000"/>​
 +        </​r2ml:​dataArguments>​
 +      </​r2ml:​DatatypePredicateAtom>​
 +      <​r2ml:​AttributionAtom r2ml:​attributeID="​userv:​CarModel.highTheftProbability">​
 +        <​r2ml:​subject>​
 +          <​r2ml:​ObjectVariable r2ml:​name="​carModel"​ r2ml:​classID="​userv:​CarModel"/>​
 +        </​r2ml:​subject>​
 +        <​r2ml:​dataValue>​
 +          <​r2ml:​TypedLiteral r2ml:​lexicalValue="​false"​ r2ml:​datatypeID="​xs:​boolean"/>​
 +        </​r2ml:​dataValue>​
 +      </​r2ml:​AttributionAtom>​
 +    </​r2ml:​conditions>​
 +    <​r2ml:​producedAction>​
 +      <​r2ml:​AssignActionExpression r2ml:​propertyID="​userv:​Car.potentialTheftRating">​
 +        <​r2ml:​contextArgument>​
 +          <​r2ml:​ObjectVariable r2ml:​name="​car"​ r2ml:​classID="​userv:​Car"/>​
 +        </​r2ml:​contextArgument>​
 +        <​r2ml:​TypedLiteral r2ml:​lexicalValue="​moderate"​ r2ml:​datatypeID="​xs:​string"/>​
 +      </​r2ml:​AssignActionExpression>​
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 +</​code>​
 +Źródło przykładu: [[http://​oxygen.informatik.tu-cottbus.de/​rewerse-i1/?​q=node/​33]]
 +
 +[[http://​code.google.com/​p/​take/​source/​diff?​r=523&​format=side&​path=/​trunk/​R2MLAdapter/​testsrc/​test/​nz/​org/​take/​r2ml/​f/​rules.r2ml | Spory przykład USserv Derby]]
 +
 +===== Metamodel =====
 +
 +[[http://​oxygen.informatik.tu-cottbus.de/​R2ML/​0.5/​metamodel/​R2MLv0.5.htm]]
 +
 +
 +
 +
 +
 +===== Production Rule definition =====
 +
 +A production rule is a statement of programming logic that specifies the execution of one or more actions in the case that its conditions are satisfied. Production rules therefore have an operational semantic (formalizing state changes, e.g., on the basis of a state transition system formalism). The effect of executing production rules may depend on the ordering of the rules, irrespective of whether such ordering is defined by the rule execution mechanism or the ordered representation of the rules. The production rule is typically represented as:
 +
 +    if [condition] then [action-list]
 +
 +Some implementations extend this definition to include an "​else"​ construct as follows:
 +
 +    if [condition] then [action-list] else [alternative-action-list]
 +
 +although this form is not considered for PRR; all rules that contain an "​else"​ statement can be reduced to the first form without an "​else",​ and the semantics for interpreting when "​else"​ actions are executed may be complex in some Inferencing schemes. Note that this implies that a conversion from a PSM to a PIM might be complete but not reversible. Rules with "​else"​ statements in a PSM would result in multiple PIM rules which could not then be translated back into the original rules. The new rules would be functionally equivalent, however.
 +
 +
 +===== Translacje do innych formatów =====
 +Dostępne są następujące translacje z użyciem języka R2ML: [[http://​oxygen.informatik.tu-cottbus.de/​rewerse-i1/?​q=node/​15]]
 +
 +  * R2ML to F-Logic
 +  * F-LogicXML to R2ML
 +  * R2ML to Jess
 +  * R2ML to RuleML
 +  * RuleML to R2ML
 +  * R2ML to JenaRules
 +  * JenaRules to R2ML
 +  * [[http://​oxygen.informatik.tu-cottbus.de/​translator/​R2MLtoJBossRules/​ | R2ML to JBoss Rules]]
 +  * SWRL to R2ML
 +  * R2ML to SWRL
 +  * R2ML to XMI
 +  * R2ML to OCL
 +  * OCL to R2ML 
 +
 +Translacja do RIF: W planach jest taki translator, ale w tej chwili nie ma go jeszcze zaimplementowanego. Atrybuty, z których korzystają oba formaty (RIF i R2ML) w podstawowej wersji są takie same tj. zgodne z rdf oraz xsd.
 +
 +
 +
 +
 +===== Thermostat =====
 +
 +Każdą z poniższych reguł można sprawdzić za pomocą:
 +  * [[http://​oxygen.informatik.tu-cottbus.de/​verbalization/​index.jsp | werbalizera]]
 +  * [[http://​oxygen.informatik.tu-cottbus.de/​visualization/​v3/​ | wizualizera]]
 +
 +
 +=== Thermostat ===
 +
 +[[hekate:​hekate_case_thermostat | Reguły termostatu]]
 +
 +[[https://​ai.ia.agh.edu.pl/​wiki/​pl:​miw:​miw08_xtt_r2ml:​thermostat | thermostat in R2ML]]
 +
 +
 +=== Dodatki ===
 +
 +Możliwe rozszerzenia powyższego kodu:
 +
 +1. znalazłem typ zmiennych r2mlv:​dayOfWeek,​ który można wykorzystać
 +
 +źródło: [[http://​oxygen.informatik.tu-cottbus.de/​R2ML/​0.5/​r2mlv.xsd]]
 +
 +2. time (czas) można określać jak wartość integer (określając czas jako parametr z przedziału 0-24):
 +
 +<code xml>
 +      <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​lessThan">​
 +        <​r2ml:​dataArguments>​
 +          <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​time">​
 +          </​r2ml:​AttributeFunctionTerm>​
 +          <​r2ml:​TypedLiteral r2ml:​datatypeID="​xs:​integer"​ r2ml:​lexicalValue="​9"/>​
 +        </​r2ml:​dataArguments>​
 +      </​r2ml:​DatatypePredicateAtom>​
 +</​code>​
 +
 +<code xml>
 +      <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​greaterThan">​
 +        <​r2ml:​dataArguments>​
 +          <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​time">​
 +          </​r2ml:​AttributeFunctionTerm>​
 +          <​r2ml:​TypedLiteral r2ml:​datatypeID="​xs:​integer"​ r2ml:​lexicalValue="​17"/>​
 +        </​r2ml:​dataArguments>​
 +      </​r2ml:​DatatypePredicateAtom>​
 +</​code>​
 +
 +3. Podobnie jak z czasem można postąpić z thermostat_setting:​
 +
 +<code xml>
 +      <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​Equal">​
 +        <​r2ml:​dataArguments>​
 +          <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​thermostat_setting">​
 +          </​r2ml:​AttributeFunctionTerm>​
 +          <​r2ml:​TypedLiteral r2ml:​datatypeID="​xs:​integer"​ r2ml:​lexicalValue="​20"/>​
 +        </​r2ml:​dataArguments>​
 +      </​r2ml:​DatatypePredicateAtom>​
 +</​code>​
 +
 +
 +
 +
 +
 +
 +===== Drools =====
 +
 +  * {{:​hekate:​2005_product_derby.pdf|wersja lokalna}}
 +  * [[http://​labs.jboss.com/​drools/​documentation.html]]
 +  * [[http://​docs.codehaus.org/​display/​DROOLS/​Home]]
 +
 +[[drools_uzycie|Dostęp do systemu Drools w IA.]]
 +
 +Istnieje problem z translacją słowników (Vocabulary). Translator ucina wpisy <​r2ml:​Vocabulary>​. Poza tym translator działa tylko na regułach typu "​ProductionRule"​. W mailu od dr Adriana Giurca otrzymałem potwierdzenie tej informacji. Cały translator oparty jest na wersji 0.4 R2ML'a i stąd moje problemy z nim. Otrzymałem także informację,​ że klasy napisane w javie powinny rozwiązać problem.
 +
 +I jeszcze konkluzja: "​However,​ testing your example I found some other errors in the 
 +translation :) I will come back with a new email soon." Przypuszczałem,​ że translacja nie jest poprawna, ale bez dobrej znajomości JBOSS'​a nie byłem w stanie tego uargumentować.
 +
 +
 +Przeglądnąłem przykład z biletami, zamiast Vocabulary klasy napisane są w JAVIE pod Eclipsem. Spróbuję na podstawie projektu example stworzyć podobny z klasą Date mającą początkowo atrybuty: day, today, później dodam: time, month, season.
 +
 +Umieściłem regułę na drools. Umieściłem także na moim koncie skompilowane klasy wypisane poniżej. Nadal drools wyrzuca błąd. Przeszukałem definicji klas w tym przykładzie z biletami i nie znalazłem nigdzie problemu.
 +
 +
 +Klasy potrzebne do działania reguł przekonwertowanych na JBOSS 
 +<code java>
 +
 +package org.drools.examples;​
 +
 +
 +    public static class Date {
 +
 +        private String day;
 +
 +        private String today;
 +        private int time;
 +        private String month;
 + private String season;
 +
 +
 +
 +        public Date() {
 +        }
 +
 +
 +
 +        public String getDay() {
 +            return this.day;
 +        }
 +
 + public void setDay(final String day) {
 +            this.day = day;
 +        }
 +
 +        public String getToday() {
 +            return this.today;
 +        }
 +
 +        public void setToday(final String today) {
 +            this.today = today;
 +        }
 +
 + public String getMonth() {
 +            return this.month;
 +        }
 +
 + public void setMonth(final String month) {
 +            this.month = month;
 +        }
 +
 + public String getSeason() {
 +            return this.season;​
 +        }
 +
 + public void setSeason(final String season) {
 +            this.season = season;
 +        }
 +
 + public int getTime() {
 +            return this.time;
 +        }
 +
 + public void setTime(final int time) {
 +            this.time = time;
 +        }
 +
 +    }
 +
 +
 +    public static class Operation {
 +        private String kind;
 +
 +
 +        public Operation() {
 +        }
 +
 +        public String getKind() {
 +            return this.kind;
 +        }
 +
 + public void setKind(final String kind) {
 +            this.kind = kind;
 +        }
 +    }
 +
 +
 +    public static class Thermostat {
 +        private String thermostat_setting;​
 +
 +
 +        public Thermostat() {
 +        }
 +
 +        public String getThermostat_setting() {
 +            return this.thermostat_setting;​
 +        }
 +
 + public void setThermostat_setting(final String thermostat_setting) {
 +            this.thermostat_setting = thermostat_setting;​
 +        }
 +    }
 +
 +</​code>​
 +
 +
 +[[http://​www.businessrulesforum.com/​2005/​userv | Link do przykładu kodu samochodów - dostęp wymaga hasła]]
 +
 +[[http://​viewvc.jboss.org/​cgi-bin/​viewvc.cgi/​labs/​labs/​jbossrules/​trunk/​drools-examples/​drools-examples-drl/​src/​main/​java/​org/​drools/​examples/​TroubleTicketExample.java?​revision=15167&​view=markup&​pathrev=18477 | Przykład kodu klas potrzebnych do drools]]
 +
 +Dodałem te importy, które są w tym przykładzie i spróbowałem skompilować na borgu. Okazuje się, że borg nie posiada tych plików. Można stwierdzić na tej podstawie, że brakuje ich na serwerze.
 +
 +
 +
 +===== Minicases =====
 +
 +Zakładam, że InvokeActionExpression wywołuje reguły, które jako argument mają podany atrybut klasy. Jest jeszcze możliwość wpisania w InvokeActionExpression ID reguły, bez contextu. 1 przypadek przechodzi sprawdzenie xsd, ale 2 nie jest zgodny.
 +
 +Bazując na poniższych przypadkach (minicases) można stwierdzić,​ że da się przekonwertować XTTML do R2ML. Niestety użyte rozwiązanie wykorzystujące InvokeActionExpression nie jest zgodne w pełni z regułami R2ML. To znaczy xmlstarlet najczęściej stwierdza poprawność reguł. Jednak vizualizer i verbalizer nie pokazują poprawnie skonstruowanych reguł.
 +
 +
 +
 +
 +==== restrictive behavior ====
 +
 +Reguła: if X > 2 then Y = X
 +
 +Efekt werbalizacji:​ If X is greater than 2 then X is equal to Y.
 +
 +<code xml>
 +
 +<​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">​
 + 
 + <​r2mlv:​Vocabulary> ​
 +  <​r2mlv:​Attribute r2mlv:​ID="​X">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger">​1</​r2mlv:​Datatype>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger">​2</​r2mlv:​Datatype>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger">​3</​r2mlv:​Datatype>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger">​4</​r2mlv:​Datatype>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger">​5</​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +     </​r2mlv:​Attribute>​
 + </​r2mlv:​Vocabulary>​
 +
 +
 + <​r2ml:​ProductionRuleSet>​
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​restrictive_behavior">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            if X > 2 then Y = X
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 +
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​greaterThan">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​X">​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​2"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 + 
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 +
 +      <​r2ml:​AssignActionExpression r2ml:​propertyID="​Y"> ​       ​
 +       <​r2ml:​value>​
 +        <​r2ml:​TypedLiteral r2ml:​lexicalValue="​X"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +       </​r2ml:​value>​
 +      </​r2ml:​AssignActionExpression>​
 +
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 + </​r2ml:​ProductionRuleSet>​
 + 
 +</​r2ml:​RuleBase>​
 +
 +</​code>​
 +
 +
 +==== restrictive behavior and multiple values ====
 +
 +<​code>​
 +grade || nrfail ​      | grmean ​      | nrgrades ​   |
 +----------------------|-----------------------------
 +=2    || =count(grade)| ​             |             |
 +      ||              | =mean(grade) |=count(grade)|
 +</​code>​
 +
 +Tej reguły najprawdopodobniej nie da się przedstawić za pomocą języka R2ML. Próbowałem wykorzystać globalną zmienną, która liczyłaby atomy/​termy/​obiekty,​ ale nie za bardzo jest możliwość iteracji po tych elementach.
 +
 +
 +==== restrictive behavior and multiple values cont ====
 +
 +
 +Reguła: if grade > 4 then grade = grade
 +
 +Efekt werbalizacji:​ If grade is greater than 4 then grade is equal to grade.
 +
 +Tutaj przyjmuję, że Grade jest klasa. Też nie do końca poprawne rozwiązanie.
 +
 +<code xml>
 +
 +<​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">​
 + 
 + <​r2mlv:​Vocabulary> ​
 +   <​r2mlv:​Class r2mlv:​ID="​Grade"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​grade">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger">​2</​r2mlv:​Datatype>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger">​3</​r2mlv:​Datatype>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger">​4</​r2mlv:​Datatype>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger">​5</​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 + </​r2mlv:​Vocabulary>​
 + 
 + 
 + <​r2ml:​ProductionRuleSet>​
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​restrictive_behavior_and_multiple_values_cont">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            if grade > 4 then delete grade
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 + 
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​graterThan">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​grade">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​grade"​ r2ml:​classID="​Grade"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​4"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 + 
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 +
 +      <​r2ml:​DeleteActionExpression r2ml:​classID="">​
 +        <​r2ml:​contextArgument>​
 +          <​r2ml:​ObjectVariable r2ml:​name="​grade"​ r2ml:​classID="​Grade"/>​
 +        </​r2ml:​contextArgument>​
 +       </​r2ml:​DeleteActionExpression>​
 +
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 + </​r2ml:​ProductionRuleSet>​
 + 
 +</​r2ml:​RuleBase>​
 +
 +</​code>​
 +
 +
 +==== grouped attributes and multiple value operations ====
 +
 +
 +Efekt werbalizacji:​ If salary of employee in previous_year is less than 2000 then name of employee ​ is a bonusname and salary of employee ​ is equal to salary*1.1.
 +
 +<code xml>
 +
 +<​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">​
 + 
 + <​r2mlv:​Vocabulary> ​
 +   <​r2mlv:​Class r2mlv:​ID="​Employee"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​name">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​salary">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 +
 +   <​r2mlv:​Class r2mlv:​ID="​Bonusname"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​bonusname">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 +
 + </​r2mlv:​Vocabulary>​
 + 
 + 
 + <​r2ml:​ProductionRuleSet>​
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​grouped_attributes_and_multiple_value_operations">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            Increase salary by 10% for these employees who earn less than 2000. And store their names in bonusname attribute.
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 + 
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​lessThan">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​salary">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​employee"​ r2ml:​classID="​Employee"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​2000"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 + 
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 + 
 +     <​r2ml:​AssignActionExpression r2ml:​propertyID="​salary">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Employee"​ r2ml:​name="​employee"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​value>​
 +        <​r2ml:​TypedLiteral r2ml:​lexicalValue="​1,​1*salary"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +       </​r2ml:​value>​
 +     </​r2ml:​AssignActionExpression>​
 +
 +     <​r2ml:​CreateActionExpression r2ml:​propertyID="​Bonusname">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​name="​bonusname"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​DataSlot r2ml:​attributeID="​bonusname">​
 +         <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​name">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​employee"​ r2ml:​classID="​Employee"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +       </​r2ml:​DataSlot>​
 +     </​r2ml:​CreateActionExpression>​
 + 
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 + </​r2ml:​ProductionRuleSet>​
 + 
 +</​r2ml:​RuleBase>​
 +
 +</​code>​
 +
 +
 +
 +
 +
 +
 +==== grouped attributes and assert ====
 +
 +Efekt werbalizacji:​ If ename of Emplyee is any and esalary of Emplyee is any then do  assign ename to name of employee.
 +
 +<code xml>
 +
 +<​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">​
 + 
 + <​r2mlv:​Vocabulary> ​
 +   <​r2mlv:​Class r2mlv:​ID="​Employee"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​name">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​salary">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 +
 +   <​r2mlv:​Class r2mlv:​ID="​eEmployee"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​ename">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​esalary">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 + </​r2mlv:​Vocabulary>​
 + 
 + 
 + <​r2ml:​ProductionRuleSet>​
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​grouped_attributes_and_assert">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            Increase salary by 10% for these employees who earn less than 2000. And store their names in bonusname attribute.
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 + 
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​lessThan">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​salary">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​employee"​ r2ml:​classID="​Employee"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​2000"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 + 
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 + 
 +     <​r2ml:​CreateActionExpression r2ml:​propertyID="​Employee">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​name="​employee"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​DataSlot r2ml:​attributeID="​name">​
 +         <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​ename">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​eemployee"​ r2ml:​classID="​eEmployee"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +       </​r2ml:​DataSlot>​
 +     </​r2ml:​CreateActionExpression>​
 +
 +     <​r2ml:​CreateActionExpression r2ml:​propertyID="​Employee">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​name="​employee"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​DataSlot r2ml:​attributeID="​salary">​
 +         <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​esalary">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​eemployee"​ r2ml:​classID="​eEmployee"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +       </​r2ml:​DataSlot>​
 +     </​r2ml:​CreateActionExpression>​
 + 
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 + </​r2ml:​ProductionRuleSet>​
 + 
 +</​r2ml:​RuleBase>​
 +
 +</​code>​
 +
 +
 +
 +==== parallel inference? ====
 +
 +De facto InvokeActionExpression służy do wywoływania operacji, a nie do odwoływania się do innych reguł.
 +
 +<code xml>
 +
 +<​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">​
 + 
 + <​r2mlv:​Vocabulary> ​
 +   <​r2mlv:​Class r2mlv:​ID="​System1"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​in1">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​con1">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 + 
 +   <​r2mlv:​Class r2mlv:​ID="​System2"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​in2">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​con2">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 +
 +  <​r2mlv:​Class r2mlv:​ID="​Internal"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​x">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​y">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​s">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​string"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 + </​r2mlv:​Vocabulary>​
 + 
 + 
 + <​r2ml:​ProductionRuleSet>​
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​parallel_inference">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            parallel inference?
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 + 
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​equal">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​x">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​internal"​ r2ml:​classID="​Internal"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​true"​ r2ml:​datatypeID="​xs:​string"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 +
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​equal">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​y">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​internal"​ r2ml:​classID="​Internal"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​true"​ r2ml:​datatypeID="​xs:​string"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 +
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​equal">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​s">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​internal"​ r2ml:​classID="​Internal"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​true"​ r2ml:​datatypeID="​xs:​string"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 + 
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 + 
 +      <​r2ml:​InvokeActionExpression r2ml:​propertyID="​in1_y">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​System1"​ r2ml:​name="​system1"​ />
 +       </​r2ml:​contextArgument>​
 +      </​r2ml:​InvokeActionExpression>​
 +
 +      <​r2ml:​InvokeActionExpression r2ml:​propertyID="​in2_y">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​System2"​ r2ml:​name="​system2"​ />
 +       </​r2ml:​contextArgument>​
 +      </​r2ml:​InvokeActionExpression>​
 + 
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 + </​r2ml:​ProductionRuleSet>​
 + 
 +</​r2ml:​RuleBase>​
 +
 +</​code>​
 +
 +
 +
 +==== calculations (factorial) ====
 +
 +[[https://​ai.ia.agh.edu.pl/​wiki/​hekatedev:​xtt_minicases#​calculations_factorial | opis]]
 +
 +Nie za bardzo wiem jak skonstruować takie zapętlenie. Ustalając te 3 zmienne jako globalne i pisząc regułę, która mnoży wartość x jeśli s > 1, można by w pewien sposób zrealizować silnie. Nie jestem jednak do końca pewny czy byłoby to zgodne ze składnią R2ML.
 +
 +<code xml>
 +<​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">​
 + 
 + <​r2mlv:​Vocabulary> ​
 +  <​r2mlv:​Class r2mlv:​ID="​Internal"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​x">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​y">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​s">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 + </​r2mlv:​Vocabulary>​
 + 
 + 
 + <​r2ml:​ProductionRuleSet>​
 +
 +
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​factorial01">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            factorial
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 +
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​notExist">​ //problem z tym predykatem notExist - nie ma odpowiednika
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​s">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​internal"​ r2ml:​classID="​Internal"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 +
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 + 
 +      <​r2ml:​AssignActionExpression r2ml:​propertyID="​s">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Internal"​ r2ml:​name="​internal"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​value>​
 +        <​r2ml:​TypedLiteral r2ml:​lexicalValue="​x"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +       </​r2ml:​value>​
 +      </​r2ml:​AssignActionExpression>​
 + 
 +      <​r2ml:​InvokeActionExpression r2ml:​propertyID="​s">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Internal"​ r2ml:​name="​internal"​ />
 +       </​r2ml:​contextArgument>​
 +      </​r2ml:​InvokeActionExpression>​
 + 
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 +
 +
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​factorial02">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            factorial
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 +
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​greaterThan">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​s">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​internal"​ r2ml:​classID="​Internal"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​0"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 +
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 + 
 +      <​r2ml:​AssignActionExpression r2ml:​propertyID="​s">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Internal"​ r2ml:​name="​internal"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​value>​
 +        <​r2ml:​TypedLiteral r2ml:​lexicalValue="​s-1"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +       </​r2ml:​value>​
 +      </​r2ml:​AssignActionExpression>​
 + 
 +      <​r2ml:​InvokeActionExpression r2ml:​propertyID="​s">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Internal"​ r2ml:​name="​internal"​ />
 +       </​r2ml:​contextArgument>​
 +      </​r2ml:​InvokeActionExpression>​
 + 
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 +
 +
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​factorial03">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            factorial
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 +
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​greaterThan">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​x">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​internal"​ r2ml:​classID="​Internal"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​0"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 +
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​greaterThan">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​x">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​internal"​ r2ml:​classID="​Internal"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​0"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 +
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 + 
 +      <​r2ml:​AssignActionExpression r2ml:​propertyID="​y">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Internal"​ r2ml:​name="​internal"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​value>​
 +        <​r2ml:​TypedLiteral r2ml:​lexicalValue="​y*s"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +       </​r2ml:​value>​
 +      </​r2ml:​AssignActionExpression>​
 + 
 +      <​r2ml:​InvokeActionExpression r2ml:​propertyID="​s">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Internal"​ r2ml:​name="​internal"​ />
 +       </​r2ml:​contextArgument>​
 +      </​r2ml:​InvokeActionExpression>​
 + 
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 +
 +
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​factorial04">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            factorial
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 +
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​equal">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​x">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​internal"​ r2ml:​classID="​Internal"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​0"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 +
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 + 
 +      <​r2ml:​AssignActionExpression r2ml:​propertyID="​y">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Internal"​ r2ml:​name="​internal"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​value>​
 +        <​r2ml:​TypedLiteral r2ml:​lexicalValue="​1"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +       </​r2ml:​value>​
 +      </​r2ml:​AssignActionExpression>​
 + 
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 +
 +
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​factorial05">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            factorial
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 +
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​greaterThan">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​x">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​internal"​ r2ml:​classID="​Internal"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​0"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 +
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​equal">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​x">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​internal"​ r2ml:​classID="​Internal"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​1"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 +
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 + 
 +      <​r2ml:​AssignActionExpression r2ml:​propertyID="​y">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Internal"​ r2ml:​name="​internal"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​value>​
 +        <​r2ml:​TypedLiteral r2ml:​lexicalValue="​y"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +       </​r2ml:​value>​
 +      </​r2ml:​AssignActionExpression>​
 + 
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 +
 +
 + </​r2ml:​ProductionRuleSet>​
 + 
 +</​r2ml:​RuleBase>​
 +</​code>​
 +
 +
 +==== finding successors in a tree ====
 +
 +[[https://​ai.ia.agh.edu.pl/​wiki/​hekatedev:​xtt_minicases#​finding_successors_in_a_tree | opis]]
 +
 +<code xml>
 +<​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">​
 + 
 + <​r2mlv:​Vocabulary> ​
 +   <​r2mlv:​Class r2mlv:​ID="​Node"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​N">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​P">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 +
 +   <​r2mlv:​Class r2mlv:​ID="​Store"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​F">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 + </​r2mlv:​Vocabulary>​
 +
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​finding_successors_in_a_tree">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            finding successors in a tree
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 + 
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​equal">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​P">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​node"​ r2ml:​classID="​Node"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​1234"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 + 
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 + 
 +      <​r2ml:​AssignActionExpression r2ml:​propertyID="​F">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Store"​ r2ml:​name="​store"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​value>​
 +        <​r2ml:​TypedLiteral r2ml:​lexicalValue="​N"​ r2ml:​datatypeID="​xs:​positiveInteger">​
 +         <​r2ml:​contextArgument>​
 +          <​r2ml:​ObjectVariable r2ml:​classID="​Node"​ r2ml:​name="​node"​ />
 +         </​r2ml:​contextArgument>​
 +        </​r2ml:​TypedLiteral>​
 +       </​r2ml:​value>​
 +      </​r2ml:​AssignActionExpression>​
 + 
 +      <​r2ml:​InvokeActionExpression r2ml:​propertyID="​P">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Node"​ r2ml:​name="​node"​ />
 +       </​r2ml:​contextArgument>​
 +      </​r2ml:​InvokeActionExpression>​
 + 
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 +</​r2ml:​RuleBase>​
 +</​code>​
 +
 +
 +
 +
 +
 +==== finding successors in a tree with a hop ====
 +
 +[[https://​ai.ia.agh.edu.pl/​wiki/​hekatedev:​xtt_minicases#​finding_successors_in_a_tree_with_a_hop | opis]]
 +
 +<code xml>
 +<​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">​
 + 
 + <​r2mlv:​Vocabulary> ​
 +   <​r2mlv:​Class r2mlv:​ID="​Node"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​N">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​P">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 + 
 +   <​r2mlv:​Class r2mlv:​ID="​ActualNode"> ​
 +    <​r2mlv:​Attribute r2mlv:​ID="​N">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger">​2</​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +    <​r2mlv:​Attribute r2mlv:​ID="​P">​
 +      <​r2mlv:​range>​
 +       <​r2mlv:​Datatype r2mlv:​ID="​xs:​positiveInteger"></​r2mlv:​Datatype>​
 +      </​r2mlv:​range>​
 +    </​r2mlv:​Attribute>​
 +   </​r2mlv:​Class>​
 + </​r2mlv:​Vocabulary>​
 + 
 +  <​r2ml:​ProductionRule r2ml:​ruleID="​finding_successors_in_a_tree_with_a_hop">​
 +   <​r2ml:​Documentation>​
 +       <​r2ml:​RuleText r2ml:​textFormat="​plain">​
 +            finding successors in a tree with a hop
 +       </​r2ml:​RuleText>​
 +   </​r2ml:​Documentation>​
 +    <​r2ml:​conditions>​
 + 
 +        <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​equal">​
 +          <​r2ml:​dataArguments>​
 +            <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​N">​
 +              <​r2ml:​contextArgument>​
 +                <​r2ml:​ObjectVariable r2ml:​name="​node"​ r2ml:​classID="​Node"/>​
 +              </​r2ml:​contextArgument>​
 +            </​r2ml:​AttributeFunctionTerm>​
 +              <​r2ml:​TypedLiteral r2ml:​lexicalValue="​N"​ r2ml:​datatypeID="​xs:​positiveInteger"/>​
 +                <​r2ml:​contextArgument>​
 +                  <​r2ml:​ObjectVariable r2ml:​name="​actualnode"​ r2ml:​classID="​ActualNode"/>​
 +                </​r2ml:​contextArgument>​
 +          </​r2ml:​dataArguments>​
 +        </​r2ml:​DatatypePredicateAtom>​
 + 
 +    </​r2ml:​conditions>​
 + 
 +    <​r2ml:​producedAction>​
 + 
 +      <​r2ml:​AssignActionExpression r2ml:​propertyID="​N">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​ActualNode"​ r2ml:​name="​actualnode"​ />
 +       </​r2ml:​contextArgument> ​        
 +       <​r2ml:​value>​
 +        <​r2ml:​TypedLiteral r2ml:​lexicalValue="​P"​ r2ml:​datatypeID="​xs:​positiveInteger">​
 +         <​r2ml:​contextArgument>​
 +          <​r2ml:​ObjectVariable r2ml:​classID="​Node"​ r2ml:​name="​node"​ />
 +         </​r2ml:​contextArgument>​
 +        </​r2ml:​TypedLiteral>​
 +       </​r2ml:​value>​
 +      </​r2ml:​AssignActionExpression>​
 + 
 +      <​r2ml:​InvokeActionExpression r2ml:​propertyID="​N">​
 +       <​r2ml:​contextArgument>​
 +        <​r2ml:​ObjectVariable r2ml:​classID="​Node"​ r2ml:​name="​node"​ />
 +       </​r2ml:​contextArgument>​
 +      </​r2ml:​InvokeActionExpression>​
 + 
 +    </​r2ml:​producedAction>​
 +  </​r2ml:​ProductionRule>​
 +</​r2ml:​RuleBase>​
 +</​code>​
 +
 +
 +==== A2A ====
 +
 +[[https://​ai.ia.agh.edu.pl/​wiki/​pl:​miw:​miw08_ardcase_cs:​biletomat#​directed_conceptual_design | opis]]
 +
 +[[https://​ai.ia.agh.edu.pl/​wiki/​pl:​miw:​miw08_xtt_r2ml:​a2a | zapis za pomocą R2ML]]
 +
 +
 +
 +===== URML =====
 +
 +
 +URML dziedziczy z R2ML. Oba formaty są w sporej części zgodne (nie w pełni - prace nad pełną zgodnością trwają). Za pomocą programu **Strelka** można uzyskać kod R2ML'a z URML.
 +
 +W związku z dziedziczeniem URML z R2ML mogą wystąpić problemy z przejściem w drugą stronę tj. z R2ML do URML.
 +
 +W szczególnym przypadku reguły ProductionRule da się przekonwertować do URML.
 +
 +  * [[http://​oxygen.informatik.tu-cottbus.de/​rewerse-i1/?​q=URML | URML]]
 +  * [[http://​oxygen.informatik.tu-cottbus.de/​strelka/​URML-Metamodel.htm | Metamodel URML]]
 +
 +Nie znalazłem informacji odnośnie konwertowanych wersji. URML wersja 0.2. R2ML wersja 0.5.
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +==== XTTML do URML (XMI) ====
 +
 +To rozwiązanie byłoby wygodne, bo XTTML do URML do R2ML.
 +
 +Sprawdzałem jak Strelka radzi sobie z wykorzystaniem InvokeActionExpression i nie da się tam zrobić wpisania w InvokeActionExpression takich formuł jak ja zaproponowałem. Invoke musi odnosić się do metody klasy.
 +
 +Można ominąć ten problem robiąc metodę o takiej samej nazwie jak klasa (czyli konstruktor domyślny) i odnosić się do niego w InvokeActionExpression. ​
 +
 +Znalazłem inne błędy w programie Strelka. Błędy w generowaniu kodu R2ML. Dlatego sądzę, że to przejście przez URML było błędnym pomysłem.
 +
 +Poniższy przykład prezentuje błąd:
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​image_przykl.jpg|Przykład z błędem}}
 +
 +Ze schematu został wygenerowany kod. Brak wszystkich danych ze schematu. Program zgubił wartość 1, brak wniosku (producedAction).
 +
 +<code xml>
 +<?xml version="​1.0"​ encoding="​UTF-8"​ standalone="​yes"?>​
 +<​r2ml:​RuleBase xsi:​schemaLocation="​http://​oxygen.informatik.tu-cottbus.de/​R2ML/​0.4/​R2ML.xsd"​ xmlns:​dc="​http://​purl.org/​dc/​elements/​1.1/"​ xmlns:​r2mlv="​http://​www.rewerse.net/​I1/​2006/​R2ML/​R2MLV"​ xmlns:​xs="​http://​www.w3.org/​2001/​XMLSchema"​ xmlns:​r2ml="​http://​www.rewerse.net/​I1/​2006/​R2ML"​ xmlns:​soap="​http://​www.w3.org/​2001/​12/​soap-envelope"​ xmlns:​xsi="​http://​www.w3.org/​2001/​XMLSchema-instance">​
 +    <​r2mlv:​Vocabulary>​
 +        <​r2mlv:​Class r2mlv:​ID="​xtt_1">​
 +            <​r2mlv:​Attribute r2mlv:​ID="​att_0">​
 +                <​r2mlv:​range>​
 +                    <​r2mlv:​Datatype r2mlv:​ID="​xs:​integer"/>​
 +                </​r2mlv:​range>​
 +            </​r2mlv:​Attribute>​
 +            <​r2mlv:​Attribute r2mlv:​ID="​att_1">​
 +                <​r2mlv:​range>​
 +                    <​r2mlv:​Datatype r2mlv:​ID="​xs:​integer"/>​
 +                </​r2mlv:​range>​
 +            </​r2mlv:​Attribute>​
 +        </​r2mlv:​Class>​
 +    </​r2mlv:​Vocabulary>​
 +    <​r2ml:​ProductionRuleSet>​
 +        <​r2ml:​ProductionRule r2ml:​ruleID="​rul_1">​
 +            <​r2ml:​conditions>​
 +                <​r2ml:​ObjectClassificationAtom r2ml:​classID="​xtt_1"​ r2ml:​isNegated="​false">​
 +                    <​r2ml:​ObjectVariable r2ml:​name="​xtt_1"/>​
 +                </​r2ml:​ObjectClassificationAtom>​
 +                <​r2ml:​qf.Disjunction>​
 +                    <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​greaterThanOrEqual"​ r2ml:​isNegated="​false"​ xmlns:​swrlb="​http://​www.w3.org/​2003/​11/​swrlb">​
 +                        <​r2ml:​dataArguments/>​
 +                    </​r2ml:​DatatypePredicateAtom>​
 +                    <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​lessThanOrEqual"​ r2ml:​isNegated="​false"​ xmlns:​swrlb="​http://​www.w3.org/​2003/​11/​swrlb">​
 +                        <​r2ml:​dataArguments>​
 +                            <​r2ml:​TypedLiteral r2ml:​datatypeID="​xs:​integer"​ r2ml:​lexicalValue="​5"/>​
 +                        </​r2ml:​dataArguments>​
 +                    </​r2ml:​DatatypePredicateAtom>​
 +                    <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​equal"​ r2ml:​isNegated="​false"​ xmlns:​swrlb="​http://​www.w3.org/​2003/​11/​swrlb">​
 +                        <​r2ml:​dataArguments>​
 +                            <​r2ml:​TypedLiteral r2ml:​datatypeID="​xs:​integer"​ r2ml:​lexicalValue="​8"/>​
 +                        </​r2ml:​dataArguments>​
 +                    </​r2ml:​DatatypePredicateAtom>​
 +                </​r2ml:​qf.Disjunction>​
 +            </​r2ml:​conditions>​
 +            <​r2ml:​producedAction>​
 +                <​r2ml:​AssignActionExpression>​
 +                    <​r2ml:​contextArgument>​
 +                        <​r2ml:​ObjectVariable r2ml:​name="​xtt_1"/>​
 +                    </​r2ml:​contextArgument>​
 +                </​r2ml:​AssignActionExpression>​
 +            </​r2ml:​producedAction>​
 +        </​r2ml:​ProductionRule>​
 +    </​r2ml:​ProductionRuleSet>​
 +</​r2ml:​RuleBase>​
 +
 +</​code>​
 +
 +
 +==== R2ML do URML (XMI) ====
 +
 +Jest wykonalne. Niestety nie znalazłem żadnego translatora. Nawet zespół, który pracuje nad regułami R2ML nie pisał ich ręcznie tylko generował za pomocą Strelki. Opisują to w swoim postępowaniu przy tworzeniu reguł dla projektu Derby2005.
 +
 +Możliwe jest jednak stworzenie takiego translatora. Sądzę, że byłoby wygodniejsze konwertowanie do URML (XMI dla Strelki) niż konwertowanie do R2ML, gdyż ze Strelki można potem wygenerować R2ML. Reguły nie są skomplikowane. Poniżej zamieszczam najbardziej okrojone reguły jakie udało mi się uzyskać dla prostego przykładu.
 +
 +<code xml>
 +<xmi:XMI xmi:​version="​2.0"​ xmlns:​xmi="​http://​www.omg.org/​XMI"​ xmlns:​URML="​http:///​URML.ecore"​ xmlns:​notation="​http://​www.eclipse.org/​gmf/​runtime/​1.0.1/​notation"​ xmlns:​uml="​http://​www.eclipse.org/​uml2/​2.1.0/​UML">​
 +  <​notation:​Diagram xmi:​id="​nD1"​ type="​URML"​ element="​element1"​ measurementUnit="​Pixel">​
 +    <styles xmi:​type="​notation:​DiagramStyle"​ xmi:​id="​id1"/>​
 +  </​notation:​Diagram>​
 +  <​uml:​Package xmi:​id="​element1">​
 +    <​packagedElement xmi:​type="​uml:​PrimitiveType"​ xmi:​id="​idString"​ name="​String"/>​
 +    <​packagedElement xmi:​type="​uml:​PrimitiveType"​ xmi:​id="​idBoolean"​ name="​Boolean"/>​
 +    <​packagedElement xmi:​type="​uml:​PrimitiveType"​ xmi:​id="​idInteger"​ name="​Integer"/>​
 +    <​packagedElement xmi:​type="​uml:​PrimitiveType"​ xmi:​id="​idFloat"​ name="​Float"/>​
 +    <​packagedElement xmi:​type="​URML:​ProductionRule"​ xmi:​id="​idPR"​ name="​myPR1">​
 +      <​conditions xmi:​type="​URML:​ClassificationAtom"​ xmi:​id="​idCA"​ condRule="​idPR"​ filter="​startDate-reservationDate>​=5"​ clazz="​idmyRental"​ classVariable="​myRental"/>​
 +      <​producedActionExpr xmi:​type="​URML:​AssignVariableActionExpr"​ xmi:​id="​idAE"​ rule="​idPR"​ clazz="​idmyRental"​ actionType="​A"​ classVariable="​myRental"​ statement="​discount=10"/>​
 +    </​packagedElement>​
 +    <​packagedElement xmi:​type="​uml:​Class"​ xmi:​id="​idmyRental"​ name="​myRental">​
 +      <​ownedAttribute xmi:​type="​uml:​Property"​ xmi:​id="​iddiscount"​ name="​discount"​ type="​idInteger"​ aggregation="​composite"/>​
 +      <​ownedAttribute xmi:​type="​uml:​Property"​ xmi:​id="​id_reservationDate"​ name="​reservationDate"​ type="​idInteger"​ aggregation="​composite"/>​
 +      <​ownedAttribute xmi:​type="​uml:​Property"​ xmi:​id="​id_startDate"​ name="​startDate"​ type="​idInteger"​ aggregation="​composite"/>​
 +    </​packagedElement>​
 +  </​uml:​Package>​
 +</​xmi:​XMI>​
 +</​code>​
 +
 +Przy tak upakowanym kodzie istnieje problem odczytu takiego schematu w programie Strelka. Problem leży w zredukowanym fragmencie "​notation:​Diagram"​. Efekt widoczny poniżej.
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​myrental_good.jpg|przykład poprawny}}
 +{{:​pl:​miw:​miw08_xtt_r2ml:​myrental_bad.jpg|przykład bez rozmieszczeń}}
 +
 +Tutaj kod R2ML wygenerowany na za pomocą Strelki z powyższego diagramu. Oczywiście kod w obu przypadkach jest identyczny.
 +
 +<code xml>
 +<​r2ml:​RuleBase xsi:​schemaLocation="​http://​oxygen.informatik.tu-cottbus.de/​R2ML/​0.4/​R2ML.xsd"​ xmlns:​dc="​http://​purl.org/​dc/​elements/​1.1/"​ xmlns:​r2mlv="​http://​www.rewerse.net/​I1/​2006/​R2ML/​R2MLV"​ xmlns:​xs="​http://​www.w3.org/​2001/​XMLSchema"​ xmlns:​r2ml="​http://​www.rewerse.net/​I1/​2006/​R2ML"​ xmlns:​soap="​http://​www.w3.org/​2001/​12/​soap-envelope"​ xmlns:​xsi="​http://​www.w3.org/​2001/​XMLSchema-instance">​
 +    <​r2mlv:​Vocabulary>​
 +        <​r2mlv:​Class r2mlv:​ID="​myRental">​
 +            <​r2mlv:​Attribute r2mlv:​ID="​discount">​
 +                <​r2mlv:​range>​
 +                    <​r2mlv:​Datatype r2mlv:​ID="​xs:​integer"/>​
 +                </​r2mlv:​range>​
 +            </​r2mlv:​Attribute>​
 +            <​r2mlv:​Attribute r2mlv:​ID="​reservationDate">​
 +                <​r2mlv:​range>​
 +                    <​r2mlv:​Datatype r2mlv:​ID="​xs:​integer"/>​
 +                </​r2mlv:​range>​
 +            </​r2mlv:​Attribute>​
 +            <​r2mlv:​Attribute r2mlv:​ID="​startDate">​
 +                <​r2mlv:​range>​
 +                    <​r2mlv:​Datatype r2mlv:​ID="​xs:​integer"/>​
 +                </​r2mlv:​range>​
 +            </​r2mlv:​Attribute>​
 +        </​r2mlv:​Class>​
 +    </​r2mlv:​Vocabulary>​
 +    <​r2ml:​ProductionRuleSet>​
 +        <​r2ml:​ProductionRule r2ml:​ruleID="​myPR1">​
 +            <​r2ml:​conditions>​
 +                <​r2ml:​ObjectClassificationAtom r2ml:​classID="​myRental"​ r2ml:​isNegated="​false">​
 +                    <​r2ml:​ObjectVariable r2ml:​name="​myRental"/>​
 +                </​r2ml:​ObjectClassificationAtom>​
 +                <​r2ml:​DatatypePredicateAtom r2ml:​datatypePredicateID="​swrlb:​greaterThanOrEqual"​ r2ml:​isNegated="​false"​ xmlns:​swrlb="​http://​www.w3.org/​2003/​11/​swrlb">​
 +                    <​r2ml:​dataArguments>​
 +                        <​r2ml:​TypedLiteral r2ml:​datatypeID="​xs:​integer"​ r2ml:​lexicalValue="​5"/>​
 +                        <​r2ml:​DatatypeFunctionTerm r2ml:​datatypeFunctionID="​numeric-substract">​
 +                            <​r2ml:​dataArguments>​
 +                                <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​reservationDate">​
 +                                    <​r2ml:​contextArgument>​
 +                                        <​r2ml:​ObjectVariable r2ml:​name="​myRental"​ r2ml:​classID="​myRental"/>​
 +                                    </​r2ml:​contextArgument>​
 +                                </​r2ml:​AttributeFunctionTerm>​
 +                                <​r2ml:​AttributeFunctionTerm r2ml:​attributeID="​startDate">​
 +                                    <​r2ml:​contextArgument>​
 +                                        <​r2ml:​ObjectVariable r2ml:​name="​myRental"​ r2ml:​classID="​myRental"/>​
 +                                    </​r2ml:​contextArgument>​
 +                                </​r2ml:​AttributeFunctionTerm>​
 +                            </​r2ml:​dataArguments>​
 +                        </​r2ml:​DatatypeFunctionTerm>​
 +                    </​r2ml:​dataArguments>​
 +                </​r2ml:​DatatypePredicateAtom>​
 +            </​r2ml:​conditions>​
 +            <​r2ml:​producedAction>​
 +                <​r2ml:​AssignActionExpression r2ml:​propertyID="​discount">​
 +                    <​r2ml:​contextArgument>​
 +                        <​r2ml:​ObjectVariable r2ml:​name="​myRental"/>​
 +                    </​r2ml:​contextArgument>​
 +                    <​r2ml:​TypedLiteral r2ml:​datatypeID="​xs:​integer"​ r2ml:​lexicalValue="​10"/>​
 +                </​r2ml:​AssignActionExpression>​
 +            </​r2ml:​producedAction>​
 +        </​r2ml:​ProductionRule>​
 +    </​r2ml:​ProductionRuleSet>​
 +</​r2ml:​RuleBase>​
 +</​code>​
 +
 +
 +
 +===== Odwzorowanie połączeń =====
 +
 +Moja propozycja to dopisanie na końcu reguły, z której przechodzimy InvokeActionExpression.
 +
 +Przykład 1: "Go to today of date":
 +
 +<code xml>
 +
 +<​r2ml:​InvokeActionExpression r2ml:​operationID="​today">​
 +  <​r2ml:​contextArgument>​
 +    <​r2ml:​ObjectVariable r2ml:​name="​date"​ r2ml:​classID="​Date"/>​
 +  </​r2ml:​contextArgument>​
 +</​r2ml:​InvokeActionExpression>​
 +
 +</​code>​
 +
 +
 +Przykład 2: "​Calculate the total payment of the purchase order":​
 +
 +<code xml>
 +<​r2ml:​InvokeActionExpression r2ml:​operationID="​totalPayment">​
 +  <​r2ml:​contextArgument>​
 +    <​r2ml:​ObjectVariable r2ml:​name="​purchaseOrder"​ r2ml:​classID="​Order"/>​
 +  </​r2ml:​contextArgument>​
 +</​r2ml:​InvokeActionExpression>​
 +</​code>​
 +
 +
 +
 +===== Translator =====
 +
 +Efektem powyższych etapów prac oraz rozważań jest translator.
 +
 +[[https://​ai.ia.agh.edu.pl/​wiki/​pl:​miw:​miw08_xtt_r2ml:​translator | translator]]
 +
 +
 +
 +
 +
 +===== REWERSE I1 issues =====
 +
 +  * R2ML->​JBOSS
 +  - Translator is XSLT based on and uses R2ML version 0.4.
 +  - The Drools vocabulary is not generated.
 +  - Only Production Rules are translated to Drools.
 +  - "some other errors"​ (dr A. Giurca)
 +  * Translator R2ML to RIF doesn'​t exist.
 +  * Strelka
 +  - [[https://​ai.ia.agh.edu.pl/​wiki/​pl:​miw:​miw08_xtt_r2ml#​xttml_do_urml_xmi|loosing conditions and bad production rules]]
 +  - Button "Save R2ML" doesn'​t work. Button "​Preview R2ML" works.
 +  - Group of buttons "​Translate to..." doesn'​t work.
 +  - Generating R2ML doesn'​t work with advanced logical expressions.
 +
 +
 +
 +===== Pliki z regułami =====
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​thermostat.txt|thermostat.txt}}
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​minicases_01.txt|minicases_01.txt}}
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​minicases_02.txt|minicases_02.txt}}
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​minicases_03.txt|minicases_03.txt}}
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​minicases_04.txt|minicases_04.txt}}
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​minicases_05.txt|minicases_05.txt}}
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​minicases_06.txt|minicases_06.txt}}
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​minicases_07.txt|minicases_07.txt}}
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​minicases_08.txt|minicases_08.txt}}
 +
 +{{:​pl:​miw:​miw08_xtt_r2ml:​minicases_09.txt|minicases_09.txt}}
 +
 +====== Materiały ======
 +  - Linki
 +  * [[http://​oxygen.informatik.tu-cottbus.de/​rewerse-i1/?​q=R2ML | Główna strona projektu R2ML]]
 +  * [[http://​oxygen.informatik.tu-cottbus.de/​rewerse-i1/?​q=node/​15 | Translatory R2ML->​...]]
 +  * [[http://​www.w3.org/​Style/​XSL/​ | Style XSL]]
 +  * [[http://​zvon.org/​xxl/​XSLTutorial/​Output/​index.html | Tutorial XSLT]]
 +  * [[http://​oxygen.informatik.tu-cottbus.de/​publications/​giurca/​ | Publikacje Lukichev oraz Giurca]]
 +  * [[http://​en.wikipedia.org/​wiki/​Production_Rule_Representation | Production Rule Representation (PRR) - en.wikipedia]]
 +  * [[http://​www.edmblog.com/​weblog/​2007/​06/​production_rule.html | Trochę więcej o PRR]]
 +  * [[http://​oxygen.informatik.tu-cottbus.de/​userv/​ | USserv Product Derby]]
 +
 +  - Typy zmiennych
 +  * [[http://​www.w3.org/​Submission/​2004/​SUBM-SWRL-20040521/#​8 | SWRL]]
 +  ​
 +  - pdfy dostępne pod [[http://​oxygen.informatik.tu-cottbus.de/​publications/​giurca/​ | Publikacje Lukichev oraz Giurca]]
 +  * "A General Markup Framework for Integrity and Derivation Rules" - G.Wagner, A.Giurca, S. Lukichev
 +  * "​Verification and Validation of R2ML Rule Bases" - S. Lukichev
 +  * "​Submission to Production Rule Representation"​ : PRR-Core
  
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