This is an archive of an inactive wiki and cannot be modified.

The namespace of RIF is http://www.w3.org/2007/rif#.

XML schemas for the RIF BLD sublanguages are available below and online, which already helped to find and fix invalid parts in the examples.

Positive Conditions

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

<xs:schema 
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns="http://www.w3.org/2007/rif#"
  targetNamespace="http://www.w3.org/2007/rif#"
  elementFormDefault="qualified"
  version="Id: RIFPosCond.xsd,v 0.6 2007/10/24 dhirtle">

  <xs:annotation>
    <xs:documentation>
    This is a preliminary XML schema for Positive Conditions as defined by
    Working Draft 1 of the RIF Basic Logic Dialect.
    
    The schema is based on the following EBNF for the presentation syntax:
    
    CONDITION   ::= 'And' ' ( ' CONDITION* ' ) ' |
                    'Or' ' ( ' CONDITION* ' ) ' |
                    'Exists' Var+ ' ( ' CONDITION ' ) ' |
                    ATOMIC
    ATOMIC      ::= Uniterm | Equal
    Uniterm     ::= Const ' ( ' TERM* ' ) '
    Equal       ::= TERM ' = ' TERM
    TERM        ::= Const | Var | Uniterm
    Const       ::= LITERAL '^^' SYMSPACE
    Var         ::= '?' VARNAME
    </xs:documentation>
  </xs:annotation>

        <xs:group name="CONDITION">  
    <!--
    CONDITION   ::= 'And' ' ( ' CONDITION* ' ) ' |
                    'Or' ' ( ' CONDITION* ' ) ' |
                    'Exists' Var+ ' ( ' CONDITION ' ) ' |
                    ATOMIC
                -->
                <xs:choice>
                        <xs:element ref="And"/>
                        <xs:element ref="Or"/>
      <xs:element ref="Exists"/>
      <xs:group ref="ATOMIC"/>
                </xs:choice>
        </xs:group>

  <xs:element name="And">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="formula" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Or">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="formula" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Exists">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="declare" minOccurs="1" maxOccurs="unbounded"/>
        <xs:element ref="formula"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="formula">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="CONDITION"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="declare">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Var"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  

  <xs:group name="ATOMIC">
                <!--
                ATOMIC      ::= Uniterm | Equal
                -->
                <xs:choice>
                        <xs:element ref="Uniterm"/>
                        <xs:element ref="Equal"/>
                </xs:choice>
        </xs:group>
  
  <xs:element name="Uniterm">  
                <!--
                Uniterm     ::= Const ' ( ' TERM* ' ) '
                -->
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="op"/>
        <xs:element ref="arg" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="op">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Const"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="arg">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="TERM"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
 
  <xs:element name="Equal">
    <!--
                Equal       ::= TERM ' = ' TERM
                -->
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="side"/>
        <xs:element ref="side"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="side">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="TERM"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

        <xs:group name="TERM">  
                <!--
                TERM        ::= Const | Var | Uniterm
                -->
                <xs:choice>
                        <xs:element ref="Const"/>
                        <xs:element ref="Var"/>
      <xs:element ref="Uniterm"/>
                </xs:choice>
        </xs:group>
  
  <xs:element name="Const">
    <!--
                Const       ::= LITERAL '^^' SYMSPACE
    -->
    <xs:complexType mixed="true">
      <xs:sequence/>
      <xs:attribute name="type" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Var" type="xs:string">
    <!--
    Var         ::= '?' VARNAME
    -->
  </xs:element>
  
</xs:schema>

Slotted Conditions

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

