Updated: SEMANTIC WEB RULE LANGUAGE: DATA MODEL, SYNTACTIC LAWS, AND XML MARKUP

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

  • Next message: Benjamin Grosof: "Re: Joint Committee telecon tomorrow 15 July: presentation syntax updated"
    Hi Mike and All,
    
    this is an update after yesterday's Rules XML Syntax session
    (inlined; BTW, it wasn't attached yesterday either).
    
    Best,
    Harold 
    
    ----------------------------------------------
    
    SEMANTIC WEB RULE LANGUAGE: DATA MODEL, SYNTACTIC LAWS, AND XML MARKUP
    
    Draft 23 July 2003
    
    Harold Boley, Said Tabet, Gerd Wagner
    
    
    Abstract
    
    We give the rule syntax as a data model with algebraic laws in a graphical notation.
    For presentation purposes we begin with the positional syntax and then go into the
    object-oriented syntax. The algebraic laws, here tree equations, define equivalence
    classes that give us a higher level of abstraction than in ordinary abstract syntax
    (yet, we do not view this here as the lowest level of semantics). For semantic and
    implementation purposes, the symmetric equational laws can be oriented to become
    directed equations computing representatives of the equivalence classes as normal
    (canonical) forms. Meaning and behavior then need only be given to normalized rules.
    However, it may be preferable to use shorter non-normal forms for I/O and transport.
    Data model trees can be easily transcribed into the XML markup. The PR shorthand and
    presentation syntax (http://www.ruleml.org/submission/ruleml-shortation.html), where
    given, can also be pasted into the parser linked from PR's 'Implementation' section.
    For an XML markup discussion see "Essential RuleML: The discount rulebase use case"
    (http://www.ruleml.org/submission/essentialruleml.html). Finally, we give an initial
    syntax for typing rule variables by URI-referencing RDFS or OWL classes.
    
    
    Acknowledgments
    
    Benjamin Grosof and others from the RuleML Initiative provided valuable input for this
    document. The Joint Committee, in particular Pat Hayes, Sandro Hawke, and Mike Dean,
    helped us improving it. 
    
    
    
    Positional Syntax
    =================
    
    Data Model
    ~~~~~~~~~
    
    Trees with two categories of arcs, XML-like positional arcs and RDF-like role arcs:
    
    Positional:         |
    
    Roles (system):     *
    
    
    Example (PR):
    
    discount(?customer,?product,percent5.0)  :-       
       premium(?customer), regular(?product).
    
    
    Example (standard):
    
     imp-------------------------------------------------
              *                                         *
         head *                                    body *
              *                                         *
            atom----------------------------           and----------------------
                 *       |       |         |                *                  *
             opr *       |       |         |                *                  *
                 *       |       |         |                *                  *        
                rel     var     var       ind             atom----------     atom----------
                 .       .       .          .                  *       |          *       |
                 .       .       .          .              opr *       |      opr *       |
                 .       .       .          .                  *       |          *       |
           discount   customer   product   5.0 percent        rel     var        rel     var
                                                               .       .          .       .
                                                               .       .          .       .
                                                               .       .          .       .
                                                           premium  customer    regular  product
    
    Example (sequence expanded):
    
     imp-------------------------------------------------
              *                                         *
         head *                                    body *
              *                                         *
            atom-------                                and----------------------
                 *    *                                     *                  *
             opr *    * arg                                 *                  *
                 *    *                                     *                  *
                 *   seq--------------------                *                  *
                 *       |       |         |                *                  *        
                 *       |       |         |              atom------         atom------
                 *       |       |         |                   *   *              *   *
                rel     var     var       ind              opr *   * arg          *   * arg
                 .       .       .          .                  *   *              *   *
                 .       .       .          .                  *  seq---      opr *  seq---
                 .       .       .          .                  *       |          *       |
                 .       .       .          .                  *       |          *       |
           discount   customer   product   5.0 percent        rel     var        rel     var
                                                               .       .          .       .
                                                               .       .          .       .
                                                               .       .          .       .
                                                           premium  customer    regular  product
    
    
    Example (considered option: role type, multiple body):
    
     imp------------------------------------------------------------------------
              *                                             *                  *
         head *                                       mbody *           mbody  *
              *                                             *                  *
            atom----------------------------                *                  *
                 *       |       |         |                *                  *
             opr *       |       |         |                *                  *
                 *       |       |         |                *                  *        
           discount     var     var       ind             atom----------     atom----------
                         .       .          .                  *       |          *       |
                         .       .          .              opr *       |      opr *       |
                         .       .          .                  *       |          *       |
                      customer   product   5.0 percent     premium    var       regular  var
                                                                       .                  .
                                                                       .                  .
                                                                       .                  .
                                                                     customer            product
    
    
    Example (preferred option: role type, branching body):
    
     imp---------------------------------------------------------------
              *                                                       *
         head *                                                 bodya *
              *                                                       * 
            atom----------------------------                          *
                 *       |       |         |                ********************
             opr *       |       |         |                *                  *
                 *       |       |         |                *                  *
           discount     var     var       ind             atom----------     atom----------
                         .       .          .                  *       |          *       |
                         .       .          .              opr *       |      opr *       |
                         .       .          .                  *       |          *       |
                      customer   product   5.0 percent     premium    var       regular  var
                                                                       .                  .
                                                                       .                  .
                                                                       .                  .
                                                                     customer            product
    
    
    Laws
    ~~~
    
    Commutativity for system roles (directed versions: left-to-right, lexicographic order)
    
    Specific:
    
     imp------------------                imp------------------
              *          *                         *          *
         head *     body *        =           body *     head *
              *          *                         *          *
            / x \      / y \                     / y \      / x \
    
    
    General:
    
     type-------------------------------------                 type-------------------------------------
                      *               *                                         *               * 
         . . .  rolek *  . . .  rolej *  . . .        =            . . .  rolej *  . . .  rolek *  . . .
                      *               *                                         *               *
                    / x \           / y \                                     / y \           / x \
    
    
    
    Sequence expansion/contraction (directed versions: left-to-right, sequence encapsulation):
    
    Specific (already for Datalog):
    
     atom--------------------------             atom-----------
          *       |               |                  *        *
      opr *       |     . . .     |       =      opr *    arg *
          *       |               |                  *        *
         rel    / a1 \          / aN \               *       seq--------------
          .                                          *           |           |
          .                                          *           |   . . .   |
          .                                          *           |           |
         pcd                                        rel        / a1 \      / aN \
                                                     .
                                                     .
                                                     .
                                                    pcd
    
    
    Specific (only for Hornlog):
    
     cterm-------------------------             cterm----------
          *       |               |                  *        *
      opc *       |     . . .     |       =      opc *    arg *
          *       |               |                  *        *
        ctor    / a1 \          / aN \               *       seq--------------
          .                                          *           |           |
          .                                          *           |   . . .   |
          .                                          *           |           |
         pcd                                       ctor        / a1 \      / aN \
                                                     .
                                                     .
                                                     .
                                                    pcd
    
    
    General (analogous)
    
    
    
    Role type (directed versions: right-to-left, explicit PCDATA types):
    
    Specific (already for Datalog):
    
     atom--------------------------             atom--------------------------
          *       |               |                  *       |               |
      opr *       |     . . .     |       =      opr *       |     . . .     |
          *       |               |                  *       |               |
         rel    / a1 \          / aN \              pcd    / a1 \          / aN \
          .
          .
          .
         pcd
    
    
    Specific (only for Hornlog):
    
     cterm-------------------------             cterm-------------------------
          *       |               |                  *       |               |
      opc *       |     . . .     |       =      opc *       |     . . .     |
          *       |               |                  *       |               |
        ctor    / a1 \          / aN \              pcd    / a1 \          / aN \
          .
          .
          .
         pcd
    
    
    General (schema for each type with a role rolet that is implicit in a role rolea):
    
    This is similar to an RDFS-like range restriction and corresponds to a
    description logic-like equivalence  Forall rolet.type  <=>  Forall rolea.any
    (untyped PCDATA are regarded as being typed with 'any').
    When no ambiguity arises, 'rolet' and 'rolea' can be the same, like 'opr' above
    
     type0----------------------           type0----------------------
                       *                                     *
         . . .   rolet *   . . .       =         . . . rolea *   . . .
                       *                                     *
                     type                                   pcd
                       .
                       .
                       .
                      pcd
    
    
    
    And contraction/expansion (directed versions: right-to-left, explicit and)
    
    Multiple body (considered option):
    
    General (the multiple-body role 'mbody' is non-functional, like, e.g., 'author' in Dublin Core):
    
     imp---------------------                           imp----------------------------------------
                    *                                                  *                  *
               body *                              =             mbody *            mbody *
        . . .       *   . . .                              . . .       *                  *   . . .
                   and----------------------                           *                  *
                        *                  *                           *                  *
                        *       . . .      *                           *       . . .      *
                        *                  *                           *                  *
                      / c1 \             / cM \                      / c1 \             / cM \
    
    
    
    Branching body (preferred option):
    
    General (the body-and role 'bodya' is syntactically functional, but has an implicit set value):
    
     imp---------------------                           imp----------------------------------------
                    *                                                           *
               body *                              =                      bodya *
        . . .       *   . . .                              . . .                *             . . .
                   and----------------------                           ********************
                        *                  *                           *                  *
                        *       . . .      *                           *       . . .      *
                        *                  *                           *                  *
                      / c1 \             / cM \                      / c1 \             / cM \
    
    
    
    
    
    Object-Oriented Syntax
    ======================
    
    Data Model
    ~~~~~~~~~
    
    Trees with two main categories and two subcategories of arcs:
    
    Positional:         |
    
    Roles (system):     *
    Roles (user):       #
    
    
    Example (PR):
    
    discount(cust->?customer;prod->?product;rebate->percent5.0) :-
       premium(cust->?customer), regular(prod->?product).
    
    
    Example (standard):
    
     imp----------------------------------------------------
              *                                            *
         head *                                       body *
              *                                            *
            atom-------------------------------           and-----------------------
                 *        #        #          #                *                   *
             opr *   cust #   prod #   rebate #                *                   *
                 *        #        #          #                *                   *        
                rel      var      var        ind             atom-----------     atom-----------
                 .        .        .           .                  *        #          *        #
                 .        .        .           .              opr *   cust #      opr *   prod #
                 .        .        .           .                  *        #          *        #
           discount    customer    product    5.0 percent        rel      var        rel      var
                                                                  .        .          .        .
                                                                  .        .          .        .
                                                                  .        .          .        .
                                                              premium   customer    regular   product
    
    
    Example (considered option: role type, multiple body):
    
     imp----------------------------------------------------------------------------
              *                                                *                   *
         head *                                          mbody *             mbody *
              *                                                *                   *
              *                                                *                   *
            atom-------------------------------                *                   *
                 *        #        #          #                *                   *
             opr *   cust #   prod #   rebate #                *                   *
                 *        #        #          #                *                   *        
           discount      var      var        ind             atom-----------     atom-----------
                          .        .           .                  *        #          *        #
                          .        .           .              opr *   cust #      opr *   prod #
                          .        .           .                  *        #          *        #
                       customer    product    5.0 percent     premium     var       regular   var
                                                                           .                   .
                                                                           .                   .
                                                                           .                   .
                                                                        customer              product
    
    
    Example (preferred option: role type, branching body):
    
     imp------------------------------------------------------------------
              *                                                          *
         head *                                                    bodya *
              *                                                          *
              *                                                          *
            atom-------------------------------                          *
                 *        #        #          #                *********************
             opr *   cust #   prod #   rebate #                *                   *
                 *        #        #          #                *                   *        
           discount      var      var        ind             atom-----------     atom-----------
                          .        .           .                  *        #          *        #
                          .        .           .              opr *   cust #      opr *   prod #
                          .        .           .                  *        #          *        #
                       customer    product    5.0 percent     premium     var       regular   var
                                                                           .                   .
                                                                           .                   .
                                                                           .                   .
                                                                        customer              product
    
    
    Laws
    ~~~
    
    Commutativity of roles: system-system (see above) as well as
                            user-user and system-user (analogous)
    
    The other laws are taken directly from the positional syntax.
    
    
    
    
    
    Typing Syntax
    =============
    
    An initial XML syntax for typing can be based on the 'Typing' section of the
    PR syntax (http://www.ruleml.org/submission/ruleml-shortation.html), using
    QNames that URI-reference RDFS or OWL classes. While typing is sketched for
    the positional syntax here, it can be specified in the same manner for the
    object-oriented syntax.
    
    
    Example (PR):
    
    c:='http://e-biz.org/taxonomy#Custclass'.
    p:='http://e-biz.org/taxonomy#Prodclass'.
    
    discount(c:?customer,p:?product,percent5.0)  :-       
       premium(c:?customer), regular(p:?product).
    
    
    Example (standard, with URI declarations):
    
    c:='http://e-biz.org/taxonomy#Custclass'.
    p:='http://e-biz.org/taxonomy#Prodclass'.
    
     imp-------------------------------------------------
              *                                         *
         head *                                    body *
              *                                         *
            atom----------------------------           and----------------------
                 *       |       |         |                *                  *
             opr *       |       |         |                *                  *
                 *       |       |         |                *                  *        
                rel     var     var       ind             atom----------     atom----------
                 .       .       .          .                  *       |          *       |
                 .       .       .          .              opr *       |      opr *       |
                 .       .       .          .                  *       |          *       |
          discount  c:customer  p:product  5.0 percent        rel     var        rel     var
                                                               .       .          .       .
                                                               .       .          .       .
                                                               .       .          .       .
                                                         premium  c:customer  regular  p:product
    
    
    Mike Dean's proposal on ubiquitous, general-purpose QNames in the PR syntax
    -- rather than RDFS- or OWL-typing QNames -- might lead to a rather different
    handling of types (http://www.daml.org/listarchive/joint-committee/1408.html).
    Besides the possibilities he mentions, a quite simple one would be the use of
    ":" for general-purpose QNames and the introduction of a new infix, say "$",
    for types. In the above example we would thus replace c:customer and p:product
    with the syntactic variants c$customer and p$product; the ":" for QNames would
    have precedence over the "$" for types. We could now also put the type after
    the variable, obtaining the syntactic variants customer$c and product$p; the
    "$" for types would have precedence over the "->" for roles (only used in the
    PR syntax).
    


    This archive was generated by hypermail 2.1.4 : 07/23/03 EST