- From: Markus Lanthaler <markus.lanthaler@gmx.net>
- Date: Tue, 12 Nov 2013 15:17:31 +0100
- To: "'Linked JSON'" <public-linked-json@w3.org>
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