PRD Schema

From RIF
Revision as of 20:25, 15 May 2009 by AdrianPaschke (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Back to Schema Index

This is the proposed schema for PRD, divided into sections.

Head

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema
    targetNamespace="http://www.w3.org/2007/rif#"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns="http://www.w3.org/2007/rif#"
    elementFormDefault="qualified">

Inclusion of Core condition part


<!-- ================================================== -->
<!-- Redefine some elements in the Core Conditions      -->
<!-- Extension of some choices                          -->
<!-- ================================================== -->

<xs:redefine schemaLocation="CoreRule.xsd">

   <xs:group name="ATOMIC">
      <xs:choice>
         <xs:group ref="ATOMIC"/>
         <xs:element ref="Member"/>
      </xs:choice>
   </xs:group>

   <xs:group name="FORMULA">
      <xs:choice>
         <xs:group ref="FORMULA"/>
         <xs:element ref="NEGATEDFORMULA"/>
<!-- TODO: Check if subclass is in FORMULA -->
         <xs:element ref="Subclass"/>
      </xs:choice>
   </xs:group>

Inclusion of Core rule body part

<!-- ================================================== -->
<!-- Redefine some elements in the Core constructs      -->
<!-- ================================================== -->

   <xs:complexType name="Group-contents">
      <xs:complexContent>
         <xs:extension base="Group-contents">
            <xs:sequence>
               <!-- Adds the following elements to the existing IRIMETA and sentence -->
               <xs:element ref="behavior" minOccurs="0" maxOccurs="1"/>
            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>

<!-- ================================================== -->
<!-- We have decided not to have an extension mechanism -->
<!-- Keep this just in case we changed mind             -->
<!-- ================================================== -->
<!--
   <xs:complexType name="Forall-premises">
      <xs:complexContent>
         <xs:extension base="Forall-premises">
            <xs:sequence>
               <xs:element name="pattern" minOccurs="0" maxOccurs="unbounded">
                  <xs:complexType>
                     <xs:sequence>
                        <xs:group ref="FORMULA"/>
                     </xs:sequence>
                  </xs:complexType>
               </xs:element>
            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>
-->

   <xs:complexType name="then-part">
      <xs:complexContent>
         <xs:extension base="then-part">
            <xs:choice>
               <xs:element ref="Do"/>
               <xs:group ref="ATOMIC"/>
            </xs:choice>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>

</xs:redefine>

Additional elements to the Core schema


<!-- ================================================== -->
<!-- Additional elements to the Core schema             -->
<!-- ================================================== -->

   <xs:element name="Subclass">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="sub">
               <xs:complexType>
                  <xs:group ref="TERM" minOccurs="1" maxOccurs="1"/>
               </xs:complexType>
            </xs:element>
            <xs:element name="super">
               <xs:complexType>
                  <xs:group ref="TERM" minOccurs="1" maxOccurs="1"/>
               </xs:complexType>
            </xs:element>
         </xs:sequence>
      </xs:complexType>
   </xs:element>


  <xs:group name="NEGATEDFORMULA">
    <!--
      NEGATEDFORMULA        ::= 'INeg' '(' FORMULA ')' 
    -->
    <xs:sequence>
      <xs:element ref="INeg"/>
    </xs:sequence>
  </xs:group>
  

<!-- Previsouly named NmNot -->
   <xs:element name="INeg">
      <xs:complexType>
        <xs:sequence>
          <xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
          <xs:element ref="formula" minOccurs="0" maxOccurs="1"/>
        </xs:sequence>
      </xs:complexType>
   </xs:element>

 

Definition of the actions

<!-- ============================================ -->
<!-- Definition of the actions                    -->
<!-- ============================================ -->

  <!-- ACTION_BLOCK   ::= IRIMETA? ('Do (' (Var (Frame | 'New'))* ATOMIC_ACTION+  ')' |
                     'And (' (Atom | Frame)* ')' | Atom | Frame) -->

  <xs:group name="ACTION_BLOCK">
    <xs:sequence>
      <xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
      <xs:choice>
         <xs:element ref="Do"/>
         <xs:element ref="And"/>
         <xs:element ref="Atom"/>
         <xs:element ref="Frame"/>
      </xs:choice>
    </xs:sequence>
   </xs:group>

   <!-- 'Do (' (IRIMETA? Var (Frame | 'New'))* ATOMIC_ACTION+  ')'--->
   <xs:element name="Do">
      <xs:complexType>
         <xs:sequence>            
           <xs:element ref="actionVar" minOccurs="0" maxOccurs="unbounded"/>
           <xs:element ref="actions" minOccurs="1" maxOccurs="1"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>

   <xs:element name="actionVar">
         <xs:complexType>
               <xs:sequence>
                   <xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
                   <xs:element name="Var" minOccurs="1" maxOccurs="1"/>
                   <xs:element name="ACTIONVARIABLEDECLARATION" minOccurs="1" maxOccurs="1"/>
                </xs:sequence>
                <xs:attribute name="ordered" type="xs:string" fixed="yes"/>
          </xs:complexType>
   </xs:element>

   <xs:element name="actions">
               <xs:complexType>
                  <xs:sequence>
                     <xs:group ref="ATOMIC_ACTION" minOccurs="1" maxOccurs="unbounded"/>
                  </xs:sequence>
                  <xs:attribute name="ordered" type="xs:string" fixed="yes"/>
               </xs:complexType>
   </xs:element>
  
  <!-- The New element is always empty. -->
  <xs:element name="New">
  </xs:element>

  <!-- 
   <xs:group name="ACTIONVARIABLEDECLARATION">
      <xs:choice>
         <xs:element ref="New"/>
         <xs:element ref="Frame"/>
      </xs:choice>
   </xs:group>

   <!-- ATOMIC_ACTION  ::= IRIMETA? (Assert | Retract | Modify | Execute ) -->
   <xs:group name="ATOMIC_ACTION">
    <xs:sequence>
      <xs:group ref="IRIMETA" minOccurs="0" maxOccurs="1"/>
      <xs:choice>
         <xs:element ref="Assert"/>
         <xs:element ref="Retract"/>
         <xs:element ref="Modify"/>
         <xs:element ref="Execute"/>
      </xs:choice>
    <xs:sequence>
   </xs:group>

   <!-- Assert         ::= 'Assert' '(' Atom | Frame | Member ')'-->
   <xs:element name="Assert">
      <xs:complexType>
         <xs:choice>
            <xs:element name="target" minOccurs="1" maxOccurs="1">
               <xs:complexType>
                  <xs:choice>
                     <xs:element ref="Atom"/>
                     <xs:element ref="Frame"/>
                     <xs:element ref="Member"/>
                  </xs:choice>
               </xs:complexType>
	    </xs:element>
	 </xs:choice>
     </xs:complexType>
   </xs:element>

   <!-- Retract        ::= 'Retract' '(' ( Atom | Frame | Var | Const ) ')'-->
   <xs:element name="Retract">
      <xs:complexType>
         <xs:choice>
            <xs:element name="target" minOccurs="1" maxOccurs="1">
               <xs:complexType>
                  <xs:choice>
                     <xs:element ref="Atom"/>
                     <xs:element ref="Frame"/>
                     <xs:group ref="TERM"/>
                  </xs:choice>
               </xs:complexType>
            </xs:element>
         </xs:choice>
      </xs:complexType>
   </xs:element>

   <!-- Modify         ::= 'Modify'  '(' Frame ')'-->
   <xs:element name="Modify">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="target" minOccurs="1" maxOccurs="1">
               <xs:complexType>
                  <xs:choice>
                     <xs:element ref="Frame"/>
                  </xs:choice>
               </xs:complexType>
	    </xs:element>
	 </xs:sequence>
      </xs:complexType>
   </xs:element>

   <!-- Execute         ::= 'Execute'  '(' Atom ')'-->
   <xs:element name="Execute">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="target" minOccurs="1" maxOccurs="1">
               <xs:complexType>
                  <xs:choice>
                     <xs:element ref="Atom"/>
                  </xs:choice>
               </xs:complexType>
	    </xs:element>
	 </xs:sequence>
      </xs:complexType>
   </xs:element>

Document and group related additions


<!-- ============================================ -->
<!-- Document and group related additions         -->
<!-- ============================================ -->

   <xs:element name="behavior">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="ConflictResolution" minOccurs="0" maxOccurs="1" type="xs:anyURI"/>
            <xs:element name="Priority" minOccurs="0" maxOccurs="1" type="xs:int"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>