Relative URI references: interoperability problems

(Now that I've discovered this list, I'll mention a long-standing problem I've 
encountered...)

I'm using JSON-LD as a native storage format for a "linked data notebook" I've 
been working on (http://annalist.net).  One feature that's important for my use 
is portability of data between different server deployments, so I use relative 
URI references when defining @base and @context URIs;  e.g.

```
{
   "@context": [
     {
       "@base": "../../"
     },
     "../../coll_context.jsonld"
   ],
   "@id": "Place_merged/Opole_P",
    :
}
```

(Excerpt from 
https://demo.annalist.net/annalist/c/EMPlaces_defs/d/Place_merged/Opole_P/entity_data.jsonld, 
which is underlying data for 
https://demo.annalist.net/annalist/c/EMPlaces_defs/d/Place_merged/Opole_P/)

This allows me to save data collections in GitHub, and load them into a local or 
online deployment of my software as working conditions may require. (e.g. 
https://github.com/gklyne/EMPlaces_defs.)

(Here, things may get a bit hazy, because I'm reporting from memory a problem 
encountered some time ago...)

The above data is parsed fine by the Python rdflib libraries (and re-serializes 
as expected Turtle using same at 
https://demo.annalist.net/annalist/c/EMPlaces_defs/d/Place_merged/Opole_P/entity_data.ttl). 
  But when another developer tried to read and parse my JSON-LD data (I think it 
was with a Node library) they were unable to access the context file.

The problem, as I recall, was different handling of the external context URI 
Reference by the different libraries, particularly with respect to whether it 
was interpreted relative to the referring document URI, or relative to the 
previously declared "@base" URI.  At the time, I dug into the (JSON-LD 1.0) spec 
to try and find a definitive interpretation of how such a relative reference 
should be handled, and basically failed to find something I could use.  So I 
just went with what works in the library I'm using.

(The workaround adopted so far has been to generate Turtle, and have other 
developers read that.)

#g
--

Received on Monday, 10 June 2019 11:42:08 UTC