Talk:RDF JSON Brainstorming
From n² wiki
I am currently using this as the basic structure for rdf associative arrays in PHP. My code also ouputs JSON in this form - with the exception that resources occur under a "resources" key instead of on the same level as prefixes.
eg:
var BIGFOOT_JSON = {
"prefixes": {
"rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs":"http://www.w3.org/2000/01/rdf-schema#",
"foaf":http://xmlns.com/foaf/spec/",
}
"resources":
{
"http://example.com/Kwijibo#me"
{
"foaf:name":[{"value":"Keith Alexander", "type":"literal"}],
"foaf:nick":[{"value":"kwijibo", "type":"literal"}],
},
}
};
I find the following things useful about it in practice:
- Uniformity. However many property values there are, of whatever sort, I can access them in the same way - I don't ned to check if it's an array or a single value.
- easy to find resources - because they are all in the same place, on the same level, identified by their URIs.
- easy to find properties of a resource because they are all under the one key
-- Keith -
I haven't yet done a lot of javascript using it, but so far, seems fine.
Update: except for the prefixes and qnames, which, since they are not defined by the client, are troublesome, rather than helpful.
[edit] Design Goals
I think the prime design goal is to be easy to program with, in (at least), the common web scripting languages. I don't think it's necessary to put the emphasis on javascript, as the same structure and format is also useful to developers working in PHP, Python, Ruby, Perl, etc.
I don't think readability or simplicity to non-RDF developers ought to be design aims at all. I think for RDF/JSON, it is far better to trade readability of the format source (which isn't all that readable anyway) for the readability and efficiency of code that has to use the format.
If making the format less-readable means making code that uses it simpler and more readable, we should do it.
By the same token, I think setting out to appeal to developers unfamiliar with RDF is likely to make the format more complicated and less intuitive for the RDF developer. If we try to make the format comfortable to those more familiar with other paradigms (eg: OO, DOM, relational tables), odds are the similarities will be superficial, and ultimately misleading.
-- Keith

