# RELAXNG non-XML grammar for RDFxt # Jonathan Borden 3/7/2002 namespace local = "" namespace rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" namespace rdfx = "http://www.openhealth.org/RDF/RDFxtSyntax" namespace c = "http://www.xml.gr.jp/xmlns/relaxngcc" datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes" start = (RDF | RDFxt) # handle rdf:RDF as RDF RDF = element rdf:RDF{rdf:ID?,rdf1_bundle} # extend other namespace qualified root elements with bundles RDFxt = element * - (local:*,rdf:*){bundle} # an RDF 1 bundle is a bag of statements rdf1_bundle = desc* # a bundle can be either sentences or rdf:Descriptions bundle = (sentence|desc)* # a sentence may have variables and # is considered like a function that accepts a bundle of arguments # variables are not namespace qualified sentence = element * - (local:*){var*,bundle} var = element local:*{empty} | attribute local:*{""} # an rdf:Description or typedNode desc[c:class="desc"] = subject{predobj*} subject[c:class="subject"] = element (* - (local:*,rdf:*)) | rdf:Description | rdf:Alt|rdf:Seq|rdf:Bag { (attribute rdf:about{ anyURI [c:alias="subj"] >> this.value = subj; }| attribute rdf:ID{xsd:NMTOKEN})?, attribute bagID(xsd:NMTOKEN)?, attribute rdf:type{anyURI}? } predicate = (element * - (rdf:*,local:*)) | element rdf:li | element rdf:value predobj = predicate{ attribute rdf:ID{xsd:NMTOKEN}?, attribute rdf:bagID{xsd:NMTOKEN}?, obj | attribute rdf:resource{anyURI} | (attribute rdf:parseType{"Resource"},obj+) | (attribute rdf:parseType{text - "Resource"}, any) } | predAttr predAttr = attribute * - (local:*,rdf:*) | attribute rdf:value {text} obj = subject | text | RDF any = mixed { element * { attribute * { text }*, any }* }