w3c / json-ld-syntax

JSON-LD 1.1 Specification
https://w3c.github.io/json-ld-syntax/
Other
112 stars 22 forks source link

Incorrect `foaf` context examples #399

Closed Jym77 closed 2 years ago

Jym77 commented 2 years ago

Several example, e.g. for prefix expansion, use the context "foaf": "http://xmlns.com/foaf/0.1/" but when I go to http://xmlns.com/foaf/0.1/name I get redirected to the top of http://xmlns.com/foaf/spec/ and stays there.

On the other hand, going to http://xmlns.com/foaf/0.1/#term_name redirects to http://xmlns.com/foaf/spec/#term_name which does bring me to the correct definition.

So, should the foaf context use http://xmlns.com/foaf/0.1/#term_ instead of http://xmlns.com/foaf/0.1/? (I may be missing some other sort of redirection happening somewhere).

pchampin commented 2 years ago

The FOAF spec says:

The FOAF vocabulary is identified by the namespace URI 'http://xmlns.com/foaf/0.1/'.

and therefore the JSON-LD examples are correct.

The 3rd principle of Linked Data says:

When someone looks up a URI, provide useful information

which is the case for FOAF IRIs: they redirect you to the full documentation of the FOAF vocabulary, in HTML or RDF depending on content-negotiation.

Arguably, it would be even more useful for a user to be redirected to the specific point of the documentation describing the specific IRI you looked up... but this is not a strict requirement in Linked Data principles.


Now, using http://xmlns.com/foaf/0.1/#term_Person instead of http://xmlns.com/foaf/0.1/Person in your JSON-LD might sound attractive, but it is a bad idea. Granted, it makes it easier on people, who will be redirected directly to the definition of the term. But machines will be completely lost, because they would retrieve an RDF graph, in which they will look for more information about http://xmlns.com/foaf/0.1/#term_Person (is it a class, a property?...) and they will find nothing, because the RDF graph is describing http://xmlns.com/foaf/0.1/Person.

Actually, neither the RDF graph nor the HTML specification give you any useful information about http://xmlns.com/foaf/0.1/#term_Person (they provide information about http://xmlns.com/foaf/0.1/Person), so this would violate the 3rd principle of Linked Data.

Jym77 commented 2 years ago

Thanks for the quick answer. I'm not super fluent with JSON-LD and RDF, so I'm not sure I fully understand all the implications, but I get that this is on purpose and the correct way to do it 😄