- From: Vagif Abilov <vagif.abilov@gmail.com>
- Date: Fri, 27 Jun 2014 11:07:13 +0200
- To: Markus Lanthaler <markus.lanthaler@gmx.net>
- Cc: public-hydra@w3.org
- Message-ID: <CA+xi7+195RmS+YPBEy2Kxv8Z_bH8xp7OW8EU2q4WH+E_4ySk6Q@mail.gmail.com>
Hi Markus, Thank you for a quick response. You are right about using hydra:Collection, I used localhost just for an example. When it comes to the main topic, I wanted to attach a unique IRI to a primitive value (string) in the user interface. Now that you questioned that I suspect I should rethink my motivation. Perhaps if I really want to enrich my data with IRIs then I should revise them not to be represented by primitive types. Thanks for pointing this out. Vagif On Thu, Jun 26, 2014 at 2:19 PM, Markus Lanthaler <markus.lanthaler@gmx.net> wrote: > 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 Friday, 27 June 2014 09:07:41 UTC