W3C home > Mailing lists > Public > public-linked-json@w3.org > May 2011

Re: Modified curies for JSON (Re: JSON-LD normalization algorithm and MongoDB)

From: Manu Sporny <msporny@digitalbazaar.com>
Date: Tue, 10 May 2011 14:48:05 -0400
Message-ID: <4DC98865.9010502@digitalbazaar.com>
To: public-linked-json@w3.org
On 05/09/11 04:47, William Waites wrote:
> ] simply storing JSON-LD with all keys being ] CURIEs will avoid this
> issue, but it is worth noting that restriction.
> One thing that I've seen done, which seems useful from the point of
> view of a Javascript programmer, is rather than express a CURIE as
> prefix:local to write it as prefix$local. The reason for this being
> that in Javascript, $ is a valid character as part of a name whereas
> : is not, enabling one to write,
> person.foaf$name
> instead of
> person["foaf:name"]

You make a good point.

This has come up before in the RDFa Working Group and the RDF Web Apps
Working Group when working on the RDF Interfaces, RDF API and RDFa API.

The issue that we ran up against was that "$" makes sense to JavaScript
developers, but doesn't make much sense to other developers. That is,
"$" is a JavaScript-ism and may be confused with how one accesses
jQuery. I'm assuming that it is also a character that is unfamiliar to
the majority of the Semantic Web community, Python programmers, Ruby
developers, etc. "$" is also a reserved character in MongoDB. :P

The one strong argument in favor of "$" is that it isn't a reserved
character in JavaScript.

> is this small convenience enough to matter? I'm not sure. But I 
> thought I'd mention it.

We don't know if the convenience is enough to outweigh the downsides,
either :).

We tried to address this issue in the RDF API by providing an interface
called a "Projection" that would allow the developer to name the
properties in the object to whatever they want using a template:


You can use a template to build a projection and use it like so (look
toward the very bottom):


This would allow you to access the variable in two ways:

1. obj["foaf:name"], or
2. obj.name

The down-side to this approach is that it requires an API to use


-- manu

Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: PaySwarm Developer Tools and Demo Released
Received on Tuesday, 10 May 2011 18:48:51 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:53:17 UTC