CONCRETE SYNTAX FOR RULES LITE

From: Harold Boley (boley@informatik.uni-kl.de)
Date: 09/02/03

  • Next message: Mike Dean: "Jena 2 rule engine"
    CONCRETE SYNTAX FOR RULES LITE
    
    Draft 2 Sept 2003
    
    Harold Boley and Said Tabet
    
    
    
    This is an update to the Rules Lite concrete syntax work on
    Datalog facts, rules, and queries (also usable as 'positive' or
    'negative' integrity constraints).
    
    In the following examples all predicates will be unary or binary
    (compatible with OWL-DL) or ternary (demonstrating the extension
    path to N-ary relations). The unary predicates could also be
    employed for typing some of the rule variables (the others being
    of type 'any'), as discussed in an earlier series of JC telecons
    (http://www.daml.org/listarchive/joint-committee/1230.html).
    
    By allowing OWL's allValuesFrom and someValuesFrom restrictions
    (http://www.w3.org/TR/owl-guide/#allValuesFrom) in Rules Lite's
    bodies and (perhaps) heads, the concrete syntax could be further
    adapted to the recent OWL Rules proposal:
    http://www.daml.org/listarchive/joint-committee/1430.html
    
    
    A new Abridged RuleML/XML is presented here that also permits
    infix operators (even for N-ary relations):
    
    *1* The earlier <_opr><rel>relation</rel></_opr> will be
        abridged to      <_opr>relation</_opr>.
    
    *2* The earlier <_body><and>atom1...atomK</and></_body> will be
        abridged to      <_body>atom1...atomK</_body>.
    
    *3* Similarly,  <_head><and>atom1...atomK</and></_head> could be
        abridged to      <_head>atom1...atomK</_head> (for OWL Rules).
    
    *4* Besides <atom><_opr>relation</_opr>term1...termN</atom>
        and     <atom>term1...termN<_opr>relation</_opr></atom>,
        also <atom>term1<_opr>relation</_opr>term2...termN</atom>
        and all other infix uses of _opr will be allowed.
    
    While this is a concrete XML syntax, it builds on a data model
    integrating the data models of XML and RDF: A role like _opr
    corresponds to an RDF property (used as an arc label in its DLG
    model). Allowing infix operators does not change this data model,
    so the abstract syntax for all concrete syntax variations in *4*
    is the 'atom'-rooted tree with an operator and a sequence of the
    N argument terms as subtrees.
    
    
    
    Prolog examples will be followed by Abridged RuleML/XML syntax:
    
    * Prolog: Always uses prefix operators.
    
    * XML:    Uses Abridged RuleML/XML syntax as proposed in
      http://www.daml.org/listarchive/joint-committee/1411.html,
      but now also permits infix operators as prepared in
      http://www.daml.org/listarchive/joint-committee/1427.html.
    
    
    
    Facts
    -----
    
    Prolog:
    
    continent(North_America).
    ocean(Atlantic).
    ocean(Pacific).
    
    has_as_part(North_America,Canada).
    has_as_part(Canada,Ontario).
    
    between(North_America,Atlantic,Pacific).
    
    
    XML (prefix, postfix, and infix operators):
    
    <rulebase>
    
      <fact>
        <_head>
          <atom>
            <_opr>continent</_opr>
            <ind>North America</ind>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <ind>Atlantic</ind>
            <_opr>ocean</_opr>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <ind>Pacific</ind>
            <_opr>ocean</_opr>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <ind>North America</ind>
            <_opr>has as part</_opr>
            <ind>Canada</ind>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <ind>Canada</ind>
            <_opr>has as part</_opr>
            <ind>Ontario</ind>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <ind>North America</ind>
            <_opr>between</_opr>
            <ind>Atlantic</ind>
            <ind>Pacific</ind>
          </atom>
        </_head>
      </fact>
    
    </rulebase>
    
    
    
    Rules
    -----
    
    Prolog (to be executed with iterative deepening):
    
    has_as_part(x,z) :- has_as_part(x,y), has_as_part(y,z).
    
    between(x,y,z) :- between(x,z,y).
    
    
    XML (infix operators):
    
    <rulebase>
    
      <imp>
        <_head>
          <atom>
            <var>x</var>
            <_opr>has as part</_opr>
            <var>z</var>
          </atom>
        </_head>
        <_body>
          <atom>
            <var>x</var>
            <_opr>has as part</_opr>
            <var>y</var>
          </atom>
          <atom>
            <var>y</var>
            <_opr>has as part</_opr>
            <var>z</var>
          </atom>
        </_body>
      </imp>
    
      <imp>
        <_head>
          <atom>
            <var>x</var>
            <_opr>between</_opr>
            <var>y</var>
            <var>z</var>
          </atom>
        </_head>
        <_body>
          <atom>
            <var>x</var>
            <_opr>between</_opr>
            <var>z</var>
            <var>y</var>
          </atom>
        </_body>
      </imp>
    
    </rulebase>
    
    
    
    Conjunctive Queries (as 'Negative' Integrity Constraints)
    -------------------------------------------------------
    
    Prolog:
    
    continent(x), ocean(x).
    
    
    XML (prefix and postfix operators):
    
    <query>
      <_body>
        <atom>
          <_opr>continent</_opr>
          <var>x</var>
        </atom>
        <atom>
          <var>x</var>
          <_opr>ocean</_opr>
        </atom>
      </_body>
    </query>
    
    
    
    Least Herbrand Models (as Ground Facts)
    ---------------------------------------
    
    Prolog:
    
    continent(North_America).
    ocean(Atlantic).
    ocean(Pacific).
    
    has_as_part(North_America,Canada).
    has_as_part(Canada,Ontario).
    has_as_part(North_America,Ontario).
    
    between(North_America,Atlantic,Pacific).
    between(North_America,Pacific,Atlantic).
    
    
    XML (prefix operators):
    
    <rulebase>
    
      <fact>
        <_head>
          <atom>
            <_opr>continent</_opr>
            <ind>North America</ind>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr>ocean</_opr>
            <ind>Atlantic</ind>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr>ocean</_opr>
            <ind>Pacific</ind>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr>has as part</_opr>
            <ind>North America</ind>
            <ind>Canada</ind>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr>has as part</_opr>
            <ind>Canada</ind>
            <ind>Ontario</ind>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr>has as part</_opr>
            <ind>North America</ind>
            <ind>Ontario</ind>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr>between</_opr>
            <ind>North America</ind>
            <ind>Atlantic</ind>
            <ind>Pacific</ind>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr>between</_opr>
            <ind>North America</ind>
            <ind>Pacific</ind>
            <ind>Atlantic</ind>
          </atom>
        </_head>
      </fact>
    
    </rulebase>
    


    This archive was generated by hypermail 2.1.4 : 09/02/03 EST