Re: Is it possible to use aliases on the "value" side?

On Tue, Sep 3, 2013 at 7:06 PM, Niklas Lindström <lindstream@gmail.com> wrote:
>
> On Tue, Sep 3, 2013 at 4:50 PM, Alexey Zakhlestin <indeyets@gmail.com> wrote:
>>
>> Is it possible to use aliases on the value side?
>> Here's the example of what I try:
>> https://gist.github.com/indeyets/d9e996c54bf0bac916e7
>>
>> I want to be able to use an alias as the value for "schema:author"
>> property.
>> Can I, somehow?
>
>
> Yes, you can achieve this by changing your context to:
>
>     "@context": {
>       "schema": "http://schema.org/",
>       "localpedia": "http://example.org/localpedia/",
>       "schema:author": {"@type": "@vocab"},
>       "author1": "localpedia:author1"
>     }
>
> Also, if you're willing to tweak your keys a little, your example can be
> reduced to this (prefix-free keys, uniform @id values):
>
>     {
>       "@context": {
>         "@vocab": "http://schema.org/",
>         "localpedia": "http://example.org/localpedia/",
>         "author": {"@type": "@id"}
>       },
>       "@graph": [
>         {
>           "@type": "Article",
>           "author": "localpedia:author1"
>         },
>         {
>           "@id": "localpedia:author1",
>           "name": "Foo Bar"
>         }
>       ]
>     }
>

thanks! that's helpful.

Is it possible to do the same for _any_ previously unknown property?
so that "author1" automatically forces property into {"@type":
"@vocab"}

I guess not. that could cause some hard to trace issues


-- 
Alexey Zakhlestin,
http://github.com/indeyets

Received on Tuesday, 3 September 2013 15:24:19 UTC