- From: Markus Lanthaler <markus.lanthaler@gmx.net>
- Date: Wed, 12 Mar 2014 15:33:00 +0100
- To: <public-linked-json@w3.org>
- Cc: "'Laurence Rowe'" <l@lrowe.co.uk>
Hi Laurence,
On Wednesday, March 12, 2014 4:38 AM, Laurence Rowe wrote:
> Given a json-ld document like the following, is it possible to specify
> a context such that the types and property names get prefixed with
> different base urls?
>
> {
> "@type": ["organism", "item"],
> "@id": "/organisms/human",
> "name": "human",
> "scientific_name": "Homo sapiens",
> "taxon_id": "9606"
> }
Do you mean sothat types use a different base than property names, or that
*types and property names* use a different base than @id?
The former is possible by mapping the terms to different URLs in the context
like so:
{
"@context": {
"organism": "http://example.com/typeBase/organism",
"name": "http://example.org/propBase/name",
...
}
}
The latter can also be realized by using two shortcuts, namely @base and
@yocab:
{
"@context": {
"@vocab": "http://example.com/typePropBase/",
"@base": "http://id.example.org/",
}
}
This context maps your snippet above to
{
"@type": [
"http://example.com/typePropBase/organism",
"http://example.com/typePropBase/item"
],
"@id": "http://id.example.org/organisms/human",
"http://example.com/typePropBase/name": "human",
"http://example.com/typePropBase/scientific_name": "Homo sapiens",
"http://example.com/typePropBase/taxon_id": "9606"
}
Cheers,
Markus
--
Markus Lanthaler
@markuslanthaler
Received on Wednesday, 12 March 2014 14:33:33 UTC