- From: Stian Soiland-Reyes <soiland-reyes@cs.manchester.ac.uk>
- Date: Thu, 15 Jan 2015 21:48:00 +0000
- To: Jindřich Mynarz <mynarzjindrich@gmail.com>
- Cc: Linked JSON <public-linked-json@w3.org>
No, I don't believe there is an specified mechanism for that currently. Probably there should be. Given your context, the http://json-ld.org/playground/ seems to keep any incoming JSON numbers 42 as the number 42 (even if it is as { "@type": "xsd:integer", "@value": 42} ), and any incoming strings "42" as "42". I would argue that in this case it should at least consistently end up with always the string or always the integer version. Could it be the job of a JSON-LD Frame to specify this? Currently it can't say much about the values, e.g. if it should be expanded with @value or not. On 15 January 2015 at 16:55, Jindřich Mynarz <mynarzjindrich@gmail.com> wrote: > Hi, > > is it possible to use JSON-LD API to coerce number-like strings into native > JSON numbers (http://www.w3.org/TR/json-ld/#dfn-number)? The section of the > specification on type coercion (http://www.w3.org/TR/json-ld/#type-coercion) > seems to suggest that this is possible, but so far I haven't realized how. > > For example, is it possible to coerce the values of the "age" attribute to > numbers in the following JSON-LD? > > { > "@context": { > "@vocab": "http://xmlns.com/foaf/0.1/", > "xsd": "http://www.w3.org/2001/XMLSchema#", > "age": { "@type": "xsd:integer" } > }, > "age": "42" > } > > Setting a numeric datatype (such as xsd:integer) for the property via @type > in @context doesn't do the job. > > Is there a way to go about this? > > Best, > > Jindřich > > -- > http://mynarz.net/#jindrich -- Stian Soiland-Reyes, myGrid team School of Computer Science The University of Manchester http://soiland-reyes.com/stian/work/ http://orcid.org/0000-0001-9842-9718
Received on Thursday, 15 January 2015 21:48:50 UTC