Re: JSON-LD to RDF question...

> On Mar 29, 2018, at 2:50 PM, Axel Polleres <axel@polleres.net> wrote:
> 
> Thanks for the quick reply Gregg...
> well, I do unserstand that the JSON-LD community doesn't like RDF lists a lot, but it would indeed be cool if there was a way to specify, e.g. in the context 
> to parse certain attributes as lists (and leave them as lists in RDF)…. 

It’s not that the community doesn’t like RDF Lists (although, there are some), but that in the 1.0 time-frame, we did not come up with a generic solution to deal with lists of lists. Given sufficient interest, this could definitely be on the table for JSON-LD 1.1, but will require some thinking about the conversion algorithm.

> ... I like Pieter's proposal in https://github.com/json-ld/json-ld.org/issues/397 <https://github.com/json-ld/json-ld.org/issues/397> BTW.
> (Option 2 in https://github.com/json-ld/json-ld.org/issues/397#issuecomment-153425387 <https://github.com/json-ld/json-ld.org/issues/397#issuecomment-153425387>)

As I said, the @json type handling is definitely on tap for 1.1, but it’s really more akin to rdf:XMLLiteral or rdf:HTML, and likely doesn’t really do what you want to do.

The @values mechanism described in #397 could be done, but may not be sufficiently robust to handle other cases; it definitely works for geojson, though. It remains an open issue, but is not currently on the list for 1.1, as it really requires a champion. I can add it as a deferred for the WG to consider further.

option 2, to work for any hierarchical array would be best, but someone needs to think through the round-tripping considerations.

Gregg

From Pieter’s list
> Do you see it being adopted in the new WG? (or do I need to join to support it :-)) 

All features considered by a WG require a champion, and moreover, someone to help consider the implications on the API, so by all means, please consider joining the WG, and add your organization’s vote for the charter.

Gregg

