asn06 is an evolving language which RIF-WG is exploring using to describe the elements of a ruleset. It aims to be a subset of OWL, although it may have small formally-defined extensions, and also to be a sort of plain-text UML class diagram. It can also be seen as a data structure interface definition language, or an abstract syntax notation (which is where the name comes from).
The rest of this page is somewhat out-of-date. Some later information is in the thread starting http://lists.w3.org/Archives/Public/public-rif-wg/2007Jan/0121.html
The whole concept was re-articulated as asn07, but the differences are very small. On Jan 30 2007, the WG agreed "RESOLVED: we'll maintain the XML syntax(es) of RIF in the 2-step process, where step one will use asn06 (contingent on asn06 being defined as a subset of OWL Full or some other standard formalism) and step 2 is the precisely specified mapping from asn06 to XML (striped or stripe skipping or whatever). "
asn06 can be used in language design to separate the specification of the semantics from the specification of the concrete syntax. It can also be used to specify multiple semantically-equivalent concrete syntaxes.
Status: This is something SandroHawke hacked together during ISWC2006, chatting with various people, especially HaroldBoley and ChrisWelty, because it looks like the WG needs something like this, and none of the other options seem quite right.
Extending Grammars
One can extend an asn06 grammar by adding one or more class entries which "inherit" from a class in the grammar being extended. Such inheritance adds more options, more disjunctive branches in the grammar.
Example: Abstract Syntax for Purchase Order
Here is the asn06 version of the purchase order example from the XML Schema primer:
Class PurchaseOrder orderDate: string shipTo: PersonAtAddress billTo: PersonAtAddress comment: string items: list of item Class PersonAtAddress name: string street: string city: string state: string zip: string Class Item partNum: string productName: string quantity: int USPrice: decimal comment: string
Abstract Syntax of asn06
Here is the abstract syntax of asn06 written in the normal concrete syntax of asn06.
Class Class name: Identifier inherits: Class* property: Property* sub: Class* Class Property name: Identifier subclass SingleValuedProperty type: Identifier subclass ListValuedProperty elementType: Identifier subclass MultiValuedProperty type: Identifier minCardinality: int maxCardinality: int
EBNF for asn06
The concrete syntax for asn06 is inspired by:
- regular expressions and ABNF(for cardinality)
- Algol/Pascal/Modula type declarations
- Python for using indenting to indicate subordinate blocks. (These
- are handled by the lexer, which provides INDENT and DEDENT acting like "{" and "}" in C-like languages.)
- N3 for URIs and Namespaces
Grammar ::= NamespaceDeclaration* Class* NamespaceDeclaration ::= "prefix" WORD URI Identifier ::= WORD | QNAME | URI Class ::= "Class"? Identifier ("," "inherits" Identifier)* (INDENT Element* DEDENT)? Element ::= Identifier ":" Type | "subclass"? Class Type ::= "list" "of" Identifier | Identifier Cardinality Cardinality ::= int? "*" int? # min and max, defaulting to 0 and inf. | "+" # min=1, no max | "required" # min=1, max=1 | "optional" # min=0, max=1 | # nothing? default maybe needs to be setable
Issues
Terminology: ("rule", "production", "class", ....?) and ("field", "argument", "property", ...?)
How IDs work
default is Optional or Required???