RE: Typing a Collection of Nodes

On Tuesday, November 12, 2013 2:54 PM, Thomas Hoppe wrote:
> Hi,
> is there a way to conveniently type (@type) a collection of nodes?
> This could be useful to prevent repeated @type properties in cases like
> this:
> 
> [
>    {
>      "@context": ...,
>      "@id": "http://manu.sporny.org/about#manu",
>      "@type": "foaf:Person",
>      "name": "Manu Sporny",
>      "knows": "http://greggkellogg.net/foaf#me"
>    },
>    {
>      "@context": ...,
>      "@id": "http://greggkellogg.net/foaf#me",
>      "@type": "foaf:Person",
>      "name": "Gregg Kellogg",
>      "knows": "http://manu.sporny.org/about#manu"
>    }
> ]
> 
> 
> I thought about using @reverse but I think it is not possible to use it
> with JSON-LD keywords.

If you really want, you could use rdf:type and @reverse as follows

{
  "@context": {
    ...
    "instances": { "@reverse": "rdf:type" }
  },
  "@id": "foaf:Person",
  "instances": [
     {
       "@id": "http://manu.sporny.org/about#manu",
       "name": "Manu Sporny",
       "knows": "http://greggkellogg.net/foaf#me"
     },
     {
       "@id": "http://greggkellogg.net/foaf#me",
       "name": "Gregg Kellogg",
       "knows": "http://manu.sporny.org/about#manu"
     }
  ]
}

... but it looks rather strange IMO. An alternative would be to rely on
entailment (setting the range of a property to the desired type).


--
Markus Lanthaler
@markuslanthaler

Received on Tuesday, 12 November 2013 14:18:02 UTC