W3C home > Mailing lists > Public > public-linked-json@w3.org > January 2012

Re: Aliasing @id results in typed literals for IRIs

From: Dave Longley <dlongley@digitalbazaar.com>
Date: Wed, 11 Jan 2012 08:42:54 -0500
Message-ID: <4F0D91DE.4050407@digitalbazaar.com>
To: public-linked-json@w3.org
On 01/10/2012 06:32 AM, Markus Lanthaler wrote:
> Sorry, my bad, I was setting @iri instead of doing aliasing @id but that
> brought me to an interesting question: If we alias keywords, should the
> alias be used for compaction and expansion be used or not? So in this case,
> if I alias @id to @iri should the output contain @id or @iri?

I think the alias should be used for compaction, but not expansion 
(where the context is eliminated). So compacted output should use @iri 
and expansion would still use @id.

> Also, if I alias @id expansion produces some strange outputs in the
> playground when @id is used in the JSON-LD document (it nests an @id within
> @id, http://bit.ly/zKljJE):
>
> {
>      "@id": {
>          "@id": "#me"
>      },
>      "http://xmlns.com/foaf/0.1/knows": [{
>          "@id": {
>              "@id": "http://example/bob#me"
>          },
>          "http://xmlns.com/foaf/0.1/name": "Bob",
>          "http://xmlns.com/foaf/0.1/homepage": {
>              "@id": "http://example.com/bob"
>          }
>      }, {
>          "@id": "http://www.markus-lanthaler.com/#me",
>          "http://xmlns.com/foaf/0.1/name": "Markus",
>          "http://xmlns.com/foaf/0.1/homepage": {
>              "@id": "http://www.markus-lanthaler.com/"
>          }
>      }]
> }
>
>
> "@id": "http://www.markus-lanthaler.com/#me" is correct as I used @iri in
> the input document.

That certainly looks like a bug to me. Aliasing any keyword in a context 
shouldn't change what the expanded output looks like since expansion 
strips the context away. I'll look into fixing it when I get a chance.

>
>> -----Original Message-----
>> From: Markus Lanthaler [mailto:markus.lanthaler@gmx.net]
>> Sent: Tuesday, January 10, 2012 7:19 PM
>> To: public-linked-json@w3.org
>> Subject: Aliasing @id creates results in typed literals for IRIs
>>
>> Hi,
>>
>> I not sure if this is an issue or a desired behavior - at least it's
>> not
>> wrong. When I alias @id to, e.g. @iri in the JSON-LD playground @id
>> gets
>> replaced with @iri as expected when used to define the subject, but it
>> yields to a typed literal for objects. See example below
>> (http://bit.ly/x1Qmfy):
>>
>> {
>>      "@iri": "#me",
>>      "http://xmlns.com/foaf/0.1/knows": [{
>>          "@iri": "http://example/bob#me",
>>          "http://xmlns.com/foaf/0.1/name": "Bob",
>>          "http://xmlns.com/foaf/0.1/homepage": {
>>              "@type": "@iri",
>>              "@literal": "http://example.com/bob"
>>          }
>>      }, {
>>          "@iri": "http://www.markus-lanthaler.com/#me",
>>          "http://xmlns.com/foaf/0.1/name": "Markus",
>>          "http://xmlns.com/foaf/0.1/homepage": {
>>              "@type": "@iri",
>>              "@literal": "http://www.markus-lanthaler.com/"
>>          }
>>      }]
>> }
>>
>>
>> --
>> Markus Lanthaler
>> @markuslanthaler

-- 
Dave Longley
CTO
Digital Bazaar, Inc.
Received on Wednesday, 11 January 2012 13:43:26 GMT

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