Re: General JSON-LD question about external context files

On 4 November 2015 at 09:25, Dimitri van Hees <info@dimitrivanhees.com>
wrote:

> Hi all,
>
> I've been digging into all the JSON-LD specs to make sure that I
> understand all the possibilities of using an external context file. I have
> two questions about this. Please not that I am not trying to start a
> discussion, I just want to make sure if I understood it correct and can
> start looking for another solution :-)
>
> Image I have the following plain JSON. I have no influence on this, only
> on the external JSON-LD context file.
>
> {
>     "results": [
>         {
>             "id": 1,
>             "title": "Event 1"
>         },
>         {
>             "id": 2,
>             "title": "Event 2"
>         }
>     ]
> }
>
> Question 1) "id": "@id" won't work, because "id" is an integer instead of
> a string. Event when using "@base" : "http://my.example.com/events/" this
> doesn't work. Is it correct that there currently isn't a way to 'map' these
> things using an external context file?
>

@id must be a URI.  Not sure it can be a number literal.  Mapping an number
to an id would be to add a scheme e.g. urn:uuid: before it.  Unsure this
can be done in @context, dont think so.  Maybe the JSON LD folk can confirm.


>
> Question 2) I want the items in the "results" array to be of the type "
> http://my.example.com/Event". Is it correct that I cannot achieve this
> without inserting "@type" :  "http://my.example.com/Event" within each
> item in the plain JSON, thus cannot achieve this using an external context
> file?
>

If title was mapped to something with "range" = http://my.example.com/Event
then software could infer it by dereferencing "title" at it's full URI.
Ordinarily Im unsure type can be inserted from the @context.  Id be happy
to be corrected there!


>
> Any confirmation would be appreciated. Thanks in advance!
>
> Dimitri
>

Received on Wednesday, 4 November 2015 09:04:44 UTC