- From: Dave Longley <dlongley@digitalbazaar.com>
- Date: Fri, 09 May 2014 16:44:45 -0400
- To: "john.walker" <john.walker@semaku.com>
- CC: public-linked-json@w3.org
On 05/09/2014 04:32 PM, Dave Longley wrote: > On 05/09/2014 03:49 PM, Gregg Kellogg wrote: >> On May 9, 2014, at 7:38 AM, john.walker <john.walker@semaku.com> wrote: >> >>> For sake of completeness here is another example of the JSON-LD tree using >>> "@type" [4] working with the first frame [2]: >>> http://json-ld.org/playground/index.html#startTab=tab-framed&json-ld=https%3A%2F%2Frawgit.com%2Fjaw111%2Fbbd1b00d656045ba8a2c%2Fraw%2Ftree2.jsonld&frame=https%3A%2F%2Frawgit.com%2Fjaw111%2Fbbd1b00d656045ba8a2c%2Fraw%2Fframe1.jsonld&context=%7B%7D >>> >>> But same input does not get along with second frame [3]: >>> http://json-ld.org/playground/index.html#startTab=tab-framed&json-ld=https%3A%2F%2Frawgit.com%2Fjaw111%2Fbbd1b00d656045ba8a2c%2Fraw%2Ftree2.jsonld&frame=https%3A%2F%2Frawgit.com%2Fjaw111%2Fbbd1b00d656045ba8a2c%2Fraw%2Fframe2.jsonld&context=%7B%7D >> >> Hi Jon, a couple of things to note: >> >> 1) JSON-LD treats rdf:type like @type only when importing from RDF; otherwise, it's just another property. >> >> 2) Framing is really pattern matching. For a frame to match @type: skos:ConceptScheme, it has to be specified using @type in the input JSON-LD. >> >> You could get this effect by first transforming the input to RDF, and then back to JSON-LD to have it use @type. For example, see the following: http://goo.gl/JILxnc. > > Alternatively, I think you could also specify > "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" as an alias for @type > to get the desired effect: > > { > "@context": { > "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "@type" > } > } Actually, when I tried this on the playground it threw an error because we don't accept expanded "@id" values for "@type". I have a vague memory of us discussing this during standardization, hopefully we made the right decision here. > >> >> >>>> On May 9, 2014 at 4:27 PM "john.walker" <john.walker@semaku.com> wrote: >>>> >>>> >>>> Hi There, >>>> >>>> I have a question about use of rdf:type in JSON-LD. >>>> >>>> Take for example a simple SKOS tree loaded [1] to the playground: >>>> http://json-ld.org/playground/index.html#json-ld=https%3A%2F%2Frawgit.com%2Fjaw111%2Fbbd1b00d656045ba8a2c%2Fraw%2Ftree.jsonld >>>> >>>> All looks good. >>>> >>>> Now I want to apply a JSON-LD frame [2] to this: >>>> http://json-ld.org/playground/index.html#startTab=tab-framed&json-ld=https%3A%2F%2Frawgit.com%2Fjaw111%2Fbbd1b00d656045ba8a2c%2Fraw%2Ftree.jsonld&frame=https%3A%2F%2Frawgit.com%2Fjaw111%2Fbbd1b00d656045ba8a2c%2Fraw%2Fframe1.jsonld >>>> >>>> In the result there is no content in the "@graph". >>>> >>>> It seems that this is due to the use of "@type" in the JSON-LD frame, whereas >>>> the JSON-LD input uses "http://www.w3.org/1999/02/22-rdf-syntax-ns#type". >>>> >>>> Note that the input document is being generated from a SPARQL query, so I'm >>>> not >>>> in control of how it is formed, it's just a simple serialization of the >>>> triples. >>>> >>>> So a triple in question looks like: >>>> >>>> { >>>> "@id": "http://example.com/conceptSchemes/myTree", >>>> "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": { >>>> "@id": "http://www.w3.org/2004/02/skos/core#ConceptScheme" >>>> } >>>> } >>>> >>>> I would have thought the processor would somehow know that "@type" and >>>> "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" are equivalent, but it seems >>>> not. >>>> >>>> If I modify the frame to use the full URI [3], it works as expected: >>>> http://json-ld.org/playground/index.html#startTab=tab-framed&json-ld=https%3A%2F%2Frawgit.com%2Fjaw111%2Fbbd1b00d656045ba8a2c%2Fraw%2Ftree.jsonld&frame=https%3A%2F%2Frawgit.com%2Fjaw111%2Fbbd1b00d656045ba8a2c%2Fraw%2Fframe2.jsonld >>>> >>>> So my questions: >>>> - is this specified on way or another in the standard >>>> - is this a problem in the processing in the playground, or >>>> - should the relevant triples be formulated as follows in the JSON-LD input: >>>> >>>> { >>>> "@id": "http://example.com/conceptSchemes/myTree", >>>> "@type": "http://www.w3.org/2004/02/skos/core#ConceptScheme" >>>> } >>>> >>>> Hope that is clear... >>>> >>>> Cheers, >>>> John >>>> >>>> [1] https://rawgit.com/jaw111/bbd1b00d656045ba8a2c/raw/tree.jsonld >>>> [2] https://rawgit.com/jaw111/bbd1b00d656045ba8a2c/raw/frame1.jsonld >>>> [3] https://rawgit.com/jaw111/bbd1b00d656045ba8a2c/raw/frame2.jsonld >>>> >>> >>> John >>> >>> [4] https://rawgit.com/jaw111/bbd1b00d656045ba8a2c/raw/tree2.jsonld >>> >> >> > > -- Dave Longley CTO Digital Bazaar, Inc.
Received on Friday, 9 May 2014 20:45:09 UTC