<xs:schema 
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns="http://www.w3.org/2007/rif#"
  targetNamespace="http://www.w3.org/2007/rif#"
  elementFormDefault="qualified"
  version="Id: RIFSlotCond.xsd,v 0.6 2007/10/24 dhirtle">

  <xs:annotation>
    <xs:documentation>
    This is a preliminary XML schema for Slotted Conditions as defined by
    Working Draft 1 of the RIF Basic Logic Dialect.
    
    The schema is based on the following EBNF for the presentation syntax:
    
    CONDITION      ::= 'And' ' ( ' CONDITION* ' ) ' |
                       'Or' ' ( ' CONDITION* ' ) ' |
                       'Exists' Var+ ' ( ' CONDITION ' ) ' |
                       ATOMIC
    ATOMIC         ::= Uniterm | Equal | CLASSIFICATION | Frame
    Uniterm        ::= Const ' ( ' (TERM* | (Const ' -> ' TERM)*) ' ) '
    Equal          ::= TERM '=' TERM
    CLASSIFICATION ::= TERM ' # ' TERM | TERM ' ## ' TERM
    Frame          ::= (TERM | CLASSIFICATION) ' [ ' (TERM ' -> ' (TERM | Frame))* ' ] '
    TERM           ::= Const | Var | Uniterm
    Const          ::= LITERAL '^^' SYMSPACE
    Var            ::= '?' VARNAME
    </xs:documentation>
  </xs:annotation>
  
        <xs:group name="CONDITION">  
    <!--
    CONDITION   ::= 'And' ' ( ' CONDITION* ' ) ' |
                    'Or' ' ( ' CONDITION* ' ) ' |
                    'Exists' Var+ ' ( ' CONDITION ' ) ' |
                    ATOMIC
                -->
                <xs:choice>
                        <xs:element ref="And"/>
                        <xs:element ref="Or"/>
      <xs:element ref="Exists"/>
      <xs:group ref="ATOMIC"/>
                </xs:choice>
        </xs:group>

  <xs:element name="And">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="formula" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Or">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="formula" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Exists">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="declare" minOccurs="1" maxOccurs="unbounded"/>
        <xs:element ref="formula"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="formula">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="CONDITION"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="declare">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Var"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
        <xs:group name="ATOMIC">
                <!--
                ATOMIC         ::= Uniterm | Equal | CLASSIFICATION | Frame
                -->
                <xs:choice>
                        <xs:element ref="Uniterm"/>
                        <xs:element ref="Equal"/>
      <xs:group ref="CLASSIFICATION"/>
      <xs:element ref="Frame"/>
                </xs:choice>
        </xs:group>
  
  <xs:element name="Uniterm">
    <!--
    Uniterm        ::= Const ' ( ' (TERM* | (Const ' -> ' TERM)*) ' ) '
    -->
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="op"/>
        <xs:choice>
          <xs:element ref="arg" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element ref="slot" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="op">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Const"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="arg">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="TERM"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="slot">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Const"/>
        <xs:group ref="TERM"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
 
  <xs:element name="Equal">
    <!--
    Equal          ::= TERM '=' TERM
    -->
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="side"/>
        <xs:element ref="side"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="side">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="TERM"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
        <xs:group name="CLASSIFICATION">
                <!--
                CLASSIFICATION ::= TERM ' # ' TERM | TERM ' ## ' TERM
                -->
                <xs:choice>
                        <xs:element ref="Member"/>
                        <xs:element ref="Subclass"/>
                </xs:choice>
        </xs:group>
  
  <xs:element name="Member">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="lower"/>
        <xs:element ref="upper"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="Subclass">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="lower"/>
        <xs:element ref="upper"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="lower">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="TERM"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="upper">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="TERM"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Frame">
    <!--
    Frame          ::= (TERM | CLASSIFICATION) ' [ ' (TERM ' -> ' (TERM | Frame))* ' ] '
    -->
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="object"/>
        <xs:element name="slot" minOccurs="0" maxOccurs="unbounded">
          <!-- note difference from slot in Uniterm -->
          <xs:complexType>
            <xs:sequence>
              <xs:group ref="TERM"/>
              <xs:choice>
                <xs:group ref="TERM"/>
                <xs:element ref="Frame"/>
              </xs:choice>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="object">
    <xs:complexType>
      <xs:choice>
        <xs:group ref="TERM"/>
        <xs:group ref="CLASSIFICATION"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>
  
        <xs:group name="TERM">  
                <!--
                TERM        ::= Const | Var | Uniterm
                -->
                <xs:choice>
                        <xs:element ref="Const"/>
                        <xs:element ref="Var"/>
      <xs:element ref="Uniterm"/>
                </xs:choice>
        </xs:group>
  
  <xs:element name="Const">
    <!--
                Const       ::= LITERAL '^^' SYMSPACE
    -->
    <xs:complexType mixed="true">
      <xs:sequence/>
      <xs:attribute name="type" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Var" type="xs:string">
    <!--
    Var         ::= '?' VARNAME
    -->
  </xs:element>
  
