relax-ng compact syntax

I converted the XML Schema in BLD section 5.3 [1] to Relax-NG Compact
Syntax [2] using some tools [3] and a little hand-fixup, and the result
is pretty readable.  I tried it on the text of Example 6, and after
adding a <Document xmlns="http://www.w3.org/2007/rif#"> wrapper it
checked.

In terms of talking about how dialects overlap and how an extensions
change a grammar, this representation might be useful.

      -- Sandro

################################################################

default namespace = "http://www.w3.org/2007/rif#"

start = element Document { Ruleset* }
Ruleset = element Ruleset {
             element rule { RULE }*
          }
RULE = Forall | Implies | ATOMIC
Const = element Const {
          mixed {
             attribute type { xsd:string }
          }
        }
declare = element declare { Var }
Forall = element Forall {
          declare+,
	  #element ruleFormula { RULE }    # changed from formula, for DTD
          element formula { RULE }     
         }
formula = element formula { CONDITION }
if = element if { CONDITION }
Uniterm = element Uniterm { op, arg* }
Or = element Or { formula* }
arg = element arg { TERM }
Equal = element Equal { side, side }
op = element op { Const }
Implies = element Implies { if, then }
And = element And { formula* }
TERM = Const | Var | Uniterm
CONDITION = And | Or | Exists | ATOMIC
then = element then { ATOMIC }
ATOMIC = Uniterm | Equal
side = element side { TERM }
Exists = element Exists { declare+, formula }
Var = element Var { xsd:string }

################################################################


[1] http://www.w3.org/TR/2007/WD-rif-bld-20071030/#head-8f62509fe64ac2abe1b875a9c9d7a04fc15145c8
[2] http://relaxng.org/compact-tutorial-20030326.html
[3] http://www.postneo.com/2007/01/16/all-i-want-to-do-is-convert-my-schema

Received on Monday, 5 November 2007 04:31:17 UTC