Bradley P. Allen
Gmail: bradleypallen
Twitter: bradleypallen
Web: bradleypallen.org
Cell: +1 424 634 0870
first let me also thank and congratulate you to this nice spec!
Now I had a look at RFC 4627 which states:
"4. Parsers
A JSON parser transforms a JSON text into another representation. A
JSON parser MUST accept all texts that conform to the JSON grammar.
A JSON parser MAY accept non-JSON forms or extensions."
Now json-ld is an extension of json and any JSON parser may understand
the extension or not. But don't we need a mime-type to describe that we
want a parser which is able to understand json-ld?
Or is the plan to completely replace old JSON with json-ld?
Best,
Fabian
Ok for "application/json" as a first step (let see what happens). At
the very least least one should take care not to reuse the
"application/rdf+json" mimetype that is used by the verbose RDF/JSON
spec [1] that is already deployed in applications such as Apache
Clerezza and RDFQuery [2]
[1] http://n2.talis.com/wiki/RDF_JSON_Specification
[2] http://code.google.com/p/rdfquery/wiki/RdfPlugin
By the way, I think it would be a good idea to contact the RDFQuery
developers to know whether they are interested in adding support for
json-ld to this lib.
--
Olivier
http://twitter.com/ogrisel - http://github.com/ogrisel
I wouldn't say that JSON-LD is an extension of JSON...it's still ordinary JSON.
However, what we're trying to do is provide a way that JSON can be
'interpreted' as RDF. The JSON that can be 'interpreted' will range
from 'plain old JSON' through to JSON that has a bunch of extra clues
in the form of a profile, clearly marked URIs, data types, and so on.
This means that sometimes the JSON that we want to interpret as RDF
will contain nothing that we would recognise as JSON-LD, for example:
{
"name": "Fabian"
}
I think it would be wrong for a document conveying this to have a
different MIME-type. But more than that, it would also be wrong for a
parser to ignore 'plain old JSON' since it may originate from a source
outside of our control, such as a Twitter or Facebook API.
To illustrate, 'plain old JSON' can still be given an RDF
'interpretation', either by adding a JSON-LD context to the object
before processing it:
var obj = {
"name": "Fabian"
};
obj["#"] = { "name": "http://xmlns.com/foaf/0.1/name" };
or by using functions that take a default context as a parameter:
somelibrary.parseJSONLD(
{ "name": "http://xmlns.com/foaf/0.1/name" },
obj
);
This is a made-up function, of course, but it's the kind of thing I
think we'll see in the RDFa API, for example.
So, for all of these reasons, I think JSON-LD is 'just JSON' and the
MIME-type should be set accordingly.
Regards,
Mark
thank you for this detailed explanation. I understand now the point of
JSON-LD and why there is no need for an json+ld mime-type from the
parser syntax point of view.
But what I still don't understand: How does a parser recognize that
the JSON it receives is JSON-LD? The difference lies not in the syntax
but in the semantic how to interpret special keys, like "#". Should a
JSON-LD parser just try to interpret the received JSON in JSON-LD
manner? What is the criteria to recognize JSON-LD if it is not
provided by the mime-type?
Best regards,
Fabian
2010/10/25 Mark Birbeck <mark.b...@gmail.com>:
--
Fabian