Re: Odd relative IRI in playground output

On Feb 22, 2014, at 3:55 AM, Markus Lanthaler <markus.lanthaler@gmx.net> wrote:

> On Saturday, February 22, 2014 3:25 AM, Gregg Kellogg wrote:
>> This must relate to the default base used by the playground, but when I
>> run it with my own processor (without specifying a base IRI), I don't
>> see the relative IRI.
>> 
>> Basically, it's compacting the following:
>> 
>> {
>>  "@context": {
>>    "@vocab": "http://schema.org/",
>>    "url": {
>>      "@type": "@id"
>>    }
>>  },
>>  "@type": "Movie",
>>  "@id": "http://code.sgo.to/movies/123",
>>  "name": "Dan's schema.org presentation",
>>  "operation": [
>>  {
>>    "@type": "WatchAction",
>>    "@id": "",
>>    "actionStatus": "proposed",
>>    "actionHandler": {
>>      "@type": "WebPageHandler",
>>      "url": "/movies/123/watch"
>>    }
>>  }]
>> }
>> 
>> using an empty context and getting the following:
>> 
>> {
>>  "@id": "http://code.sgo.to/movies/123",
>>  "@type": "http://schema.org/Movie",
>>  "http://schema.org/name": "Dan's schema.org presentation",
>>  "http://schema.org/operation": {
>>    "@id": "./",
> 
> This is correct
> 
> 
>>    "@type": "http://schema.org/WatchAction",
>>    "http://schema.org/actionHandler": {
>>      "@type": "http://schema.org/WebPageHandler",
>>      "http://schema.org/url": {
>>        "@id": "../movies/123/watch"
> 
> Just as this is: /movies/123/watch (absolute path) and /movies/123/watch
> (relative path) are equivalent if the base IRI is
> http://json-ld.org/playground/ 

Pretty confusing, as this doesn't show up anywhere. I wonder if it would make sense to default the base to something like http://example/ (that won't resolve) if one's not set explicitly in the input document. Alternatively (and more simply), adding a text message in the UI that indicates that relative URIs in the output are relative to the playground, unless set explicitly using @bsae.

Gregg

> Dave, I just noticed that I get different results if I run this in IE11.
> Looks like the base IRI isn't set in that case. Could you verify that?
> 
> 
>>      }
>>    },
>>    "http://schema.org/actionStatus": "proposed"
>>  }
>> }
>> 
>> However, mine returns the following:
>> 
>> {
>>  "@id": "http://code.sgo.to/movies/123",
>>  "@type": "http://schema.org/Movie",
>>  "http://schema.org/name": "Dan's schema.org presentation",
>>  "http://schema.org/operation": {
>>    "@id": "",
>>    "@type": "http://schema.org/WatchAction",
>>    "http://schema.org/actionHandler": {
>>      "@type": "http://schema.org/WebPageHandler",
>>      "http://schema.org/url": {
>>        "@id": "/movies/123/watch"
>>      }
>>    },
>>    "http://schema.org/actionStatus": "proposed"
>>  }
>> }
> 
> The difference is that you process the data without a base IRI, i.e., all
> IRI processing is turned off. To achieve the same in the playground, just
> add a @base: null to the context. You will get the same result when
> compacting. You can see the differences when converting to N-Quads. As it
> can't expand those relative IRIs, it drops some triples.
> 
> 
> --
> Markus Lanthaler
> @markuslanthaler
> 
> 

Received on Saturday, 22 February 2014 17:43:32 UTC