Re: Handling integers

Hi Benjamin,

thanks for your explanation. I appreciate any response even though it's
late, no problem :)

The big benefit I see in JSON-LD, is that it really simplifies the usage
of RDF in JavaScript applications, as in many cases an RDF graph can be
compacted to a plain and simple JSON object. Of course there are always
graphs that get more complicated, like when it contains multiple
languages or non primitive types. But in my experience many, many
practical cases can be serialized to a simple-to-use JSON object.

This is why I find it very annoying to get

"age": {
    "@value": "27",
    "@type": "http://www.w3.org/2001/XMLSchema#integer"
  }

when one could also use a simple

"age": 27

This is just making things more complicated without necessity.

This way, JSON-LD is just yet-another-RFD-serialization and looses it's
benefits in my opinion.

Although I understand your conclusion, this is my input/feedback from a
practicability point-of-view.

Kind regards,
Angelo

On 04.10.19 17:41, Benjamin Young wrote:
> Hey Angelo,
>
> Sorry I missed this email back in...May. ;-P
>
> I wondered very similar things, and we discussed them a bit in the
> JSON-LD WG recently:
> https://github.com/w3c/json-ld-bp/issues/14
>
> The ultimate conclusion is that JSON-LD does one thing: encodes a
> graph in JSON by mapping local names to global names (and wrangling
> various JSON shapes into graphy ones).
>
> So, essentially type casting of this sort, isn't JSON-LD's job...but a
> tool that uses the expanded form (for instance) might be able to
> clean-up data on ingest or generation.
>
> Here's how I summarized it in the issue:
> https://github.com/w3c/json-ld-bp/issues/14#issuecomment-532125931
>
> Ultimately we plan to explain that in the forthcoming Best Practices
> guide. As someone else who's shared this confusion, your input here
> would be most welcome. :)
>
> Cheers,
> Benjamin
> Co-Chair, W3C JSON-LD
>
> --
>
> http://bigbluehat.com/
>
> http://linkedin.com/in/benjaminyoung
>
> ------------------------------------------------------------------------
> *From:* Angelo Veltens <angelo.veltens@online.de>
> *Sent:* Friday, May 31, 2019 4:46 AM
> *To:* JSON-LD CG <public-linked-json@w3.org>
> *Subject:* Handling integers
>  
> Hi everybody,
>
> Question regarding Integers in JSON-LD.
>
> Given the following snippet:
>
> {
>   "@context": {
>     "@vocab": "http://vocab.example/"
>   },
>   "age": {
>     "@value": "27",
>     "@type": "http://www.w3.org/2001/XMLSchema#integer"
>   }
> }
>
> Is there a JSON-LD algorithm / context to transform it to a real JSON
> integer?
>
> {
>   "@context": {
>     "@vocab": "http://vocab.example/"
>   },
>   "age": 27
> }
>
> They are semantically the same, but the upper construct is much more
> complicated to handle in JavaScript application and does not give any
> additional value. I would have expected at least the compact algorithm
> to output the latter construct.
>
> All the best,
> Angelo
>

Received on Friday, 15 November 2019 16:02:30 UTC