"Special characters in property values must be escaped in order to not
be interpreted as CURIEs, IRIs, language tags, or TypedLiterals.
The special characters in JSON-LD are: <, >, @, #, : and ^."
However, Sections 5.6 and 5.8 contain examples such as:
{
...
"@": "<http://example.org/articles/8>",
"dcterms:modified": ["2010-05-29T14:17:39+02:00^^xsd:dateTime",
"2010-05-30T09:21:28-04:00^^xsd:dateTime"],
...
}
... where xsd:dateTime TypedLiterals occurring as property values have
occurrences of ':' that are *not* escaped.
If I'm not mistaken, to be consistent with 5.10, this example should instead be:
{
...
"@": "<http://example.org/articles/8>",
"dcterms:modified":
["2010-05-29T14\\:17\\:39+02\\:00^^xsd:dateTime",
"2010-05-30T09\\:21\\:28-04\\:00^^xsd:dateTime"],
...
}
Having ':' as a character that needs to be escaped does make
xsd:dateTime TypedLiterals a little ugly, but I defer to the authors
of the spec in this regard. - FWIW, BPA
Bradley P. Allen
http://bradleypallen.org
Per the old rules, that is correct. However, with the new type coercion
stuff, and the requirement to wrap both IRIs and CURIEs in '<', and '>'
when expressed for objects, you don't need to escape ':' anymore, AFAICT.
So, the example below is valid JSON-LD - Note that the objects in '@',
and 'a' are not wrapped because their type is coerced to an IRI by
default. The 'foaf:knows' predicate isn't wrapped either because all
predicates are type coerced to IRIs. Also note that the object of
'foaf:knows' MUST be wrapped in '<' and '>' per the decision we made
last week:
{
"#":
{
"ex": "http://example.org/",
"foaf": "http://xmlns.org/foaf/0.1/"
},
"@": "ex:people#bob",
"a": "foaf:Person",
"foaf:knows": "<ex:people#alice>"
}
The example below expresses the same triples as the example above, but
all IRIs are wrapped in '<' and '>'.
{
"#":
{
"ex": "http://example.org/",
"foaf": "http://xmlns.org/foaf/0.1/"
}
"@": "<ex:people#bob>",
"a": "<foaf:Person>",
"<foaf:knows>": "<ex:people#alice>",
}
So, the top example is JSON-LD 'shorthand form', and the example below
is the 'normalized form'. Most people will probably just use the
shorthand notation, but we also need to have a good rationale of how you
get from the 'normalized form' to the 'shorthand form' and back again.
This bit will probably have to be explained in the JSON-LD spec in more
detail.
We hit the 'normalized form' requirement last week when we started
digitally signing the JSON-LD data. We needed to be able to convert to a
normalized form so that digital signatures in one system would match up
with digital signatures in another system.
Did I miss anything?
-- manu
--
Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: The Rising Swell of Web Application Data
http://digitalbazaar.com/2010/10/30/json-ld/
Any expectation as to when you might have another revision of the
specification that reflects the new rules?
Bradley P. Allen
http://bradleypallen.org
I'll try to get a new version edited and published by the end of this
weekend.
-- manu
--
Manu Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: Linked Data in JSON
http://digitalbazaar.com/2010/10/30/json-ld/