> Axel
> 
> 
> 
> --
> Dr. Axel Polleres 
> url: http://www.polleres.net/ <http://www.polleres.net/>  twitter: @AxelPolleres
> 
>> On 29.03.2018, at 14:29, Gregg Kellogg <gregg@greggkellogg.net <mailto:gregg@greggkellogg.net>> wrote:
>> 
>> Hi Axel, normally, you would probably say that “coordinates” is of type list:
>> 
>> {
>>   “@context”: {
>>     “@vocab”: "http://data.wu.ac.at/ns/osm_wrapper <http://data.wu.ac.at/ns/osm_wrapper>/“,
>>     “coordinates”: {“@container”: “@list”}
>>   }
>> …
>> }
>> 
>> However, geojson is a bit different, as it uses an array of arrays, and the JSON-LD processor sees this as being a list of lists, so there’s no direct conversion available, in this case. There has been discussion about better support for geojson, but the model they use is problematic for JSON-LD. One thought was do add some @values mapping capability. You can see discussion on issue #397 [1]. Feel free to chime in there.
>> 
>> We are definitely planning on the raw JSON values mechanism described in issue #333 [2], but this might not actually be very satisfactory for you.
>> 
>> Note that a new JSON-LD WG is being chartered [3], and you might consider joining.
>> 
>> Gregg Kellogg
>> gregg@greggkellogg.net <mailto:gregg@greggkellogg.net>
>> 
>> [1] https://github.com/json-ld/json-ld.org/issues/397 <https://github.com/json-ld/json-ld.org/issues/397>
>> [2] https://github.com/json-ld/json-ld.org/issues/333 <https://github.com/json-ld/json-ld.org/issues/333>
>> [3] https://www.w3.org/2018/03/jsonld-wg-charter.html <https://www.w3.org/2018/03/jsonld-wg-charter.html> 
>> 
>>> On Mar 29, 2018, at 12:17 PM, Axel Polleres <axel@polleres.net <mailto:axel@polleres.net>> wrote:
>>> 
>>> Hi all,
>>> 
>>> I have a question about LSON-LD to RDF conversion:
>>> 
>>> 
>>> 
>>> Hi folks,
>>> 
>>> I have a JSON-LD question:
>>> 
>>> I was trying to use JSON-LD to convert nominatim's OSM output to RDF.
>>> Essentially I tried adding a simple @context consisting of a simple @vocab namespace to the output of:
>>> 
>>>  https://nominatim.openstreetmap.org/reverse?osm_id=1990594&osm_type=R&polygon_geojson=1&format=json <https://nominatim.openstreetmap.org/reverse?osm_id=1990594&osm_type=R&polygon_geojson=1&format=json> 
>>> 
>>> in order to JSON-LDify it, arriving at this: 
>>> ```
>>> {
>>> "@context": 
>>> {
>>>  "@vocab": "http://data.wu.ac.at/ns/osm_wrapper/ <http://data.wu.ac.at/ns/osm_wrapper/>"
>>> },
>>> "licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org <http://osm.org/>\/copyright", "osm_type":"relation","osm_id":"1990594", "lat":"48.2006384", "lon":"16.426895311478","display_name":"Leopoldstadt, Wien, 1020, ?~Vsterreichh","address":{"city_district":"Leopoldstadt","city":"Wien","state":"Wien","postcode":"1020","country":"?~Vsterreich","country_code":"at"},"boundingbox":["48.1650897","48.2363475","16.3674575","16.4984617"],"geojson":{"type":"Polygon","coordinates":[[[16.3674575,48.2251075],[16.3675889,48.2248433],[16.3677014,48.2245416],[16.3678088,48.224167],[16.3678892,48.2236976],[16.3678804,48.2225512],[16.3679638,48.2215549],[16.3681553,48.2206543],[16.368354,48.2200858],[16.3685722,48.2197903],[16.3691878,48.2191461],[16.3696756,48.2187986],[16.3697005,48.2187537],[16.370149,48.2184891],[16.3705928,48.2181828],[16.3730586,48.2162786],[16.3735127,48.2158294],[16.3748503,48.2138968],[16.3750037,48.2136848],[16.3751909,48.213483],[16.375417,48.2132734],[16.3756681,48.2130823],[16.3759558,48.2128966],[16.3762659,48.2127214],[16.3765444,48.2125783],[16.3767933,48.2124669],[16.3770396,48.2123689],[16.3773213,48.2122674],[16.3776787,48.2121566],[16.378046,48.2120631],[16.3785496,48.2119588],[16.3790386,48.2118721],[16.3795538,48.2117967],[16.3801144,48.2117366],[16.3810688,48.2116787],[16.3813019,48.2116741],[16.3815788,48.2116707],[16.3819552,48.2116759],[16.3824376,48.2116916],[16.3829286,48.2117265],[16.383917,48.2118198],[16.3840766,48.2118151],[16.3842505,48.2117642],[16.3844066,48.2116567],[16.3844793,48.211542],[16.3845071,48.2113936],[16.3848946,48.2113547],[16.3849036,48.2114232],[16.3849157,48.2114536],[16.3849313,48.2114786],[16.3849694,48.2115187],[16.3849941,48.2115334],[16.3850638,48.2117766],[16.3850918,48.2118472],[16.3851492,48.2119177],[16.3852455,48.211994],[16.3854257,48.2120648],[16.3860319,48.2122929],[16.3864832,48.2124664],[16.3865617,48.2125735],[16.3866417,48.2126365],[16.3868036,48.2127095],[16.3871675,48.2128421],[16.3875413,48.2129527],[16.3879236,48.2130384],[16.3883691,48.2131175],[16.3888027,48.2131612],[16.3892349,48.2131825],[16.389647,48.213176],[16.3900579,48.2131492],[16.3903953,48.2131111],[16.3908259,48.213035],[16.3915326,48.2128909],[16.3923033,48.2126943],[16.3931358,48.2123726],[16.3937209,48.2120635],[16.3942561,48.2116641],[16.3946581,48.2112488],[16.3956534,48.2097274],[16.3961994,48.2087094],[16.3965158,48.2078611],[16.397082,48.2050464],[16.3973936,48.2044186],[16.3978408,48.2038574],[16.3983736,48.2034024],[16.398797,48.2030885],[16.3994891,48.2027366],[16.4003359,48.202475],[16.4039157,48.201825],[16.404979,48.2015825],[16.4058995,48.2012733],[16.4066582,48.2008865],[16.4073552,48.2003903],[16.4078547,48.1998829],[16.4085445,48.1989871],[16.4097751,48.1972113],[16.4100661,48.1968503],[16.4103604,48.1965465],[16.410865,48.1961194],[16.4118817,48.195365],[16.4134445,48.1943787],[16.4211488,48.1898533],[16.4220931,48.1893474],[16.4250996,48.1881121],[16.4301686,48.1866113],[16.4310992,48.1863419],[16.4386107,48.1842029],[16.451663,48.1803481],[16.4605003,48.1777857],[16.4672414,48.1757468],[16.4677727,48.1755726],[16.4683386,48.175369],[16.4694852,48.174939],[16.4758724,48.1724605],[16.4784741,48.1712739],[16.4790301,48.1710463],[16.4797577,48.1707483],[16.4797281,48.1706977],[16.482739,48.1696294],[16.4838791,48.1691128],[16.4841719,48.1689849],[16.4844916,48.1688524],[16.4854739,48.1684853],[16.4860142,48.1683315],[16.4878399,48.1677592],[16.4898926,48.1671036],[16.4915066,48.1665412],[16.4930469,48.1659298],[16.4946226,48.1652865],[16.4946641,48.1653265],[16.4952282,48.1650897],[16.497085,48.1662737],[16.4984617,48.1671813],[16.4924117,48.1707639],[16.4885141,48.1731901],[16.4850516,48.1753516],[16.4791211,48.1791524],[16.4738454,48.1825645],[16.4507882,48.1978986],[16.4367364,48.2075131],[16.4297298,48.2124399],[16.4258648,48.2151612],[16.4228069,48.2174031],[16.4212773,48.2185006],[16.4178652,48.2209513],[16.4162691,48.2221101],[16.4155324,48.2226691],[16.4086705,48.2278603],[16.4060609,48.2298632],[16.4037597,48.23167],[16.4016921,48.2333369],[16.3999414,48.2348052],[16.39813,48.2363475],[16.3952636,48.2348285],[16.3952714,48.2348175],[16.3900496,48.2320927],[16.386782,48.230365],[16.3879168,48.2293738],[16.3881888,48.2281683],[16.3880589,48.2280809],[16.3879758,48.2279555],[16.3879719,48.2278379],[16.3846792,48.2260733],[16.3833445,48.2256078],[16.3832679,48.2255949],[16.3831822,48.2256026],[16.383103,48.2256355],[16.3830495,48.225681],[16.3813009,48.2279149],[16.3804773,48.2283143],[16.3801322,48.2283067],[16.3798446,48.2284433],[16.379366,48.2286756],[16.3789703,48.2288677],[16.3776716,48.2294971],[16.3775195,48.2295707],[16.3766953,48.2292994],[16.3766339,48.2292792],[16.3762505,48.2291536],[16.3735354,48.2282613],[16.3721614,48.2278334],[16.3709455,48.2266748],[16.3709292,48.2266592],[16.3707049,48.2264456],[16.3704212,48.2261717],[16.3703725,48.2258255],[16.3697574,48.2256151],[16.3693506,48.225683],[16.368439,48.2253741],[16.3674575,48.2251075]]]}}
>>> ```
>>> 
>>> Now when I try to convert this JSON-LD to RDF (either using easyrdf.org <http://easyrdf.org/> [1] or te JSON-LD playground [2] I realize that what I get for the :coordinates property is just flattening all the values of the nested list into separate integer attribute values, in other words (illustrating in TTL syntax), I get back something like:
>>> 
>>> --------
>>> 
>>> @prefix : <http://data.wu.ac.at/ns/osm_wrapper/ <http://data.wu.ac.at/ns/osm_wrapper/>> .
>>> 
>>> ...
>>> 
>>> [ :coordinates 1.636746e+1, 4.822511e+1, 1.636759e+1, 4.822484e+1, 1.636770e+1, 4.822454e+1, 1.636781e+1, 4.822417e+1, 1.636789e+1, 4.822370e+1, 1.636788e+1, 4.822255e+1, 1.636796e+1,
>>> 
>>>   ...
>>> 
>>> ]
>>> 
>>> ------
>>> 
>>> This is of course not ideal, as it looses the structure of the nested list... is this *seriously* what JSON-LDs model is prescribing? Anyway, can redefine the context to influence that handling of nested list attributes?
>>> Or is this simply a bug?
>>> 
>>> hints/opinions welcome!
>>> 
>>> Axel 
>>> 
>>> 
>>> 1. http://www.easyrdf.org/ <http://www.easyrdf.org/>
>>> 2. https://json-ld.org/playground/ <https://json-ld.org/playground/>
>>> 
>>> 
>>> 
>>> --
>>> Dr. Axel Polleres 
>>> url: http://www.polleres.net/ <http://www.polleres.net/>  twitter: @AxelPolleres
>>> 
>> 
> 

Received on Friday, 30 March 2018 18:10:28 UTC