5 ms·
"let’s create a graph data model that looks and feels like JSON". This was à stupid idea. N3 is, and has always been, the only readable (and human-editable) se
by lolive 9y ago
"let’s create a graph data model that looks and feels like JSON".
This was à stupid idea.
N3 is, and has always been, the only readable (and human-editable) serialization format for graphs.
N3.parse() can recreate an in-memory graph from it, and provides an API to find a node by id, or all nodes of a given type.
(So your entry points to the graph are your decision, not materialized once and for all by fixed root nodes, like in JSON)
From there, you travel the graph just as you would after a JSON.parse(). I.e people.class.teacher.name. And that's it.
(Think of N3 as a set of JSONs being able to have, in them, references to each other's. And N3.parse() as its API.).
More philosophically, JSON-LD made the same mistake as RDF/XML. It chose the trending data exchange, and bastardized N3 to fit into it.
But N3 is indeed a superset of both JSON or XML (or whatever tree-oriented data exchange structure).
I will also add that N3.stringify() is quite easy to implement.
So imho, we should promote N3 and its API.
- TheAceOfHearts 9y agoJust gonna mention that N3 stands for Notation3 [0]. I'd never heard of it before, and just googling for N3 doesn't lead to any direct results. My immediate reaction from reading about N3 is that it doesn't seem very easily approachable, especially when compared to JSON. If I type "json" on Google, the first result [1] is a fairly human-friendly spec with a huge list of implementations at the bottom. If I then type "json example" on Google, the first result takes me to a page with lots of examples [2] of JSON side-by-side with XML. In comparison, looking up Notation3 takes me to a w3 spec page for which my first reaction is to say "tl;dr", and looking up examples takes me to two pages [3] [4] which fail to immediately clarify anything. [0] https://www.w3.org/TeamSubmission/n3/ https://www.w3.org/TeamSubmission/n3/ [1] http://www.json.org http://www.json.org [2] http://www.json.org/example.html http://www.json.org/example.html [3] https://www.w3.org/2000/10/swap/Examples.html https://www.w3.org/2000/10/swap/Examples.html [4] https://www.w3.org/2000/10/swap/Primer.html https://www.w3.org/2000/10/swap/Primer.html
- lolive 9y agoN3 in a nutshell is: ----------------------------------- 1) an object has an id and some types. Both are prepended with a ':' + an object definition ends with a '.' For example: :teacher1 a :Teacher. 2) an object has property values. Each property name is prepended with a ':'. A property value of type string is surrounded with '"""'. A property value of type integer is as-is. Several values for the same property are separated by ','. Properties are separated by ";" For example: :teacher1 :firstNames """John""","""Michael"""; :lastName """Doe""". 3) Objects properties are properties whose value is another object. Such an object property value is simply the id of the referenced object. For example: :teacher1 :studiedAt :Yale, :Stanford, :Miskatonic. 4) Your object definitions may be split into multiple parts. For example: :teacher1 a :Teacher. :teacher1 :firstNames """John""","""Michael"""; :lastName """Doe""". :teacher1 :studiedAt :Yale, :Stanford, :Miskatonic. :Miskatonic a :University. :Miskatonic :locatedIn :Arkham; :name """Miskatonic University""". :Arkham a :City. :Arkham :famousTeacher :teacher1. ----------------------------------- Nothing especially difficult, in my humble opinion. The great benefit of N3 (and the Semantic Web in general) is that the object definitions can come from separate datasets and be merged into a single graph, because all UUIDs are aligned in the Semantic Web.
- lolive 9y agoNote: This is a completely optional feature of N3: N3 can also express rules to apply upon data. For example, add this to the above definition: { ?x :studiedAt ?y } => { ?y a :EducationalInstitution }. and that infers the following object definitions: :Yale a :EducationalInstitution. :Stanford a :EducationalInstitution. :Miskatonic a :EducationalInstitution.
- ape4 9y agoThe triple double quotes are horrible.
- apk-d 9y agoOh god, my eyes are completely refusing to count these
- yjftsjthsd-h 9y ago> This was à stupid idea. Sorry, but I cant figure this out. Was "à" a typo, and if so what kind of keyboard are you using that would make that easy to write by accident?