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/13 16:22]
miw
pl:miw:miw08_xtt_rif:obsolate [2019/06/27 15:50] (aktualna)
Linia 11: Linia 11:
   * należące do klasy   * należące do klasy
   * należące do podklas   * należące do podklas
-  ​+==== Wspierane przestrzenie symboli ==== 
 +  * [[http://​www.w3.org/​2001/​XMLSchema#​string|xsd:​string]] 
 +  * [[http://​www.w3.org/​2001/​XMLSchema#​decimal|xsd:​decimal]] 
 +  * [[http://​www.w3.org/​2001/​XMLSchema#​time|xsd:​time]] 
 +  * [[http://​www.w3.org/​2001/​XMLSchema#​dateTime|xsd:​date]] 
 +  * [[http://​www.w3.org/​2001/​XMLSchema#​dateTime|xsd:​dateTime]] 
 +  * [[http://​www.w3.org/​1999/​02/​22-rdf-syntax-ns#​XMLLiteral|rdf:​XMLLiteral]] 
 +  * rif:text (dla ciągów znaków z dołączonymi tagami językowymi) 
 +  * rif:iri (dla **internationalized resource identifiers** czyli **IRI**s) 
 +  * rif:local (dla stałych symboli, nie widocznych poza poszczególymi zestawami formuł RIF) 
 +==== Wspierane formuły ==== 
 +  * warunek RIF-BLD 
 +  * reguła RIF-BLD 
 + 
 + 
 +==== Serializacja XML dla przenoszalności RIF ==== 
 +Serializacja XML dla składni prezentacji RIF-BLD zaprezentowana w tej sekcji jest z nią przemienna. Naśladując Javę i RDF, używamy nazw pisanych dużymi literami dla elementów klas oraz nazw które zaczynają się od małej litery dla elementów ról.\\ 
 +Wszystkie klasy zapisywane dużymi literami w składni prezentacji,​ jak CONDITION, stają się tagami (?) XMLa. Zachowują się jak makra i nie są widoczne w instance markup. 
 + 
 +Zacznijmy od serializacji **Języka Warunkowego** w XMLu: 
 +<​code>​Klasy,​ role i ich zamierzone znaczenie 
 + 
 +- And       ​(conjunction) 
 +- Or        (disjunction) 
 +- Exists ​   (quantified formula for '​Exists',​ containing declare and formula roles) 
 +- declare ​  ​(declare role, containing a Var) 
 +- formula ​  ​(formula role, containing a CONDITION formula) 
 +- Uniterm ​  (term or atomic formula, positional or with named arguments) 
 +- Member ​   (member formula) 
 +- Subclass ​ (subclass formula) 
 +- Frame     ​(Frame formula) 
 +- object ​   (Member/​Frame role containing a TERM or an object description) 
 +- op        (Uniterm role for predicates/​functions as operations) 
 +- arg       ​(argument role) 
 +- upper     ​(Member/​Subclass upper class role) 
 +- lower     ​(Member/​Subclass lower instance/​class role) 
 +- slot      (Uniterm/​Frame slot role, prefix version of slot infix ' -> ') 
 +- Equal     ​(prefix version of term equation '​='​) 
 +- side      (Equal left-hand side and right-hand side role) 
 +- Const     ​(slot,​ individual, function, or predicate symbol, with optional '​type'​ attribute) 
 +- Var       ​(logic variable)</​code>​ 
 +Składnia XML dla przestrzeni symboli wykorzystuje atrybut type związany z elementami term, jak Const. Na przykład literał w xsd:​dateTime data type może być przedstawiony jako <Const type="​xsd:​dateTime">​2007-11-23T03:​55:​44-02:​30</​Const>​. 
 + 
 +**//​[[pl:​miw:​miw08_xtt_rif:​przyklad3|Przykład 3]]//**\\ 
 +Przykład ten obrazuje serializację XML dla warunkór RIFa. 
 + 
 +**Serializacja języka reguł**\\ 
 +Jest to rozszerzenie Języka Warunkowego poprzez serializację reguł RIF-BLD. Element Forall zawira role elements declare and formula, które były wcześniej wykorzystywane w elemencie Exists. Element Implies zawiera role elementów if oraz then rozróżniające te dwie części reguły. 
 +<​code>​Klasy,​ role i ich zamierzone znaczenie 
 + 
 +- Ruleset (rule collection, containing rule roles) 
 +- Forall ​ (quantified formula for '​Forall',​ containing declare and formula roles) 
 +- Implies (implication,​ containing if and then roles) 
 +- if      (antecedent role, containing CONDITION) 
 +- then    (consequent role, containing a Uniterm, Equal, or Frame)</​code>​ 
 + 
 +**//​[[pl:​miw:​miw08_xtt_rif:​przyklad4|Przykład 4]]//**\\ 
 +Przykład przedstawia warunek z //​przykładu 2a// zapisany za pomocą XML'​a:​ 
 + 
 +===== 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.\\ 
 +Proponowany przeze mnie zapis wyglądał by tak: 
 +<code xml> 
 +<​Ruleset>​ 
 + <​rule>​ 
 +  <​declare><​Var>​A</​Var></​declare>​ 
 +  <​declare><​Var>​B</​Var></​declare>​ 
 +  <​declare><​Var>​C</​Var></​declare>​  
 +  <​formula>​ 
 +   <​Implies>​ 
 +    <​if>​ 
 +       <​formula>​ 
 +        <​Uniterm>​ 
 +         <​op><​Const type="​rif:​iri">​op:​numeric-lesser-than</​Const></​op>​ 
 +         <​arg><​Var>​A</​Var></​arg>​ 
 +         <​arg>​ 
 +          <​Uniterm>​ 
 +           <​op><​Const type="​rif:​iri">​op:​numeric-add</​Const></​op>​ 
 +           <​arg><​Const type="">​3</​Const></​arg>​ 
 +           <​arg><​Var>​B</​Var></​arg>​ 
 +          </​Uniterm>​ 
 +         </​arg>​ 
 +        </​Uniterm>​ 
 +       </​formula>​ 
 +    </​if>​ 
 +    <​then>​ 
 +      <​Uniterm>​ 
 +       <​op><​Const type="​rif:​iri">​fn:​assign</​Const></​op>​ 
 +       <​arg><​Var>​C</​Var></​arg>​ 
 +       <​arg><​Var>​B</​Var></​arg>​ 
 +      </​Uniterm>​ 
 +    </​then>​ 
 +   </​Implies>​ 
 +  </​formula>​ 
 + </​rule>​ 
 +</​Ruleset>​ 
 +</​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.1208096563.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