- From: Markus Lanthaler <markus.lanthaler@gmx.net>
- Date: Thu, 26 Jun 2014 14:19:39 +0200
- To: <public-hydra@w3.org>
Hi Vagif, On Wednesday, June 25, 2014 3:35 PM, Vagif Abilov wrote: > I have a list of items ("interests") as a part of a JSON-LD document: > > { > "@context": { > "@base": "http://localhost/", > "name": "http://localhost/name", > "interests": "http://localhost/interests", > "items": { > "@id": "http://localhost/interest", > "@container": "@list" > } > }, > "@id": "http://localhost/john", > "name": "John", > "interests": { > "@context": { > "@base": "http://localhost/", > "items": { > "@id": "http://localhost/interest", > "@container": "@list" > } > }, There's no need to repeat the context here. You already have it in the top-level object. > "@id": "http://localhost/john/interests", > "@type": "http://localhost/array", > "items": [ "Reading", "Writing" ] Since you are posting this to Hydra's list, you should probably use hydra:Collection and hydra:member instead of localhost:array and localhost:items... but you probably know that already :-) > } > } > > My challenge is that I want to enrich "items" element with node id for > each individual interest, something like this: > > { > "@context": { > "@base": "http://localhost/", > "name": "http://localhost/name", > "interests": "http://localhost/interests", > "items": { > "@id": "http://localhost/interest", > "@container": "@list" > } > }, > "@id": "http://localhost/john", > "name": "John", > "interests": { [ removed redundant context] > "@id": "http://localhost/john/interests", > "@type": "http://localhost/array", > "items": [ > { > "@id": "http://localhost/123", > "@value": "Reading" > }, > { > "@id": "http://localhost/456", > "@value": "Writing" > } > ] > } > } > > Unfortunately this approach doesn't work because @value can not be > combined with @id in a JSON-LD node. I wonder if there is a way to > attach a node id to a container element of a primitive type, e.g. I > would like to keep "items" element values as strings without wrapping > them in a new structure. I thought I could do this with @value > specifier, but it doesn't work. Could you please exaplain why you want to do that? If it is a primitive type, than why does it also need to have an IRI? Isn't the value itself enough? Perhaps what you really have in mind is to give that IRI a label that will be used in the user interface!? In that case, you could use something like rdfs:label, hydra:title, schema:name -- Markus Lanthaler @markuslanthaler
Received on Thursday, 26 June 2014 12:20:09 UTC