Suivre

@cwebber hi, I'm trying to implement the jsonld expansion algorithm (w3.org/TR/json-ld-api/#expansi), But I'm having trouble understanding how {"e.com": {"@list": "a"}} gets expanded to [{"e.com": [{"@list": [{"@value": "a"}]}]}]

more specifically, why is @list associated to an array, and not the value object directly? When I expand {"@list": "a"}, I have to do 7.4.9 which gives me the value object. Then 7.4.12 associates that to @list, not an array.

@roptat It's been a while since I touched this but I'll attempt to respond.

What's the purpose of @list, as opposed to just an array? It distinguishes between an unordered set and an ordered collection. So ok... fine... so {"@list": ["a", "b", "c"]} should clearly indicate that it's a list as opposed to ["a", "b", "c"] is a set; got it.

But what should {"@list": "a"} do? There wasn't an array there. Effectively, json-ld says "guess that's a list of one item then" and expands that item.

@cwebber
Thanks for the help! I ended up adding a special case, even if it's not specifiied.

Inscrivez-vous pour prendre part à la conversation
Framapiaf

Mastodon est un réseau social utilisant des protocoles Web ouverts et des logiciels libres. Tout comme le courriel, il est décentralisé.