- From: Jonathan Borden <jonathan@openhealth.org>
- Date: Thu, 7 Mar 2002 15:53:17 -0500
- To: <www-rdf-comments@w3.org>
In my endevours to develop a good XML representation for KIF and N3, I have been playing around with extending the RDF syntax. This has highlighted a few points regarding the RDF syntax. 1) Consider representing bNodes (in NT) as NCNames i.e. no-colon names. RDF otherwise disallows non namespace qualified elements and attributes. The RDF syntax might use non namespace qualified elements and attributes to represent bNodes. 2) Consider eliminating rdf:_n entirely from the _XML syntax_, that is a parser can convert rdf:li to rdf:_2 or whatever. It is not possible to create a proper formal grammar for RDF using commonly available tools and languages if rdf:_n is allowed i.e. it is not possible to constrain "n" to be an integer using any well known XML schema language. It is not readily apparent from reading the Syntax WD how the syntax of containers is intended to map onto NTriples. Although this can be deduced from the test cases, it would be helpful to describe this in prose, as it is a change from RDF 1. 3) prohibit use of unknown names in the RDF namespace. 4) A simple and easy to include addition to the syntax is to allow nested rdf:RDF elements i.e. as the object of a statement. The contents of a nested rdf:RDF might be interpreted as a collection of reified statements or as an "N3 context" whose set of statements might be interpreted by the MT as "unasserted". In any case it is a simple addition to the syntax. Included is a compacted RDF syntax expressed as a non-XML RELAXNG grammar. This grammar is also available at: http://www.openhealth.org/RDF/RDFs.rngnx You see that it is quite compact. [[ # RELAXNG non-XML grammar for RDFs - simplified RDF grammar # Jonathan Borden 3/7/2002 namespace local = "" namespace rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes" start = RDF # rdf:RDF ? allow rdf:ID RDF = element rdf:RDF{rdf:ID?,desc*} # perhaps unqualified names refer to bNodes # var = element local:*{empty} | attribute local:*{""} # an rdf:Description or typedNode desc = subject{predobj*} subject = element (* - (local:*,rdf:*)) | rdf:Description | rdf:Alt|rdf:Seq|rdf:Bag { (attribute rdf:about{anyURI}| attribute rdf:ID{xsd:NMTOKEN})?, attribute rdf: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} # this is extended to allow rdf:RDF (i.e. context/bundle) as the object of a statement obj = subject | text | RDF any = mixed { element * { attribute * { text }*, any }* } ]] Jonathan
Received on Thursday, 7 March 2002 15:55:56 UTC