- From: David Menendez <zednenem@psualum.com>
- Date: Sun, 15 Jun 2003 23:36:54 -0400
- To: "Sean B. Palmer" <sean@mysterylights.com>, <www-rdf-interest@w3.org>
At 7:08 PM +0100 2003-06-14, Sean B. Palmer wrote:
[...]
>So this is a proposal to enrich N-Triples using XML.
[...]
>Example:-
>
><Graph xmlns="@@" xmlns:ex="http://example.org/stuff/1.0/" >
><t>'http://www.w3.org/TR/rdf-syntax-grammar ex:editor $Dave</t>
><t>$Dave ex:fullName <s>Dave Beckett</s></t>
><t>$Dave ex:homePage 'http://purl.org/net/dajobe/</t>
></Graph>
Very interesting idea. I've drunk enough RDF Kool-Aid that RDF/XML
now seems natural to me, but I can see the value of trying something
new. I played around with XENT a bit to see if I could make it feel
more "XML-like", and I eventually came up with an idea which I will
facetiously call XEN3.
The previous example becomes something like:
<graph xmlns="http://example.org/xen3"
xmlns:ex="http://example.org/stuff/1.0"
>
<r uri="http://www.w3.org/TR/rdf-syntax-grammar"
<ex:editor>
<r id="Dave"/>
</ex:editor>
</r>
<r id="Dave">
<ex:fullName>
<l>Dave Beckett</l>
</ex:fullName>
<ex:homePage>
<r uri="http://purl.org/net/dajobe/"/>
</ex:homePage>
</r>
</graph>
It turns out that it can be defined by a fairly short Relax NG schema:
default namespace xen3 = "http://example.org/xen3"
start = element graph { resource* }
# each resource being described is represented by an "r" element,
# which may have an "id" or "uri" attribute. IDs are local to the
# graph, while URIs are (naturally) global
resource = element r {
( attribute uri { xsd:anyURI } | attribute id { xsd:NSNAME } )?,
property*
}*
# each resource contains zero or more property elements, which will
# either be a "p" element with a "uri" attribute giving the URI of
# property, or an element from an external namespace, which represents
# the property's URI through the usual RDF qname -> URI process
property = element * - xen3:* { value* }
| element p { attribute uri { xsd:anyURI }, value* }
# each property contains zero or more values, which can be:
# 1. an "r" element with optional "uri" or "id" attribute
# 2. an empty element from an external namespace (useful when
# giving class names)
# 3. an "l" element containing arbitrary XML (string and XML
# literals; because there is no need for rdf:parseType="Literal",
# the need to distinguish the two is unclear)
# 4. a "list" element containing zero or more values (equivalent
# to rdf:parseType="Literal", but easier to explain)
value = element r { ( attribute uri { xsd:anyURI } | attribute id {
xsd:NSNAME } )? }
| element * - xen3:* { empty }
| element l { attribute xml:lang { xsd:language }?, literal }
| element list { value* }
literal = (text | element * { attribute * { }*, literal })*
This bit demonstrates two tricks that N-Triples and XEN3 can do that
RDF/XML can't: (1) properties that cannot be expressed by qnames and
(2) an rdf:List construct whose elements are literals.
<graph>
<r>
<p uri="http://example.org/weird-property/">
<list>
<l>One</l>
<l>Two</l>
<l>Three</l>
</list>
</p>
</r>
</graph>
--
Dave Menendez - zednenem@psualum.com - http://www.eyrie.org/~zednenem/
Received on Sunday, 15 June 2003 23:35:52 UTC