Closed balhoff closed 8 years ago
Need to think about 2+3
- ... "could increase consistency across files if we say that the default context can only be extended, not overridden"
Agreed, but if we do this, it is not entirely without nuance:
Ideally overriding mappings should be forbidden in both directions (no permuted prefixes for existing URIs, no alternate URIs for existing prefixes). However, alternate prefixes that expand to the same URI are trivial to collapse; inverse not so much. There it is necessary to determine whether the URIs actually are "equivalent", and equivalence is often a) in the eye of the beholder and b) not something that can be automated with ease.
For now, though, let's consider just being rigorous and we can deal with messy reality when we have other issues in hand. We will allow people to file-embed a brand new binding (eg. for a new database) for which neither the prefix nor URI collides with an existing one in the master context. The validator should be able to check for such collisions, including ideally, warnings for at least a few of the most common URL permutations.
It would be great if the validator could create a record of any extensions so that these could be added to the canon somehow.
I suppose another approach worth considering is to make all phenopackets real JSON-LD and always explicitly specify the context (so the behavior is determined by the JSON-LD spec). We can still provide the default context which folks can reference if they want (you can have a list for your context including both external URIs and embedded objects).
Are you suggesting that, for safety, the validation step harvest and copy all of the relevant mappings from the master to the individual doc?
Good suggestion.
Not sure how much jackson tweaking would be required here. The context object is a freeform map object, I assume there is a way to map that appropriately
No, actually I was just raising the possibility of not providing an implicit context at all. Simply say that context is specified according to the JSON-LD spec. And we could provide standard context online and recommend its use. In normal JSON-LD a file can reference an external context at the same time they provide an embedded context, like so:
{
"@context": [
"http://phenopackets.org/context.jsonld",
{ "UBERON": "http://purl.obolibrary.org/obo/UBERON_"}
]
}
Here an UBERON prefix is added to the standard context. But standard context is explicitly referenced.
On 11 May 2016, at 15:05, Julie McMurry wrote:
Are you suggesting that, for safety, the validation step harvest and copy all of the relevant mappings from the master to the individual doc?
The context object could just be a pointer to a context file on the web
Great; just wanted to make sure we weren't bloating the files unnecessarily.
Okay, it seems like we have concluded:
@context
instead of context
.@base
works.@cmungall @jmcmurry I have resolved most of the concerns I had about how @base
is applied. I was fairly confused because the spec is not that clear about how it works, and, as I've since confirmed, there is a bug in JSON-LD Playground which incorrectly applies @base
from external contexts, and there is a bug (now fixed) in jsonld-java which incorrectly doesn't apply @base
from embedded (or external) contexts when an external context is also in use.
I'll update the description of context and base in the wiki.
Wow, thanks! This must have been very painful to debug.
bug in JSON-LD Playground
Has this been reported? Is it truly limited to the playground or are there additional concerns with the specification itself?
According to one of the JSON-LD developers it should be a bug in the JavaScript implementation. I filed a bug: https://github.com/digitalbazaar/jsonld.js/issues/142
Awesome; thanks for tracking this down, Jim
Per issue #40, we want to use a JSON-LD context file to specify how CURIEs used in phenopackets should be expanded. I have mostly implemented handling of contexts for the reference implementation, but I have a few questions about how they should work.
base
key. In JSON-LD this should be@base
. Is a phenopacket document meant to completely adhere to JSON-LD, or can we have some special handling to make thebase
key without the@
work the way we want?@base
is ignored in JSON-LD when there is a remote context (e.g. the phenopackets default context). If we want we can specially extract the value of thebase
key out of the local context and apply it in our identifier expansions, but that would be beyond the typical JSON-LD processing. Perhaps we should move thebase
key to the root of the phenopacket document and out of the JSON-LD context. I think we are already going a little beyond JSON-LD by using an "implicit" default context within the reference API (although this is a little bit like providing an implicit context via HTTP headers, which is legitimate in certain situations).