Re: URI-Triples: RDF serialization for use in query strings

Argh.

When working on the URI-Triples syntax, I was working from my
knowledge of RFC 2396 (URI Generic Syntax). Which has been obsoleted
in January by RFC 3986. Which makes URI-Triples in the proposed form
completely illegal, plus broken. :-(

RFC 2396 says that '_' (being in the set of unreserved characters) can
be escaped or unescaped at any time without changing the meaning of a
URI. I was using it as a delimiter, and escaping it in URI references.
Additionally, ^ and | became illegal in URIs. (Yes, I know they were
already marked as unwise, before...)

Well, I have to think about this. And re-do the code. :-/ Lucky I
haven't deployed this yet :-)

My gut feeling is to become more like the N3 family and introduce ()
around URIs (similar to <> in N-Triples/Turtle/N3), and drop the ';'
seperator inside triples, i.e. turning _;_ into just _. I'm tending to
: as the replacement for ^^. I'm not sure how to replace | -- perhaps
&, which serves a slightly similar role in the query strings generated
by HTML forms (i.e., in "application/x-www-form-urlencoded").

With this changes, my example reads

dc_=_(http://purl.org/dc/elements/1.1/)_&_rdf_=_(http://www.w3.org/1999/02/22-rdf-syntax-ns%23)_&_.foo_rdf.type_(http://example.org/types/Document)_&_.foo_dc.title_'War%20and%20Peace'@en_&_.foo_dc.title_'Krieg%20und%20Frieden'@de

The grammar reads

query_string := (stmt "_|_")* stmt
stmt         := prefix | triple
prefix       := name "_=_(" uri ")"
triple       := (node | bnode) "_" node "_" (node | bnode | literal)
node         := qname | "(" uri ")"
qname        := name "." name
bnode        := "." name
literal      := "'" text "'" ("" | "@" langtag | ":" node)

I suppose it's not too bad, although I do find it slightly less
readable. I will have to change the code.

- Benja

Received on Sunday, 13 March 2005 02:57:27 UTC