Do xsd:dateTime TypedLiterals in the spec need to be escaped?

22 views
Skip to first unread message

Bradley Allen

unread,
Nov 13, 2010, 1:29:50 PM11/13/10
to jso...@googlegroups.com
In Section 5.10 of the JSON-LD spec, we read:

"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

Manu Sporny

unread,
Nov 17, 2010, 11:07:08 AM11/17/10
to jso...@googlegroups.com
On 11/13/10 13:29, Bradley Allen wrote:
> In Section 5.10 of the JSON-LD spec, we read: "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...

>
> 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

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/

Bradley Allen

unread,
Nov 20, 2010, 5:28:24 PM11/20/10
to jso...@googlegroups.com
Manu- So, given what you've said here, the requirement to wrap IRIs
and CURIEs removes the need to escape, per Section 5.10.

Any expectation as to when you might have another revision of the
specification that reflects the new rules?

Bradley P. Allen
http://bradleypallen.org

Manu Sporny

unread,
Nov 24, 2010, 10:30:38 AM11/24/10
to jso...@googlegroups.com
On 11/20/2010 05:28 PM, Bradley Allen wrote:
> Manu- So, given what you've said here, the requirement to wrap IRIs
> and CURIEs removes the need to escape, per Section 5.10.
>
> Any expectation as to when you might have another revision of the
> specification that reflects the new rules?

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/

Reply all
Reply to author
Forward
0 new messages