W3C home > Mailing lists > Public > public-linked-json@w3.org > February 2013

Re: Issue with context in the playground?

From: Dave Longley <dlongley@digitalbazaar.com>
Date: Thu, 14 Feb 2013 11:32:15 -0500
Message-ID: <511D118F.1040103@digitalbazaar.com>
To: Alexandre Passant <alex@seevl.net>
CC: public-linked-json@w3.org
Hey Alex,

What's going on is that you're using our rather confusing UI =). You 
need to ensure that your input also includes the "@context" from below, 
you can't just put it in the context box on the right. Our UI needs some 
work; it isn't very intuitive for this case.

What's happening is the UI is interpreting your input as having no 
context and running that through the processor. That's why the output is 
empty ([]). Think of the left box as the incoming data, context and all 
(if it has one), and the right hand box as the context you'd like to 
change to when compacting. In other words, use this:

## Input:

{
   "@context": {
     "name": "http://schema.org/name",
     "image": {
       "@id": "http://schema.org/image",
       "@type": "@id"
     },
     "homepage": {
       "@id": "http://schema.org/url",
       "@type": "@id"
     }
   },
   "name": "Manu Sporny",
   "homepage": "http://manu.sporny.org/",
   "image": "http://manu.sporny.org/images/manu.png"
}

## Context:

{
   "@context":
   {
     "name": "http://schema.org/name",
     "image": {
       "@id": "http://schema.org/image",
       "@type": "@id"
     },
     "homepage": {
       "@id": "http://schema.org/url",
       "@type": "@id"
     }
   }
}


This is somewhat non-intuitive because, in your case, you're not 
changing the context... you're just re-running it through the processor. 
Hopefully this clears things up. I apologize for the poor UI, it's been 
slated to be fixed for some time now we just haven't been able to get to it.

-Dave


On 02/14/2013 07:56 AM, Alexandre Passant wrote:
> Hi,
>
> Non-prefixed elements do not seem to work in the playground.
>
> Using the spec example.
>
> ## Input:
>
> {
>   "name": "Manu Sporny",
>   "homepage": "http://manu.sporny.org/",
>   "image": "http://manu.sporny.org/images/manu.png"
> }
>
> ## Context:
>
> {
>   "@context":
>   {
>     "name": "http://schema.org/name",
>     "image": {
>       "@id": "http://schema.org/image",
>       "@type": "@id"
>     },
>     "homepage": {
>       "@id": "http://schema.org/url",
>       "@type": "@id"
>     }
>   }
> }
>
> Returns [] in the expanded form. When adding something like foaf:name 
> (and foaf URI) in the context, that element is correctly translated.
>
> Is that a bug or do I miss something?
>
> Best,
>
> Alex.
>
> -- 
> Dr. Alexandre Passant - @terraces
> Founder, CEO - http://seevl.net & http://mdg.io
> http://facebook.com/seevl <http://facebook.com/seevl.net> - 
> http://twitter.com/seevl


-- 
Dave Longley
CTO
Digital Bazaar, Inc.
http://digitalbazaar.com
Received on Thursday, 14 February 2013 16:31:53 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:25:39 GMT