The RDF 1.0 formal grammar is defined according to the pattern language of XDuce and the XML Schema Formalism.
The grammar presented here is namespace aware, in that QName symbols represent the expanded element or attribute name, and the namespace pattern represents the namespace URI of the current type. For example the pattern ~[namespace] matches any element which has a non null namespace URI, and ~[namespace["http://example.org#"]] matches any element in the "http://example.org#" namespace.
type description = rdf:Description[ idAboutAttr?, bagIdAttr?, propAttr?, propertyElt* ] | typedNode
type propertyElt = ~[namespace,idAttr?,value] | ~[namespace,idAttr?,parseLiteral,literal] | ~[namespace,idAttr?,parseResource,propertyElt*] | ~[namespace,idRefAttr?,bagIdAttr?,propAttr*]
type sequence = rdf:Seq[ idAttr?, memberAttr*, member* ]
type inlineItem = rdf:li[@xml:lang?, (value | (parseLiteral,literal) | (parseResource,propertyElt*)) ]
Jonathan Borden, Tufts University, The Open Healthcare Group June 20, 2001