On 11 January 2017 at 08:44, Grahame Grieve <
[email protected]> wrote:
> >
> > > - how do I know which node is the root node in the json-ld?
> >
> > what you get is a (RDF) graph, and in the general case, several resources
> > are described (cf. for instance the “@graph” in the jsonld). If you’re in
> > the case where you have one “main resource”, described in the jsonld, and
> > if what you want is the URI of this resource (the “@id” of the resource
> at
> > “the top” of the json tree), then you may try to list resources in the
> RDF
> > that are not object of any triple (but I think that other resources may
> > also be in this case, for instance if there are “reverse properties”)
> >
>
> hm. is it just me who thinks that the root node has significance? I'm
> surprised that this isn't something that comes up a lot.
>
> (yes, in some circumstances, it's the single resource that is not an
> object, but as you scale up that becomes more and more restrictive)
>
Yes; since an RDF graph isn't hierarchical, there's no such as thing as a
"root" resource. If you want to identify one, you can do so using RDF
statements to describe the graph itself, e.g. here's a graph which
identifies a particular person as the foaf:primaryTopic of the graph:
{
"@context": {
"Person": "http://xmlns.com/foaf/0.1/Person",
"name": "http://xmlns.com/foaf/0.1/name",
"primaryTopic": "http://xmlns.com/foaf/0.1/primaryTopic"
},
"@id": "http://example.com/example-graph",
"@graph":
[
{
"@id": "http://example.com/example-graph",
"primaryTopic": "http://example.com/Grahame%20Grieve"
},
{
"@id": "http://example.com/Grahame%20Grieve",
"@type": "Person",
"name": "Grahame Grieve"
}
]
}