Re: Ignore JSON nesting

On Mar 11, 2014, at 6:15 AM, Bert Spaan <bert@waag.org> wrote:

> (I’m sorry if this message will appear on the mailing list twice, but it seems my attempt from this morning did not come through…)
> 
> Hi,
> 
> I'm working on an open data API which currently can serialize its output to GeoJSON or RDF/Turtle. I'm working on JSON-LD serialization, and ideally I would like to have a @context which I can add to the existing GeoJSON output (together with some @ids and @types), so that both the Turtle output and the JSON-LD output will normalize to the same triples.
> 
> Data is organized as follows: each object/feature has an ID and a name, and data on one or more layers. Per layer, there is a data field, which contains a JSON object. Example GeoJSON output:
> 
> {
>   "type": "FeatureCollection",   
>   "features": [
>     {
>       "type": "Feature",
>       "properties": {
>         "id": "admr.nl.appingedam",
>         "name": "Appingedam",
>         "layers": {
>           "cbs": {
>             "data": {
>               "name": "Appingedam",
>               "population": 1092
>             }
>           },
>           "admr": {
>               "data": {
>               "name": "Appingedam",
>                 "gme_code": 4654,
>                 "admn_level": 3
>               }
>           }
>         }
>       },
>       "geometry": {…}
>     }
>   ]
> }
> 
> Example Turtle output:
> 
> <admr.nl.appingedam>
>     a :Node ;
>     dc:title "Appingedam" ;
>     :createdOnLayer <layer/admr> ;
>     :layerData <admr.nl.appingedam/admr> ;
>     :layerData <admr..nl.appingedam/cbs> .
> <admr.nl.appingedam/admr>
>     a :LayerData ;
>     :definedOnLayer <layer/admr> ;
>     <layer/admr/name> "Appingedam" ;
>     <layer/admr/gme_code> "4654" .
>     <layer/admr/admn_level> "3" .
> <admr.nl.appingedam/cbs>
>     a :LayerData ;
>     :definedOnLayer <layer/cbs> ;
>     <layer/cbs/name> "Appingedam" ;
>     <layer/cbs/population> "1092" ;
> 
> The properties object does not have its own URI. Is there a way to create a JSON-LD context which takes the contents of the properties into account, but further 'ignores' its precence?

This is something that keeps coming up: having a transparent layer, that basically folds properties up a level. This was discussed during the development of JSON-LD, but ultimately it was rejected.

I don't see any prospects for doing something in the short-term, but it could be revisited in a possible future WG chartered with revising the spec. Feedback like this is quite useful.

In the mean time, you can play with different JSON-LD encodings that match your RDF though tools like http://json-ld.org/playground and my own http://rdf.greggkellogg.net/distiller.

Gregg

> Many thanks,
> 
> Bert Spaan
> 

Received on Tuesday, 11 March 2014 16:36:27 UTC