W3C home > Mailing lists > Public > public-linked-json@w3.org > September 2012

Prefixes and the use of ':'

From: Paolo Ciccarese <paolo.ciccarese@gmail.com>
Date: Fri, 21 Sep 2012 10:11:45 -0400
Message-ID: <CAFPX2kAjZx_yr_U=8-PDAuv-hzLaaUL6X-_e_2TXOR9TCS6YoA@mail.gmail.com>
To: public-linked-json@w3.org
Hello,
I am trying to use JSON-LD for exchanging some content and I need to be
able to express namespaces.
I was looking at example 33 in the spec:
http://json-ld.org/spec/FCGS/json-ld-syntax/20120626/

If I use something like this
{"foaf:age":"33"}

I cannot access the value of that key - for instance in Grails/Groovy or
JavaScript - with something like:
myobject.foaf:age

In Grails/Groovy I have to change it into something like
((JSONObject) myobject).get("foaf:age");

I was therefore wondering if you have any recommendations/preferred
approach for dealing with prefixes.
I thought of just substituting the ':' with the '_' and then map all the
properties singularly in the context but it looks verbose and not elegant.

Thank you,
Paolo
Received on Friday, 21 September 2012 14:13:21 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:34 UTC