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

Hi James, Markus,

Thank you for the answers, both work for some of the simple case, but 
not for the more complicated cases in uniprot :(

I have tried various ways to cleanly implement both in our code but have 
not succeeded.

For now I have opened an issue at 
https://github.com/json-ld/json-ld.org/issues/428. That I hope will be 
considered for JSON-LD 1.1.

Regards,
Jerven





On 01/08/16 13:27, james anderson wrote:
> good morning;
>
> i would have thought that it ought to be possible to nest the context
> within the context, but the example which associates a context with a
> member for language properties (6.9 String Internationalization
> <http://www.w3.org/TR/json-ld/#string-internationalization>) associates
> the context with the member rather rather than the top-level context.
> this seems to make the entire mechanism lest than optimal, but the
> following alternative did work in the playground.
>
> {
>   "@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": {
>     "@context": {
>         "@base": "http://purl.uniprot.org/taxonomy/"
>       },
>     "id": "9606",
>     "name": "Human"
>   }
> }
>
>> On 2016-07-29, at 09:31, Jerven Tjalling Bolleman
>> <jerven.bolleman@sib.swiss <mailto:jerven.bolleman@sib.swiss>> wrote:
>>
>> Dear JSON-LD developers,
>>
>> After a very long hiatus I have some time to improve the UniProt
>> RDF/JSON-LD
>> serialisation.
>>
>> 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?
>>
>> 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> .
>>
>> Would love to hear suggestions.
>>
>> In any case our JSON-LD will look a lot better soon (september 9th).
>>
>>
>> Regards,
>> Jerven
>> --
>> -------------------------------------------------------------------
>> Jerven Bolleman                        Jerven.Bolleman@sib.swiss
>> <mailto:Jerven.Bolleman@sib.swiss>
>> SIB Swiss Institute of Bioinformatics  Tel: +41 (0)22 379 58 85
>> CMU, rue Michel Servet 1               Fax: +41 (0)22 379 58 58
>> 1211 Geneve 4,
>> Switzerland     www.sib.swiss <http://www.sib.swiss> - www.uniprot.org
>> <http://www.uniprot.org>
>> Follow us at https://twitter.com/#!/uniprot
>> -------------------------------------------------------------------
>>
>>
>
>
>
> ---
> james anderson | james@dydra.com <mailto:james@dydra.com> | http://dydra.com
>
>
>
>
>

-- 
-------------------------------------------------------------------
Jerven Bolleman                        Jerven.Bolleman@sib.swiss
SIB Swiss Institute of Bioinformatics  Tel: +41 (0)22 379 58 85
CMU, rue Michel Servet 1               Fax: +41 (0)22 379 58 58
1211 Geneve 4,
Switzerland     www.sib.swiss - www.uniprot.org
Follow us at https://twitter.com/#!/uniprot
-------------------------------------------------------------------

Received on Friday, 30 September 2016 08:01:33 UTC