- From: Danny Ayers <danny.ayers@gmail.com>
- Date: Mon, 2 Apr 2012 18:24:55 +0200
- To: Markus Lanthaler <markus.lanthaler@gmx.net>
- Cc: public-linked-json@w3.org
Hi Markus, Thanks. The use of "_:blank" is clear now I've seen an example, but really wasn't obvious from the spec, I'd still suggest a doc tweak. Re. typing of objects, right, it makes sense now you mention literals/scalars. In this case when the context says the object of a statement is an @id as well as the actual statement it's redundant, but I guess that still might be useful as a sanity-checking annotation. Cheers, Danny. On 2 April 2012 12:28, Markus Lanthaler <markus.lanthaler@gmx.net> wrote: > Hi Danny, > >> After not having looked at the spec for months, I'm in the process of >> manually converting a bit of Turtle into JSON-LD. I stumbled at this >> point: >> >> <http://hyperdata.org/Hello> >> foaf:maker [ foaf:nick "danja" ] . >> >> Text-searching the spec ("blank nodes") I found: >> >> http://json-ld.org/spec/latest/json-ld-syntax/#identifying-unlabeled- >> nodes >> >> ...which didn't seem to help at all. How would the above be expressed >> using the "_:blank" style? > > Generally blank nodes are generated automatically when you convert to RDF. If you want to label an object with a specific blank node you use the idiom described in the spec. > > So the above example (which also just has implicit blank nodes) would be expressed as follows: > > { > "@context": { > "maker": "http://xmlns.com/foaf/0.1/maker", > "nick": "http://xmlns.com/foaf/0.1/nick" > }, > "@id": "http://hyperdata.org/Hello", > "maker": { > "@id": "_:blank", > "nick": "danja" > } > } > > >> One thing I'm still uncertain about is that although the JSON-LD above >> produced the triples I was after, the context part doesn't distinguish >> what kind of a node the object of maker/subject of nick was. This >> appears to be possible using the context: >> >> "@context": { >> "maker": { >> "@id": "http://xmlns.com/foaf/0.1/maker", >> "@type": "@id" >> }, >> >> - but doesn't make any difference to the resulting triples. > > The reason for this is that you set the value to an object and not a literal (string, number, boolean in JSON). If you would have set it to "http://example.org/maker" you would have to add that @type declaration. > > >> Leading to the question: why would/should anyone bother putting node >> type info into the context? > > It's used for type coercing with scalars/literals. As explained above. Since you use an object as value, JSON-LD automatically generates an identifier for that object and "knows" that it is an IRI (when converted to Turtle for example). > > > Hope this helps, > Markus > > > -- > Markus Lanthaler > @markuslanthaler > > > -- http://dannyayers.com http://webbeep.it - text to tones and back again
Received on Monday, 2 April 2012 16:25:28 UTC