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

Re: Possible value types in JSON-LD?

From: Gregg Kellogg <gregg@greggkellogg.net>
Date: Tue, 17 Jul 2012 12:46:18 -0400
To: François Daoust <francois@joshfire.com>
CC: Linked JSON <public-linked-json@w3.org>, Markus Lanthaler <markus.lanthaler@gmx.net>
Message-ID: <80C47A73-384D-4BEB-9727-ECECB154C4ED@greggkellogg.net>
There used to be something in there about this [1], but it seems to have been lost at some point.

A value with an associated type, also known as a typed value, is indicated by associating a value with an IRI which indicates the value's type. Typed values may be expressed in JSON-LD in three ways:

	• By utilizing the @type keyword when defining a term within a @context section.
	• By utilizing the expanded form for specifying objects.
	• By using a native JSON type.

Looks like it was done in this commit by Markus [2]. Markus, do you recall why this was removed?


[1] http://json-ld.org/spec/ED/json-ld-syntax/20120522/#typed-values
[2] https://github.com/json-ld/json-ld.org/commit/9fc8cadfc6f05fbbf5d0c18216e688b5da53949e

On Jul 17, 2012, at 7:51 AM, François Daoust wrote:

> Hi,
> I was looking at the JSON-LD Syntax spec and realized that I could not
> easily answer the question: "can I directly use a number as value in
> JSON-LD?" looking at the spec. All the examples in the JSON-LD Syntax
> spec use string values, including those in the "Type coercion" section
> [1]:
> The only example I could find that uses a number as value is Example
> 25 in the "Data Round Tripping" section of the JSON-LD API spec [2]:
> {
> "@context": {
>  "number": {
>   "@id": "http://example.com/vocab#number",
>   "@type": "xsd:nonNegativeInteger"
>  }
> },
> "number" : 42
> }
> Could one of the examples in the syntax spec use values that are not
> strings (namely number and boolean) to clarify that developers do no
> need to convert such values into strings?
> Also, the spec borrows terms definitions from JSON, including number,
> null, and true and false, but I do not see a definition for "value"
> [3]. Do I miss something? Or is it already covered by one of the
> remaining open issues (e.g. JSON-LD grammar or alignment with RDF
> terms?)
> Thanks,
> Francois.
> [1] http://json-ld.org/spec/latest/json-ld-syntax/#type-coercion
> [2] http://json-ld.org/spec/latest/json-ld-api/#data-round-tripping
> [3] http://json-ld.org/spec/latest/json-ld-syntax/#how-to-read-this-document
Received on Tuesday, 17 July 2012 16:46:57 UTC

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