Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base URI per property [Duplicate] #428

Closed
JervenBolleman opened this issue Sep 30, 2016 · 7 comments
Closed

Base URI per property [Duplicate] #428

JervenBolleman opened this issue Sep 30, 2016 · 7 comments

Comments

@JervenBolleman
Copy link

JervenBolleman commented Sep 30, 2016

This is an usecase that comes from the UniProt RDF to JSON translation. The UniProt datamodel is big and uses a lot of properties, not only that they have large number of URI namespaces.

e.g. in this example

{
  "@context": {
    "@base": "http://purl.uniprot.org/uniprot/",
    "id": "@id",
    "a": "@type",
    "name": "http://purl.uniprot.org/core/name",
    "taxon": "http://purl.uniprot.org/taxonomy/",
    "organism": {
      "@id": "http://purl.uniprot.org/core/organism"
    }
  },
  "id": "P12345",
  "organism": {
    "id": "taxon:9606",
    "name": "Human"
  }
}

We would like to get rid of this prefixed taxon:9606 uri. i.e. in other words just show the 9606.

The main UniProt identifiers are dealt with by having set the base.

But for some specific properties I know that I will only have ids with a
certain prefix. This can't be specified in the context today.

e.g. I would like to have something like this.

{
 "@context": {
   "@base": "http://purl.uniprot.org/uniprot/",
   "id": "@id",
   "a": "@type",
   "name": "http://purl.uniprot.org/core/name",
   "taxon": "http://purl.uniprot.org/taxonomy/",
   "organism": {
     "@id": "http://purl.uniprot.org/core/organism",
     "@MORE JSON-LD MAGIC" : "taxon"
   }
 },
 "id": "P12345",
 "organism": {
   "id": "9606",
   "name": "Human"
 }
}

That should translate to this

taxon:9606 up:name "Human" .
<P12345> up:organism taxon:9606 .

instead of this

<9606> up:name "Human" .
<P12345> up:organism <9606> .

There are ways to work around this with many inline contexts with their own base, but that is fragile (can have only one context per object so if we had two of this kind of predicates it would not work, in the UniProt case this does happen.)

@lisp
Copy link

lisp commented Sep 30, 2016

this looks like a clear demonstration of a good argument for nesting contexts as such, rather than requiring that they always appear in-line.

@gkellogg
Copy link
Member

This would fall out of #426. It would look something like the following:

{
 "@context": {
   "@base": "http://purl.uniprot.org/uniprot/",
   "id": "@id",
   "a": "@type",
   "name": "http://purl.uniprot.org/core/name",
   "taxon": "http://purl.uniprot.org/taxonomy/",
   "organism": {
     "@id": "http://purl.uniprot.org/core/organism",
    "@content": {
      "@context": {
       "@base": "http://purl.uniprot.org/taxonomy/"
      }
    }
   }
 },
 "id": "P12345",
 "organism": {
   "id": "9606",
   "name": "Human"
 }
}

@JervenBolleman
Copy link
Author

@gkellogg that looks exactly like what I want. Should I close this issue as it then duplicates #426 ?

@gkellogg
Copy link
Member

Yes, you can close it. There will be a marker to this issue, as this references #426.

Once we achieve consensus on going forward with changes for 1.1, we can get spec text integrated into a draft; that should happen reasonably soon.

@JervenBolleman JervenBolleman changed the title Base URI per property Base URI per property [Duplicate] Sep 30, 2016
@newgene
Copy link

newgene commented Jun 30, 2017

@gkellogg @JervenBolleman is the json-ld example in this above comment is now supposed to work with 1.1 client (e.g. ruby one)? I tested it in my 1.1 playground, it does not seem able to pick up the @base under "organism".

@gkellogg
Copy link
Member

No, we never proceeded on having term @content, only term-specific @context. That would be more like the following:

{
 "@context": {
  "@version": 1.1,
   "@base": "http://purl.uniprot.org/uniprot/",
   "id": "@id",
   "a": "@type",
   "name": "http://purl.uniprot.org/core/name",
   "taxon": "http://purl.uniprot.org/taxonomy/",
   "organism": {
     "@id": "http://purl.uniprot.org/core/organism",
    "@context": {
     "@base": "http://purl.uniprot.org/taxonomy/"
    }
   }
 },
 "id": "P12345",
 "organism": {
   "id": "9606",
   "name": "Human"
 }
}

It does not compact they way you expect (to be investigated), but it does expand using the embedded context.

@newgene
Copy link

newgene commented Jun 30, 2017

@gkellogg got it, "scoped context" should be the solution here. And looks like might be a bug in the ruby client for processing the scoped context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants