RE: Casting literals as IRIs

It seems you have to use the exact term you are using as attribute name in order to coerce it to an @id in the context.
If you use foaf:knows as attribute name, then your context applies. Since you use the full http://xmlns.com/foaf/0.1/knows url as attribute name, you also have to use the full url in the context.

Hm. Interesting. 

Best,
Dietrich 

Am 17.12.2015 23:54 schrieb Markus Lanthaler <markus.lanthaler@gmx.net>:

Hi Jindřich,


On Thursday, December 17, 2015 11:04 AM, Jindřich Mynarz wrote:
> I found that some services return JSON-LD, in which IRIs are serialized
> as literals. For example, consider the following example:
> 
> {
>   "@id": "http://mynarz.net/#jindrich",
>   "http://xmlns.com/foaf/0.1/knows": [
>      "http://ruben.verborgh.org/#me",
>      "http://richard.cyganiak.de/foaf.rdf#cygri"
>   ]
> }
> 
> The objects of foaf:knows are serialized as literals, even though they
> are IRIs.
> 
> Now, if I want to recover the objects of foaf:knows as IRIs, the
> following context is of no use:
> 
> {
>   "@context": {
>     "foaf": "http://xmlns.com/foaf/0.1/",
>     "foaf:knows": {"@type": "@id"}
>   }
> }

What about this context:

  "@context": {
    "http://xmlns.com/foaf/0.1/knows": { "@type": "@id" }
  }

Result: http://tinyurl.com/hadcx4d


HTH,
Markus


--
Markus Lanthaler
@markuslanthaler

Received on Friday, 18 December 2015 06:58:42 UTC