</xs:schema>

Horn Rules

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

<xs:schema 
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns="http://www.w3.org/2007/rif#"
  targetNamespace="http://www.w3.org/2007/rif#"
  elementFormDefault="qualified"
  version="Id: RIFPosHorn.xsd,v 0.6 2007/10/24 dhirtle">

  <xs:annotation>
    <xs:documentation>
    This is a preliminary XML schema for Horn rules as defined by
    Working Draft 1 of the RIF Basic Logic Dialect.
    
    The schema is based on the following EBNF for the presentation syntax:
    
    Document ::= Ruleset*
    Ruleset  ::= RULE*
    RULE     ::= ' Forall ' Var+ ' ( ' RULE ' ) ' | Implies | ATOMIC
    Implies  ::= ATOMIC ' :- ' CONDITION
    
    Note that this is an extension of the syntax for Positive Conditions.
    </xs:documentation>
  </xs:annotation>

  <xs:element name="Document">
    <!--
    Document ::= Ruleset*
    -->
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Ruleset" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Ruleset">
    <!--
    Ruleset  ::= RULE*
    -->
    <xs:complexType>
      <xs:sequence>
        <xs:element name="rule" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:group ref="RULE"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
        <xs:group name="RULE">
                <!-- 
                RULE     ::= ' Forall ' Var+ ' ( ' RULE ' ) ' | Implies | ATOMIC
                -->
                <xs:choice>
                        <xs:element ref="Forall"/>
      <xs:element ref="Implies"/>
      <xs:group ref="ATOMIC"/>
    </xs:choice>
        </xs:group>

  <xs:element name="Forall">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="declare" minOccurs="1" maxOccurs="unbounded"/>
        <xs:element name="formula">
          <xs:complexType>
            <xs:group ref="RULE"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
    
  <xs:element name="Implies">
    <!--
    Implies  ::= ATOMIC ' :- ' CONDITION
    -->
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="if"/>
        <xs:element ref="then"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="if">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="CONDITION"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="then">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="ATOMIC"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
        <xs:group name="CONDITION">  
    <!--
    CONDITION   ::= 'And' ' ( ' CONDITION* ' ) ' |
                    'Or' ' ( ' CONDITION* ' ) ' |
                    'Exists' Var+ ' ( ' CONDITION ' ) ' |
                    ATOMIC
                -->
                <xs:choice>
                        <xs:element ref="And"/>
                        <xs:element ref="Or"/>
      <xs:element ref="Exists"/>
      <xs:group ref="ATOMIC"/>
                </xs:choice>
        </xs:group>

  <xs:element name="And">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="formula" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Or">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="formula" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Exists">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="declare" minOccurs="1" maxOccurs="unbounded"/>
        <xs:element ref="formula"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <!-- default formula; note different versions for Ruleset and Forall -->
  <xs:element name="formula">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="CONDITION"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="declare">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Var"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:group name="ATOMIC">
                <!--
                ATOMIC      ::= Uniterm | Equal
                -->
                <xs:choice>
                        <xs:element ref="Uniterm"/>
                        <xs:element ref="Equal"/>
                </xs:choice>
        </xs:group>
  
  <xs:element name="Uniterm">  
                <!--
                Uniterm     ::= Const ' ( ' TERM* ' ) '
                -->
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="op"/>
        <xs:element ref="arg" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="op">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Const"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="arg">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="TERM"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
 
  <xs:element name="Equal">
    <!--
                Equal       ::= TERM ' = ' TERM
                -->
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="side"/>
        <xs:element ref="side"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="side">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="TERM"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
        <xs:group name="TERM">  
                <!--
                TERM        ::= Const | Var | Uniterm
                -->
                <xs:choice>
                        <xs:element ref="Const"/>
                        <xs:element ref="Var"/>
      <xs:element ref="Uniterm"/>
                </xs:choice>
        </xs:group>
  
  <xs:element name="Const">
    <!--
                Const       ::= LITERAL '^^' SYMSPACE
    -->
    <xs:complexType mixed="true">
      <xs:sequence/>
      <xs:attribute name="type" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="Var" type="xs:string">
    <!--
    Var         ::= '?' VARNAME
    -->
  </xs:element>

</xs:schema>