Re: Framing @language

Hi Kuno,

On 06/24/2012 08:16 PM, Kuno Woudt wrote:
> Hello,
>
> I'm experimenting with RDF and JSON-LD, and I have data like this:
>
>   @prefix senet: <https://senet.org/ns#> .
>
> <https://senet.org/gmb> a senet:Game;
>       senet:title ( "リズム天国"@ja "Rhythm Paradise"@en ).
>
>
> In the context, I have this:
>
>   "title": { "@id": "senet:title", "@container":  "@list" },
>
>
> So after framing the title ends up in my json like this:
>
>     "title": [
>         {
>             "@value": "\u30ea\u30ba\u30e0\u5929\u56fd",
>             "@language": "ja"
>         },
>         {
>             "@value": "Rhythm Paradise",
>             "@language": "en"
>         }
>     ],
>
>
> I would like pass my json into a mustache template without any further 
> processing.  The problem is that mustache doesn't like the @.* keys.
>
> Is there a way with framing to change the "@value" and "@language" 
> keys to just "value" and "language" or something like that?

Yes, it's called keyword aliasing. Just add to your context:

{
   "value": "@value",
   "language": "@language"
}

>
> Similarly, in the template I cannot access the "@id" of my document, 
> is there a way with framing to either use a different key (e.g. "id" 
> instead of "@id") or add a copy of it ("id" in addition to "@id") ?

Add to your context:

{"id": "@id"}.

Here's your example with aliases on the json-ld.org playground:

http://tinyurl.com/839kgrb

There might be a way to simply handle special characters in mustache as 
well -- but hopefully this covers your use case!

>
> -- kuno / warp.
>
>
>
>


-- 
Dave Longley
CTO
Digital Bazaar, Inc.

Received on Monday, 25 June 2012 04:28:36 UTC