RE: General JSON-LD question about external context files

Hi Dimitri,

On 4 Nov 2015 at 09:25, Dimitri van Hees wrote:
> 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?

Yes, that's correct. The value of @id needs to be a string. Step 7.4.3 in
the expansion algorithm [1] defines this.


> 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?

Also correct... unless you "cheat" and make "results" a property with a
rdf:range of Event and let a reasoner do the rest.


[1] http://www.w3.org/TR/json-ld-api/#algorithm-3


--
Markus Lanthaler
@markuslanthaler

Received on Thursday, 5 November 2015 22:01:13 UTC