Różnice

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

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
Nowa wersja
Poprzednia wersja
pl:miw:miw08_xtt_rif:obsolate [2008/04/23 22:26]
miw
pl:miw:miw08_xtt_rif:obsolate [2019/06/27 15:50] (aktualna)
Linia 69: Linia 69:
 **//​[[pl:​miw:​miw08_xtt_rif:​przyklad4|Przykład 4]]//**\\ **//​[[pl:​miw:​miw08_xtt_rif:​przyklad4|Przykład 4]]//**\\
 Przykład przedstawia warunek z //​przykładu 2a// zapisany za pomocą XML'a: Przykład przedstawia warunek z //​przykładu 2a// zapisany za pomocą XML'a:
 +
 ===== Przemyślenia dotyczące reguł zawierających przypisanie ===== ===== Przemyślenia dotyczące reguł zawierających przypisanie =====
 Przeglądając dokumentacje RIF'a nie znalazłem wzmianki o operacji przypisania. Jedną z metod, byłoby zaproponowanie zaimplementowanie predykatu fn:​assign(A,​B) przypisującego elementowi A wartość elementu B. Wydaje mi się, że ze względu na trwające ciągle prace nad formatem kwestia ta pozostaje otwarta i można przyjąć, że taki warunek jest formułowalny w RIF'​ie.\\ Przeglądając dokumentacje RIF'a nie znalazłem wzmianki o operacji przypisania. Jedną z metod, byłoby zaproponowanie zaimplementowanie predykatu fn:​assign(A,​B) przypisującego elementowi A wartość elementu B. Wydaje mi się, że ze względu na trwające ciągle prace nad formatem kwestia ta pozostaje otwarta i można przyjąć, że taki warunek jest formułowalny w RIF'​ie.\\
