RE: asn06 take 2 (Abstract Syntax as a kind of ontology?)

Hi Sandro,

As a programmer, I am interested in a language such as asn06 to define
abstract grammars in general.

Recently, our team worked on the abstract syntax of a new script
language related to the execution of rules. Having begun with OCAML and
a first BNF, we were blocked to express easily the extensibility of
nodes such as expression and statement. We finally found convenient to
use Java interface to develop and check the typing of the abstract
grammar. The standard inheritance seems to be useful to represent
abstract node and their potential extensibilities. Furthermore, it may
be possible to generate later the implementation classes of the semantic
tree from this set of interfaces.

I feel that our approach is very similar to what you experiment with
asn06. I like the idea that the XSD of the concrete syntax could be
generated from the abstract grammar definition in asn06. 
Moreover, I wonder if, in complement to the standard inheritance you use
for asn06, the restriction inheritance could not help to define
sub-languages of a root language by adding constraints (cardinality,
sub-type) on properties (see annex here after).

Nevertheless, Admitting that I know very little about language theory, I
am not skilled to demonstrate that this approach is well-founded or not.
Anyway, both approaches (BNF, asn06 ) might be promising for RIF.

Regards. Philippe.


Annex: Defining a simpler rule language by restriction.

Assuming that the "token" type restricts the "string" type, the
SimpleRule type is defined as a sub-class of ComplexRule by restricting
it.


Class ComplexRule 
  name: string
  priority: int+
  conditions: Condition*
  actions: Action*

Class SimpleRule restricts ComplexRule
  name: token
  priority: (int)0*0
  conditions: Condition+
  actions: Action+



-----Original Message-----
From: public-rif-wg-request@w3.org [mailto:public-rif-wg-request@w3.org]
On Behalf Of Sandro Hawke
Sent: Tuesday, November 21, 2006 7:46 AM
To: public-rif-wg@w3.org
Subject: asn06 take 2 (Abstract Syntax as a kind of ontology?)



Thinking more about the abstract syntax question, I find myself
wondering how an abstract syntax is really different from an ontology.
Is there any practical difference between an ontology of Horn rules and
an abstract syntax for Horn rules?  My sense is that an abstract syntax
is a kind of ontology which is not very thoroughly axiomatized,
providing pretty much just subclass, domain, range, and cardinality
information.

If this is true, then OWL is a probably a good way to write down our
abstract syntax for RIF.

To recap the earlier discussion, the motivations I saw for using asn06
instead of BNF were:

  1. BNF imposes an order on the symbols in each production.

     You can work around this with disjunction (alternates):

         a ::= b c | c b

     but this gets very clumsy, obscuring the real design and purpose
     of the grammar.   Of course BNF can be extended to include some
     kind of "order doesn't matter" operator like

         a ::= b & c

     but then we are moving away from normal BNF. 

     We may have to decide whether heads are transmitted before or
     after bodies, but the idea of an abstract syntax is to keep such
     decisions localized to a part of the specification which deals
     with concrete syntax issues.

  2. Normal BNF includes terminals like parentheses, keywords, and
     infix operators, since it is used to describe real languages --
     languages which one needs to be able to parse unambiguously.  

     These parts are irrelevant for an XML serialization, and for any
     non-xml concrete syntax they should be decisions localized to the
     specification of that particular concrete syntax.

     If we just use BNF "loosely" so it doesn't actually describe a
     real parsable language, we're likely to confuse people who are
     familiar with BNF, since we're misusing it.

  3. BNF obscures the differences between classes and properties.
     When is the name of a non-terminal the name of a class, and when
     is it the name of a role?

     An example [1]

          Rule ::=  Head :- Body
          Head ::=  expr
          Body ::=  expr

     shows "Rule" and "expr" being class names, but "Head" and "Body"
     being role names.  Again, BNF can be used this way, but it's
     cumbersome to introduce extra productions and it's imprecise
     because its not always clear the extra productions are given to
     provide role names.  It is possible to use uppercase names for
     classes and lowercase names for role (properties); it's also
     possible to "stripe" everything -- to always give role names --
     but it's still verbose.

  4. Extending the language described by a BNF grammar requires
     inserting a disjunction (alternate) into a production.  In the
     asn06 model, it requires adding a new production (subclass).
     Arguably it's simple to think of an extension as just adding
     things (in any order), rather than as changing something.

     To say that differently, when you're have a spot in the syntax
     where a "Foo" can go, do you want to say "a Foo can be a RedFoo,
     a BlueFoo, or a GreenFoo", or do you want to say "a RedFoo is a
     Foo, a BlueFoo is a Foo, and a GreenFoo is a Foo."  The latter
     form seems preferable when you're expecting new subclasses of Foo
     to come along -- it doesn't suggest we're done listing the
     subclasses.

Thinking over all this, I'm left with the conclusion that we can
just use OWL as the meta-language -- we can use OWL to declare what
parts a Horn rule has, etc.

To play with this idea, I've been playing with transcribing Harold's
EBNF into OWL [2] and then programmatically turning it into asn06 and
(for folks who still want to use it despite the above reservationse)
EBNF.  In other words, one can see asn06 as a concrete syntax for a
sublanguage of OWL.  (That makes it a much less important tool and one
that can easily use along side others.)

        - Sandro

[1] http://lists.w3.org/Archives/Public/public-rif-wg/2006Nov/0074
[2] http://www.w3.org/2006/11/rif-core#      (not done yet)

Received on Tuesday, 21 November 2006 14:31:43 UTC