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

RE: Odd relative IRI in playground output

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Sat, 22 Feb 2014 12:55:40 +0100
To: "'Gregg Kellogg'" <gregg@greggkellogg.net>, "'Dave Longley'" <dlongley@digitalbazaar.com>
Cc: "'Linked JSON'" <public-linked-json@w3.org>, "'Dan Brickley'" <danbri@google.com>
Message-ID: <009501cf2fc5$04b49500$0e1dbf00$@lanthaler@gmx.net>
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/ 

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 11:56:22 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:41 UTC