Linia 108: Linia 109:
 </​code>​ </​code>​
  
 +Poniższe propozycje zapisu XTT za pomocą RIFa są oparte na proponowanym XTTMLu i są z nim zestawione. Jest to wstępna wersja, która zostanie dopracowana.
 +^XTTML ^RIF ^
 +|<code xml><​xtt_table id="​xtt_1">​
 + ...
 +</​xtt_table></​code>​|<​code xml><​Group id="​xtt_1">​
 + ...
 +</​Group></​code>​|
 +|<code xml><​rule id="​rul_1">​
 + ...
 +</​rule></​code>​|<​code xml><​sentence id="​rul_1">​
 + ...
 +</​sentence></​code>​|
 +|<code xml><​schema>​
 + <​independent>​
 +  <attref ref="​att_0"/>​   ​
 + </​independent>​
 + <​dependent>​
 +  <attref ref="​att_1"/>​
 + </​dependent>​
 +</​schema>​
 +...</​code>​|<​code xml><​Forall>​
 + <​declare><​Var>​att_0</​Var></​declare>​
 + <​declare><​Var>​att_1</​Var></​declare>​
 + ...
 +</​Forall></​code>​|
 +|<code xml><​condition>​
 + ...
 +</​condition></​code>​|<​code xml><​formula>​
 + <​Implies>​
 +  <if>
 +   ...
 +  </if>
 +  ...
 + </​Implies></​code>​|
 +|<code xml><​decision>​
 + ...
 +</​decision>​
 +<link xtt="​xtt_1"/></​code>​|<​code xml><​then>​
 + <​Atom>​
 +  <​op><​Const type="​rif:​iri">​run</​Const></​op>​
 +  <arg>
 +   <​Atom>​
 +    <​op><​Const type="​rif:​iri">​xtt_link</​Const></​op>​
 +    <​arg><​Const type="​xsd:​string">​xtt_1</​Const></​arg>​
 +   </​Atom>​
 +  </​arg>​
 +  ...
 + </​Atom>​
 +</​then></​code>​
 +
 +=== Przykład 1: calculations (factorial) ===
 +<​code>​
 +|----------------------------------------------------|
 +|                                                    |
 +|   x s  || s                                        |
 +|->​------------ ​            ​x ​  ​y ​  ​s ​  ​|| ​ y        |
 +      NA ||=x   ​--+------>​ ------------------- ​      |
 +      >0 ||=s-1 --|                     ​|| ​          |
 +                            >0     >​0 ​  || =y*s -----|
 +                            =0          ||  =1  -----------| ​
 +                            >0     ​=1 ​  ​|| ​     -----------+------>​
 +</​code>​
 +<code xml>
 +<Group id="​xtt_table1">​
 + <​sentence id="​xtt_table1_row1">​
 +  <​Implies>​
 +   <​if>​
 +    <​External>​
 +     <​content>​
 +      <​Atom>​
 +       <​op><​Const type="​rif:​iri">​fn:​is_empty</​Const></​op>​
 +       <​arg><​Var>​x</​Var></​arg>​
 +      </​Atom>​
 +     </​content>​
 +    </​External>​
 +   </​if>​
 +   <​then>​
 +    <​Atom>​
 +     <​op><​Const type="​rif:​iri">​xtt:​concl</​Const></​op>​
 +     <​arg>​
 +      <​External>​
 +       <​content>​
 +        <​Expr>​
 +         <​op><​Const type="​rif:​iri">​xtt:​next_table</​Const></​op>​
 +         <​arg><​Const type="​xsd:​string">​xtt_table2</​Const></​arg>​
 +        </​Expr>​
 +       </​content>​
 +      </​External>​
 +     </​arg>​
 +     <​arg>​
 +      <​External>​
 +       <​content>​
 +        <​Expr>​
 +         <​op><​Const type="​rif:​iri">​op:​assign</​Const></​op>​
 +         <​arg><​Var>​s</​Var></​arg>​
 +         <​arg><​Var>​x</​Var></​arg>​
 +        </​Expr>​
 +       </​content>​
 +      </​External>​
 +     </​arg>​
 +    </​Atom>​
 +   </​then>​
 +  </​Implies>​
 + </​sentence>​
 + 
 + <​sentence id="​xtt_table1_row2">​
 +  <​Implies>​
 +   <​if>​
 +    <​External>​
 +     <​content>​
 +      <​Atom>​
 +       <​op><​Const type="​rif:​iri">​op:​numeric-greater-than</​Const></​op>​
 +       <​arg><​Var>​s</​Var></​arg>​
 +       <​arg><​Const type="​xsd:​decimal">​0</​Const></​arg>​
 +      </​Atom>​
 +     </​content>​
 +    </​External>​
 +   </​if>​
 +   <​then>​
 +    <​Atom>​
 +     <​op><​Const type="​rif:​iri">​xtt:​concl</​Const></​op>​
 +     <​arg>​
 +      <​External>​
 +       <​content>​
 +        <​Expr>​
 +         <​op><​Const type="​rif:​iri">​xtt:​next_table</​Const></​op>​
 +         <​arg><​Const type="​xsd:​string">​xtt_table2</​Const></​arg>​
 +        </​Expr>​
 +       </​content>​
 +      </​External>​
 +     </​arg>​
 +     <​arg>​
 +      <​External>​
 +       <​content>​
 +        <​Expr>​
 +         <​op><​Const type="​rif:​iri">​op:​assign</​Const></​op>​
 +         <​arg><​Var>​s</​Var></​arg>​
 +         <​arg>​
 +          <​External>​
 +           <​content>​
 +            <​Expr>​
 +             <​op><​Const type="​rif:​iri">​op:​numeric-substract</​Const></​op>​
 +             <​arg><​Var>​s</​Var></​arg>​
 +             <​arg><​Const type="​xsd:​decimal">​1</​Const></​arg>​
 +            </​Expr>​
 +           </​content>​
 +          </​External>​
 +         </​arg>​
 +        </​Expr>​
 +       </​content>​
 +      </​External>​
 +     </​arg>​
 +    </​Atom>​
 +   </​then>​
 +  </​Implies>​
 + </​sentence>​
 +</​Group>​
 +
 +<Group id="​xtt_table2">​
 + <​sentence id="​xtt_table2_row1">​
 +  <​Implies>​
 +   <​if>​
 +    <And>
 +     <​formula>​
 +      <​External>​
 +       <​content>​
 +        <​Atom>​
 +         <​op><​Const type="​rif:​iri">​op:​numeric-greater-than</​Const></​op>​
 +         <​arg><​Var>​x</​Var></​arg>​
 +         <​arg><​Const type="​xsd:​decimal">​0</​Const></​arg>​
 +        </​Atom>​
 +       </​content>​
 +      </​External>​
 +     </​formula>​
 +     <​formula>​
 +      <​External>​
 +       <​content>​
 +        <​Atom>​
 +         <​op><​Const type="​rif:​iri">​op:​numeric-greater-than</​Const></​op>​
 +         <​arg><​Var>​s</​Var></​arg>​
 +         <​arg><​Const type="​xsd:​decimal">​0</​Const></​arg>​
 +        </​Atom>​
 +       </​content>​
 +      </​External>​
 +     </​formula>​
 +    </​And>​
 +   </​if>​
 +   <​then>​
 +    <​Atom>​
 +     <​op><​Const type="​rif:​iri">​xtt:​concl</​Const></​op>​
 +     <​arg>​
 +      <​External>​
 +       <​content>​
 +        <​Expr>​
 +         <​op><​Const type="​rif:​iri">​xtt:​next_table</​Const></​op>​
 +         <​arg><​Const type="​xsd:​string">​xtt_table1</​Const></​arg>​
 +        </​Expr>​
 +       </​content>​
 +      </​External>​
 +     </​arg>​
 +     <​arg>​
 +      <​External>​
 +       <​content>​
 +        <​Expr>​
 +         <​op><​Const type="​rif:​iri">​op:​assign</​Const></​op>​
 +         <​arg><​Var>​y</​Var></​arg>​
 +         <​arg>​
 +          <​External>​
 +           <​content>​
 +            <​Expr>​
 +             <​op><​Const type="​rif:​iri">​op:​numeric-multiply</​Const></​op>​
 +             <​arg><​Var>​y</​Var></​arg>​
 +             <​arg><​Var>​s</​Var></​arg>​
 +            </​Expr>​
 +           </​content>​
 +          </​External>​
 +         </​arg>​
 +        </​Expr>​
 +       </​content>​
 +      </​External>​
 +     </​arg>​
 +    </​Atom>​
 +   </​then>​
 +  </​Implies>​
 + </​sentence>​
 + 
 + <​sentence id="​xtt_table1_row2">​
 +  <​Implies>​
 +   <​if>​
 +    <​Equal>​
 +     <​side><​Var>​x</​Var></​side>​
 +     <​side><​Const type="​xsd:​decimal">​0</​Const></​side>​
 +    </​Equal>​
 +   </​if>​
 +   <​then>​
 +    <​Atom>​
 +     <​op><​Const type="​rif:​iri">​xtt:​run_many</​Const></​op>​
 +     <​arg>​
 +      <​External>​
 +       <​content>​
 +        <​Expr>​
 +         <​op><​Const type="​rif:​iri">​op:​assign</​Const></​op>​
 +         <​arg><​Var>​y</​Var></​arg>​
 +         <​arg><​Const type="​xsd:​decimal">​1</​Const></​arg>​
 +        </​Expr>​
 +       </​content>​
 +      </​External>​
 +     </​arg>​
 +     <​arg>​
 +      <​External>​
 +       <​content>​
 +        <​Expr>​
 +         <​op><​Const type="​rif:​iri">​xtt:​return</​Const></​op>​
 +         <​arg><​Var>​s</​Var></​arg>​
 +         <​arg><​Var>​x</​Var></​arg>​
 +         <​arg><​Var>​y</​Var></​arg>​
 +        </​Expr>​
 +       </​content>​
 +      </​External>​
 +     </​arg>​
 +    </​Atom>​
 +   </​then>​
 +  </​Implies>​
 + </​sentence>​
 + 
 + <​sentence id="​xtt_table2_row3">​
 +  <​Implies>​
 +   <​if>​
 +    <And>
 +     <​formula>​
 +      <​External>​
 +       <​content>​
 +        <​Atom>​
 +         <​op><​Const type="​rif:​iri">​op:​numeric-greater-than</​Const></​op>​
 +         <​arg><​Var>​x</​Var></​arg>​
 +         <​arg><​Const type="​xsd:​decimal">​0</​Const></​arg>​
 +        </​Atom>​
 +       </​content>​
 +      </​External>​
 +     </​formula>​
 +     <​formula>​
 +      <​Equal>​
 +       <​side><​Var>​s</​Var></​side>​
 +       <​side><​Const type="​xsd:​decimal">​1</​Const></​side>​
 +      </​Equal>​
 +     </​formula>​
 +    </​And>​
 +   </​if>​
 +   <​then>​
 +    <​Atom>​
 +     <​op><​Const type="​rif:​iri">​xtt:​return</​Const></​op>​
 +     <​arg><​Var>​s</​Var></​arg>​
 +     <​arg><​Var>​x</​Var></​arg>​
 +     <​arg><​Var>​y</​Var></​arg>​
 +    </​Atom>​
 +   </​then>​
 +  </​Implies>​
 + </​sentence>​
 + 
 +</​Group>​
 +</​code>​
 +Obie tablice w formacie xml: {{:​pl:​miw:​miw08_xtt_rif:​factorial.xml|factorial.xml}},​ {{:​pl:​miw:​miw08_xtt_rif:​factorial1.xml|factorial1.xml}}
 +----
 +Powyższy przykład został zwalidowany za pomocą dostępnych arkuszy XSD. Jedyny element, który zgłasza błędy jest to parametr ''​id'',​ aczkolwiek ze względu na brak walidacji niektórych przykładów obecnych w dokumentacji,​ nie należy się tym przejmować. Nigdzie w dokumentacji nie ma wyraźnego zakazu wykorzystywania elementów standardu XML.
pl/miw/miw08_xtt_rif/obsolate.1208982407.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