Re: Relative URI Handling in JSON-LD

> On Sep 29, 2017, at 12:00 PM, Kingsley Idehen <kidehen@openlinksw.com> wrote:
> 
> On 9/27/17 8:26 PM, Kingsley Idehen wrote:
>> On 9/27/17 4:47 PM, Gregg Kellogg wrote:
>> 
>>> JSON-LD will require expanded IRIs to be absolute (as does an N-Triples transformation of Turtle). The “base”: “” overrides to document location, and inhibits the creation of absolute IRIs. While you should be able to do this, the result won’t be valid expanded JSON-LD or RDF.
>>> 
>>> Gregg
>>> 
>> Gregg,
>> 
>> Okay, so what about the following which also doesn't work (note same
>> approach works for @id key where value is "#BrewEats":
>> 
>> {
>>   "@context":
>>   {
>>      "schema": 
>> "http://schema.org/"
>> ,
>>     "@base": "#" 
>>   },
>>     "@id": "#BrewEats",
>>     "@type": "schema:Restaurant",
>>     "schema:name": "Brew Eats",
>>     "databaseId": "23987520"
>> }
>> 
>> 
>> [1]
>> 
>> http://kingsley.idehen.net/DAV/home/kidehen/Public/Linked%20Data%20Documents/Nanotations/basic-test2.txt
>> 
>> -- updated test doc reflecting the example above.
>> 
>> Kingsley 
>> 
> 
> Do I conclude that at this juncture, JSON-LD doesn't have the equivalent of <#> in RDF-Turtle? Basically, 
> "#databaseId" isn't an option for {current-doc-url}#databaseId key, even though key value "#BrewEats" does get transformed to {current-doc-url}#BrewEats" .
> 
> Formally, that: "the value of "@base" in a @context must be an absolute IRI or the empty string." is currently contradictory, since empty string != <> in RDFTurtle. 

From the JSON-LD Syntax spec [1]:

> If the context definition has an @base key, its value must be an absolute IRI, a relative IRI, or null.

> If the context definition has an @vocab key, its value must be a absolute IRI, a compact IRI, a blank node identifier, a term, or null.

So, “@base”: “#” should be supported, and you’re likely seeing an untested corner-case in jsonld.js. Note, however, that expanded form is intended to make the terms in a document unambiguous:

> Expansion has two important goals: removing any contextual information from the document, and ensuring all values are represented in a regular form. These goals are accomplished by expanding all properties to absolute IRIs and by expressing all values in arrays in expanded form. 

> Note that in the output above all context definitions have been removed, all terms and compact IRIs have been expanded to absolute IRIs, and all JSON-LD values are expressed in arrays in expanded form.

So, in your case “@base”: “#” should work, but “@vocab” will never be treated as document relative. This should be true for the TR as well as the CG Draft. I’m sure this was considered for the TR, but failed to pass muster. (see, for example #26 [3]).

[1] https://json-ld.org/spec/latest/json-ld/#context-definitions
[2] https://json-ld.org/spec/latest/json-ld-api/#expansion
[3] https://github.com/json-ld/json-ld.org/issues/26

> Kingsley 
>> 
>>> On Sep 27, 2017, at 1:20 PM, Kingsley Idehen <kidehen@openlinksw.com>
>>>  wrote:
>>> 
>>>> All,
>>>> 
>>>> Can anyone shed light on the ability to use relative HTTP URIs to
>>>> identify relations (keys in json parlance) via JSON-LD [1] ?
>>>> 
>>>> I have an RDF-Turtle example that I am struggling to replicate in JSON-LD.
>>>> 
>>>> Links:
>>>> 
>>>> [1] 
>>>> https://twitter.com/kidehen/status/913134180317515777
>>>>  -- depicts the
>>>> dilemma I've encountered
>>>> 
>>>> [2]
>>>> 
>>>> http://kingsley.idehen.net/DAV/home/kidehen/Public/Linked%20Data%20Documents/Nanotations/basic-test2.txt
>>>> 
>>>> -- sample
>>>> 
>>>> -- 
>>>> Regards,
>>>> 
>>>> Kingsley Idehen          
>>>> Founder & CEO 
>>>> OpenLink Software   (Home Page: 
>>>> http://www.openlinksw.com
>>>> )
>>>> 
>>>> Weblogs (Blogs):
>>>> Legacy Blog: 
>>>> http://www.openlinksw.com/blog/~kidehen/
>>>> 
>>>> Blogspot Blog: 
>>>> http://kidehen.blogspot.com
>>>> 
>>>> Medium Blog: 
>>>> https://medium.com/@kidehen
>>>> 
>>>> 
>>>> Profile Pages:
>>>> Pinterest: 
>>>> https://www.pinterest.com/kidehen/
>>>> 
>>>> Quora: 
>>>> https://www.quora.com/profile/Kingsley-Uyi-Idehen
>>>> 
>>>> Twitter: 
>>>> https://twitter.com/kidehen
>>>> 
>>>> Google+: 
>>>> https://plus.google.com/+KingsleyIdehen/about
>>>> 
>>>> LinkedIn: 
>>>> http://www.linkedin.com/in/kidehen
>>>> 
>>>> 
>>>> Web Identities (WebID):
>>>> Personal: 
>>>> http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i
>>>> 
>>>>        : 
>>>> http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl#this
>>>> 
>>>> 
>>>> 
>>>> 
> 
> -- 
> Regards,
> 
> Kingsley Idehen       
> Founder & CEO 
> OpenLink Software   (Home Page: 
> http://www.openlinksw.com
> )
> 
> Weblogs (Blogs):
> Legacy Blog: 
> http://www.openlinksw.com/blog/~kidehen/
> 
> Blogspot Blog: 
> http://kidehen.blogspot.com
> 
> Medium Blog: 
> https://medium.com/@kidehen
> 
> 
> Profile Pages:
> Pinterest: 
> https://www.pinterest.com/kidehen/
> 
> Quora: 
> https://www.quora.com/profile/Kingsley-Uyi-Idehen
> 
> Twitter: 
> https://twitter.com/kidehen
> 
> Google+: 
> https://plus.google.com/+KingsleyIdehen/about
> 
> LinkedIn: 
> http://www.linkedin.com/in/kidehen
> 
> 
> Web Identities (WebID):
> Personal: 
> http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i
> 
>         : 
> http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl#this
> 
> 
> 

Received on Friday, 29 September 2017 23:47:27 UTC