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

Re: Prefix or term definition?

From: Gregg Kellogg <gregg@kellogg-assoc.com>
Date: Wed, 5 Oct 2011 13:04:46 -0400
To: Markus Lanthaler <markus.lanthaler@gmx.net>
CC: Linked JSON <public-linked-json@w3.org>
Message-ID: <6479D170-B2BB-4343-9483-EE5432090A96@kellogg-assoc.com>
On Oct 5, 2011, at 9:18 AM, Markus Lanthaler wrote:

I'm not sure if this is an issue, but currently there's no way to specify if
a mapping in the context is for a prefix or a term. So, what would be the
result of this (admittedly silly) example.

 "@context": { "payment": "http://example.com/payment/" },
 "payment:payment": "done",
 "payment:amount": 20.4

Assuming that I interpret the spec correctly I would expect the following:

<> http://example.com/payment/http://example.com/payment/ "done"
<> http://example.com/payment/amount "20.4"^^xsd:double

The wording in the spec is confusing and inaccurate:

A prefix is a compact way of expressing a base IRI<http://json-ld.org/spec/latest/#dfn-iri> to a Web Vocabulary<http://json-ld.org/spec/latest/#dfn-web_vocabulary>. Generally, these prefixes are used by concatenating theprefix and a term separated by a colon (:). The prefix is a short string that identifies a particular Web vocabulary. For example, the prefix foaf may be used as a short hand for the Friend-of-a-Friend Web Vocabulary, which is identified using the IRIhttp://xmlns.com/foaf/0.1/. A developer may append any of the FOAF Vocabulary terms to the end of the prefix to specify a short-hand version of the full IRI for the vocabulary term. For example, foaf:name would be expanded out to the IRIhttp://xmlns.com/foaf/0.1/name. Instead of having to remember and type out the entire IRI, the developer can instead use the prefix in their JSON-LD markup.

It should say "concatentating the prefix and suffix separated by a colon (:)." If a key matches a production containing NCNAME ':' followed by anything else, and the NCNAME portion (prefix) matches a defined term, the prefix ':' combination is replaced by the value of the term definition. In these examples, you should get the following:

<> <http://example.com/payment/payment> "done" .
<> <http://example.com/payment/amount> "20.4"^^xsd:double .

The only portion of the key subject to term replacement is the prefix, everything after the colon is used without performing any substitution.


Markus Lanthaler
Received on Wednesday, 5 October 2011 17:05:36 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:25:35 GMT