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

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