W3C home > Mailing lists > Public > public-linked-json@w3.org > August 2016

RE: Giving a "base" to non base uri's depending on a property?

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Thu, 25 Aug 2016 22:24:15 +0200
To: <public-linked-json@w3.org>
Cc: "'Jerven Tjalling Bolleman'" <jerven.bolleman@sib.swiss>
Message-ID: <045b01d1ff0e$a770d630$f6528290$@gmx.net>
On 29 Jul 2016 at 15:31, Jerven Tjalling Bolleman wrote:
> I was wondering if I can further JSONify this simple example.
> 
> http://json-ld.org/playground/#/gist/344c26ab5228a84b24d6969d4b4a2199
> 
> This is correct and the translation is as well. Yet, I would like to get
> rid of this prefixed taxon:9606 uri.
> 
> 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. I can't think of a way to express that in JSON-LD, does
> anyone have any ideas?

The only trick would be to use @vocab but that doesn't work for properties that are aliases of @id. Assuming it would indeed be a property and not set the subject, you could do something like

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


HTH,
Markus


--
Markus Lanthaler
@markuslanthaler
Received on Thursday, 25 August 2016 20:24:54 UTC

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