Prefinal Update: CONCRETE SYNTAX FOR RULES LITE

From: Harold Boley ([email protected])
Date: 09/30/03

  • Next message: Ian Horrocks: "Re: OWL Rules proposal (fwd)"
    Hi All,
    
    below, please find our prefinal CONCRETE SYNTAX FOR RULES LITE
    update, incorporating the only remaining change requests: 
    C1 Sandro's suggestion to use N3-like namespace declarations
       in the PR syntax ('xmlns' is used in the XML syntax).
    C2 Mike's suggestion to disallow 'data' elements as 1st args
       (making RULES LITE a kind of RDF Rules).
    
    Best,
    Harold
    -----------------------------------------------------------------
    
    
    CONCRETE SYNTAX FOR RULES LITE
    
    Draft 30 Sept 2003
    
    Harold Boley and Said Tabet
    
    
    
    Abstract
    --------
    
    A new Abridged RuleML/XML Syntax compatible with RDF and OWL-DL is
    developed into the Rules Lite Concrete Syntax. This covers webized
    unary and binary Datalog facts, rules, and queries. Principles,
    Prolog-like and XML examples, as well as a DTD are given.
    
    
    Acknowledgments
    ---------------
    
    Gerd Wagner, Benjamin Grosof, and others from the RuleML Initiative
    as well as Mike Dean and Sandro Hawke from the Joint Committee gave
    valuable input for this document. David Hirtle from UNB has helped
    validating the examples.
    
    
    
    Introduction
    ============
    
    This is our report on the Rules Lite Concrete Syntax work for
    Datalog facts, rules, and queries, envisaged in recent JC telecons.
    
    In this work all predicates are now going to be unary or binary
    (compatible with OWL-DL). Certain 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
    
    For preparing Webizing, the following use of "#"-prefixed
    fragment identifiers is made for symbolic 'href'-attribute naming:
    
    The earlier  <ind>constant</ind>       now
    becomes      <ind href="#constant"/>
    
    The earlier  <_opr>relation</_opr>     now
    becomes      <_opr href="#relation"/>
    
    While the (always empty) 'ind' element is used -- in the first or
    second argument position -- for 'href'-naming individual constants,
    a new 'data' element is used  -- in the second argument position --
    for tagging various data types as content (cf. RDF literals).
    
    An Abridged RuleML/XML Syntax is employed except for
    Herbrand Models, which are represented using Deep Markup:
    
    *1* The earlier <_opr><rel>relation</rel></_opr> will be
        abridged to      <_opr href="#relation/>.
    
    *2* The earlier <_body><and>atom1...atomK</and></_body> will be
        abridged to      <_body>atom1...atomK</_body> (K = 0, 1, ...).
    
    *3* Similarly,  <_head><and>atom1...atomK</and></_head> could be
        abridged to      <_head>atom1...atomK</_head> (for OWL Rules).
    
    *4* Prefix form <atom><_opr href="#relation/>term1...termN</atom>
        will be allowed (0 < N < 3);
        Postfix form <atom>term1...termN<_opr href="#relation/></atom>
        will be forbidden (0 < N < 3).
    
    *5* The earlier <fact><_head><atom>...</atom></_head></fact> will
        be further abridged to  <facto>...</facto>.
    
    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). The concrete syntax in *4* becomes an 'atom'-rooted tree
    with the operator and a sequence of the 1 or 2 argument terms as
    subtrees in the abstract syntax.
    
    In the next main sections PR-Prolog examples will be followed by
    Abridged RuleML/XML syntax (except for the Deep RuleML/XML Markup
    of Models):
    
    * PR-Prolog: Uses a Prolog-like presentation syntax as proposed in
      http://www.daml.org/listarchive/joint-committee/1406.html.
      (The current PR syntax does not yet capture all information that
      is in the XML syntax such as the new ind/data distinction or the
      namespace declarations to be modeled on N3.)
    
    * XML: Uses a version of the Abridged RuleML/XML syntax proposed in
      http://www.daml.org/listarchive/joint-committee/1411.html.
    
    The following sections discuss Facts, Rules, Queries (also usable
    as 'positive' or 'negative' integrity constraints), and Models.
    A general form of webizing will then be introduced for individuals
    as well as for for unary and binary predicates.
    
    The appendix will give the (DTD) syntax grammar.
    
    
    
    Facts
    =====
    
    Since an N-ary relation can always be reduced to a conjunction of
    binary predicates, we will not go beyond binary here.
    
    For instance, the fact
    
    "North America is flanked by the Atlantic and the Pacific"
    
    may initially seem to express a ternary relationship, but it can,
    e.g., be re-expressed using three binary facts glued together by a
    new individual, Oceanics, as shown as part of the knowledge base
    below.
    
    
    PR-Prolog:
    
    continent(North_America).
    country(Canada).
    country(USA).
    province(Ontario).
    oceanpair(Oceanics).
    ocean(Atlantic).
    ocean(Pacific).
    
    has_as_part(North_America,Canada).
    has_as_part(North_America,USA).
    has_as_part(Canada,Ontario).
    
    area(Canada,sqkm9976140).
    area(USA,sqkm9629091).
    
    flanked_by(North_America,Oceanics).
    flanked_by(Canada,Oceanics).
    flanked_by(USA,Oceanics).
    
    eastern(Oceanics,Atlantic).
    western(Oceanics,Pacific).
    
    
    XML:
    
    <rulebase>
    
      <facto>
        <_opr href="#continent"/>
        <ind href="#North_America"/>
      </facto>
    
      <facto>
        <_opr href="#country"/>
        <ind href="#Canada"/>
      </facto>
    
      <facto>
        <_opr href="#country"/>
        <ind href="#USA"/>
      </facto>
    
      <facto>
        <_opr href="#province"/>
        <ind href="#Ontario"/>
      </facto>
    
      <facto>
        <_opr href="#oceanpair"/>
        <ind href="#Oceanics"/>
      </facto>
    
      <facto>
        <_opr href="#ocean"/>
        <ind href="#Atlantic"/>
      </facto>
    
      <facto>
        <_opr href="#ocean"/>
        <ind href="#Pacific"/>
      </facto>
    
      <facto>
        <_opr href="#has_as_part"/>
        <ind href="#North_America"/>
        <ind href="#Canada"/>
      </facto>
    
      <facto>
        <_opr href="#has_as_part"/>
        <ind href="#North_America"/>
        <ind href="#USA"/>
      </facto>
    
      <facto>
        <_opr href="#has_as_part"/>
        <ind href="#Canada"/>
        <ind href="#Ontario"/>
      </facto>
    
      <facto>
        <_opr href="#area"/>
        <ind href="#Canada"/>
        <data>sqkm 9976140</data>
      </facto>
    
      <facto>
        <_opr href="#area"/>
        <ind href="#USA"/>
        <data>sqkm 9629091</data>
      </facto>
    
      <facto>
        <_opr href="#flanked_by"/>
        <ind href="#North_America"/>
        <ind href="#Oceanics"/>
      </facto>
    
      <facto>
        <_opr href="#flanked_by"/>
        <ind href="#Canada"/>
        <ind href="#Oceanics"/>
      </facto>
    
      <facto>
        <_opr href="#flanked_by"/>
        <ind href="#USA"/>
        <ind href="#Oceanics"/>
      </facto>
    
      <facto>
        <_opr href="#eastern"/>
        <ind href="#Oceanics"/>
        <ind href="#Atlantic"/>
      </facto>
    
      <facto>
        <_opr href="#western"/>
        <ind href="#Oceanics"/>
        <ind href="#Pacific"/>
      </facto>
    
    </rulebase>
    
    
    
    Rules
    =====
    
    PR-Prolog:
    
    stretches(?x,?y) :- has_as_part(?y,?x), co-flanked(?x,?y).
    
    co-flanked(?x,?y) :- flanked_by(?x,?z), flanked_by(?y,?z).
    
    
    XML:
    
    <rulebase>
    
      <imp>
        <_head>
          <atom>
            <_opr href="#stretches"/>
            <var>x</var>
            <var>y</var>
          </atom>
        </_head>
        <_body>
          <atom>
            <_opr href="#has_as_part"/>
            <var>y</var>
            <var>x</var>
          </atom>
          <atom>
            <_opr href="#co-flanked"/>
            <var>x</var>
            <var>y</var>
          </atom>
        </_body>
      </imp>
    
      <imp>
        <_head>
          <atom>
            <_opr href="#co-flanked"/>
            <var>x</var>
            <var>y</var>
          </atom>
        </_head>
        <_body>
          <atom>
            <_opr href="#flanked_by"/>
            <var>x</var>
            <var>z</var>
          </atom>
          <atom>
            <_opr href="#flanked_by"/>
            <var>y</var>
            <var>z</var>
          </atom>
        </_body>
      </imp>
    
    </rulebase>
    
    
    
    Conjunctive Queries (as 'Negative' Integrity Constraints)
    =========================================================
    
    PR-Prolog:
    
    continent(x), ocean(x)
    
    
    XML:
    
    <query>
      <_body>
        <atom>
          <_opr href="#continent"/>
          <var>x</var>
        </atom>
        <atom>
          <_opr href="#ocean"/>
          <var>x</var>
        </atom>
      </_body>
    </query>
    
    
    
    Herbrand-like Models (as Deep Markup Ground Facts)
    ==================================================
    
    Herbrand-like Models are represented using the unabridged Deep Markup
    (close to the abstract syntax).
    
    
    PR-Prolog:
    
    continent(North_America).
    country(Canada).
    country(USA).
    province(Ontario).
    oceanpair(Oceanics).
    ocean(Atlantic).
    ocean(Pacific).
    
    has_as_part(North_America,Canada).
    has_as_part(Canada,Ontario).
    
    has_as_part(North_America,Ontario).           % from OWL
    
    area(Canada,sqkm9976140).
    area(USA,sqkm9629091).
    
    flanked_by(North_America,Oceanics).
    flanked_by(Canada,Oceanics).
    flanked_by(USA,Oceanics).
    
    flanks(Oceanics,North_America).               % from OWL
    flanks(Oceanics,Canada).                      % from OWL
    flanks(Oceanics,USA).                         % from OWL
    
    co-flanked(North_America,Canada).
    co-flanked(Canada,North_America).
    co-flanked(North_America,USA).
    co-flanked(USA,North_America).
    co-flanked(Canada,USA).
    co-flanked(USA,Canada).
    co-flanked(North_America,North_America).
    co-flanked(Canada,Canada).
    co-flanked(USA,USA).
    
    stretches(Canada,North_America).
    stretches(USA,North_America).
    
    eastern(Oceanics,Atlantic).
    western(Oceanics,Pacific).
    
    
    XML:
    
    <rulebase>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#continent"/></_opr>
            <ind href="#North_America"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#country"/></_opr>
            <ind href="#Canada"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#country"/></_opr>
            <ind href="#USA"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#province"/></_opr>
            <ind href="#Ontario"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#oceanpair"/></_opr>
            <ind href="#Oceanics"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#ocean"/></_opr>
            <ind href="#Atlantic"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#ocean"/></_opr>
            <ind href="#Pacific"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#has_as_part"/></_opr>
            <ind href="#North_America"/>
            <ind href="#Canada"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#has_as_part"/></_opr>
            <ind href="#North_America"/>
            <ind href="#USA"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#has_as_part"/></_opr>
            <ind href="#Canada"/>
            <ind href="#Ontario"/>
          </atom>
        </_head>
      </fact>
    
      <fact>                                          <!-- from OWL -->
        <_head>
          <atom>
            <_opr><rel href="#has_as_part"/></_opr>
            <ind href="#North_America"/>
            <ind href="#Ontario"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#area"/></_opr>
            <ind href="#Canada"/>
            <data>sqkm 9976140</data>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#area"/></_opr>
            <ind href="#USA"/>
            <data>sqkm 9629091</data>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#flanked_by"/></_opr>
            <ind href="#North_America"/>
            <ind href="#Oceanics"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#flanked_by"/></_opr>
            <ind href="#Canada"/>
            <ind href="#Oceanics"/>
          </atom>
        </_head>
      </fact>
    
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#flanked_by"/></_opr>
            <ind href="#USA"/>
            <ind href="#Oceanics"/>
          </atom>
        </_head>
      </fact>
    
      <fact>                                          <!-- from OWL -->
        <_head>
          <atom>
            <_opr><rel href="#flanks"/></_opr>
            <ind href="#Oceanics"/>
            <ind href="#North_America"/>
          </atom>
        </_head>
      </fact>
    
      <fact>                                          <!-- from OWL -->
        <_head>
          <atom>
            <_opr><rel href="#flanks"/></_opr>
            <ind href="#Oceanics"/>
            <ind href="#Canada"/>
          </atom>
        </_head>
      </fact>
    
      <fact>                                          <!-- from OWL -->
        <_head>
          <atom>
            <_opr><rel href="#flanks"/></_opr>
            <ind href="#Oceanics"/>
            <ind href="#USA"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#co-flanked"/></_opr>
            <ind href="#North_America"/>
            <ind href="#Canada"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#co-flanked"/></_opr>
            <ind href="#Canada"/>
            <ind href="#North_America"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#co-flanked"/></_opr>
            <ind href="#North_America"/>
            <ind href="#USA"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#co-flanked"/></_opr>
            <ind href="#USA"/>
            <ind href="#North_America"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#co-flanked"/></_opr>
            <ind href="#Canada"/>
            <ind href="#USA"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#co-flanked"/></_opr>
            <ind href="#USA"/>
            <ind href="#Canada"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#co-flanked"/></_opr>
            <ind href="#North_America"/>
            <ind href="#North_America"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#co-flanked"/></_opr>
            <ind href="#Canada"/>
            <ind href="#Canada"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#co-flanked"/></_opr>
            <ind href="#USA"/>
            <ind href="#USA"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#eastern"/></_opr>
            <ind href="#Oceanics"/>
            <ind href="#Atlantic"/>
          </atom>
        </_head>
      </fact>
    
      <fact>
        <_head>
          <atom>
            <_opr><rel href="#western"/></_opr>
            <ind href="#Oceanics"/>
            <ind href="#Pacific"/>
          </atom>
        </_head>
      </fact>
    
    </rulebase>
    
    
    
    Webizing
    ========
    
    Individuals as well as unary and binary predicates can be webized
    by augmenting, within the href's, their symbolic "#"-names by URIs,
    so that two possibilities result:
    
    *1* Symbolic names: In XML with "#"-prefixed fragment identifiers
        (the pre-webized situation).
    
    *2* URIs: In XML with "#"-separated fragment identifiers (cf. RDF).
    
    
    PR-Prolog (with N3-like URIs and namespace declarations):
    
    w := http://www.waters.org.
    
    continent(<http://www.north_america.org#North_America>).
    ...
    <http://www.pairs.org/ocean#oceanpair>(<w#Oceanics>).
    ...
    <http://www.mereology.org#has_as_part>(North_America,Canada).
    ...
    <http://www.direction.org#western>(<w#Oceanics>,Pacific).
    
    
    XML:
    
    <rulebase
      xmlns:w="http://www.waters.org">
    
      <facto>
        <_opr href="#continent"/>
        <ind href="http://www.north_america.org#North_America"/>
      </facto>
    
      ...
    
      <facto>
        <_opr href="http://www.pairs.org/ocean#oceanpair"/>
        <ind href="w#Oceanics"/>
      </facto>
    
      ...
    
      <facto>
        <_opr href="http://www.mereology.org#has_as_part"/>
        <ind href="#North_America"/>
        <ind href="#Canada"/>
      </facto>
    
      ...
    
      <facto>
        <_opr href="http://www.direction.org#western"/>
        <ind href="w#Oceanics"/>
        <ind href="#Pacific"/>
      </facto>
    
    </rulebase>
    
    
    
    Conclusions
    ===========
    
    After the definition of the Rules Lite Concrete Syntax, the next
    step is to modify existing parsers (and generators), allowing this
    syntax to be used for rule interchange. Possible implementations
    have been envisaged for cwm, Jena 2, OWL engines, jDREW, and Jess
    adaptations.
    
    To demonstrate the extension path to N-ary relations, ternary
    predicates could be added later as exemplified in
    http://www.daml.org/listarchive/joint-committee/1444.html;
    as an alternative or complement, the transition to full Horn logic
    could be attempted, where data like sqkm9976140 could be 'analyzed'
    as complex terms like sqkm[9976140].
    
    
    
    Appendix: DTD for Rules Lite (Facts and Rules)
    ==============================================
    
    
    <!ELEMENT rulebase ((imp | facto)*)>
    
    
    <!ELEMENT imp ((_head, _body) | (_body, _head))>
    
    <!ELEMENT facto (_opr, ind, (ind | data)?)>
    
    
    <!ELEMENT _head (atom)>
    
    <!ELEMENT _body (atom*)>
    
    <!ELEMENT atom (_opr, (ind | var), (ind | data | var)?)>
    
    
    <!ELEMENT _opr EMPTY>
    
    <!ELEMENT ind  EMPTY>
    
    <!ELEMENT data (#PCDATA)>
    
    <!ELEMENT var  (#PCDATA)>
    
    
    <!ATTLIST _opr href CDATA #REQUIRED>
    
    <!ATTLIST ind  href CDATA #REQUIRED>
    
    
    <!-- The CDATA must be either
         URIs with "#"-separated fragment identifiers (for URI naming) or
         local, "#"-prefixed fragment identifiers (for symbolic naming) -->
    


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