- From: Markus Sabadello <markus.sabadello@gmail.com>
- Date: Sat, 12 May 2012 12:40:45 +0200
- To: Michiel de Jong <michiel@unhosted.org>
- Cc: public-rww@w3.org
- Message-ID: <CAJF45PTNq1kWJ4eVWGXonPWURQTFpB54dg7YutcFvbYdL-nZcw@mail.gmail.com>
Hey Michiel, Interesting, so this would basically be an alternative to the RDF data model or other semantic data models, right? I think it's great, but here are some ideas: * It took me a while to figure out what you meant by "hash". First, I thought it would mean that the value of that attribute is a cryptographic hash of something. Only then I realized that you meant hash in the sense of e.g. Perl, i.e. an associative array. Maybe a better word would be "map" ? * In many data models I am familiar with, there is a distinction between "relations" (to other things) and "literals" (strings, scalars, booleans, etc). But I kind of like how you say everything is a "relation" between "things". * I think you use the word "statement" ambiguously. First, you say we can describe the real world as a set of "statements", each one of which contains a "relation" between "things". But then later you use the word "statement" to refer to boolean objects. * Instead of "document", why not just say "string"? * I don't think you ever mention the notation for a document/string that is not an encoding of an object. E.g. how would you express that my first name is "Markus"? Would that be what you call human-readable language ("h") ? * Your use of the words "thing", "object" and "variable" was also a bit confusing to me, but only when I read it first, at the second time it all made sense :) Anyway, I think it's a great approach. I guess terminology is always a big challenge when defining data models. The next step would probably be to define operations on the data! Markus -- Project Danube: http://projectdanube.org Personal Data Ecosystem Consortium: http://personaldataecosystem.org/ On Sat, May 12, 2012 at 11:40 AM, Michiel de Jong <michiel@unhosted.org>wrote: > read-write web turns the web from a world wide "book" into a world > wide "software program". this means we can now interact with it not > only to consume information, but also to push buttons that record > (editing the web), as well as effectuate (APIs on the internet of > things), changes in the real world things described by the web's > documents. > > i've been thinking about how to model this in a way that reduces the > number of potential bugs ('word jokes'). if you're subscribed to the > public-tag cg, you may have seen my thread there about distinguishing > various types of URLs in our software. this train of thought has lead > to this sunny Saturday morning coming up with an Apps Hungarian > notation for local variables in javascript applications that > manipulate the read-write web, as well as for attribute names in > machine-readable documents on the web. Even if you don't jump to adopt > it, it might be an interesting straw man argument about how we should > name things in linked data in general, and on the read-write web > especially. > > The only thing i love more than computer science is metaphysics, so > let's start with some of that: > The way we will model the real world today is as a collection of > objects (our variables; not necessarily physical objects, but any > 'thing') that have certain relations to each other (the relations are > what makes for our actual data). We can describe the real world with > an array of statements, each of which says that thing X has relation R > to thing Y. Since objects are only variables, to represent them we > need to talk about how they relate to other objects. That's why in > computer programs, objects are represented as lists of relations to > other objects. so if X is the 'parent' of Y (without specifying > further what that means), then we can do: > > var Y; > var X = { > parentOf: Y > }; > > That's the basis of our metaphysics here. Now we can make it a bit > richer, by saying that an object can be zero or one of the following: > document (string), statement (boolean), scalar (number), array. > > If an object is a document, then it has contents (which may be the > empty string). If a thing is a statement, then it has a truth value > (which may be undecided or unknown in the current world view)). If a > thing is a scalar then it has a numeric value. If a thing is an array, > then it has zero or more element objects in it. Simple, right? > > Let's add one more useful data structure that computer scientists like > to use when describing the world: the tree. A tree has a root, nodes, > and leaves. The root points to nodes or leaves, nodes point to nodes > or leaves, and the leaves are objects. Actually an array is a special > kind of tree, but let's treat them separately because of how arrays > are used in software. > > To talk more about representation, we already saw that an object can > be represented by a variable, but it can also be represented by a > document, using an encoding. Example encodings are JSON, XML, and > human-readable language. Normally a document is either read-only or > read-writable for the current user. This affects what we can do with > this document in a 'read-write app' context. We also allow documents > to be append-only, like printer queues. In that case we call them > virtual documents. > > Now we can introduce our Hungarian notation to deal with these > documents, statements, scalars and arrays, as well as with plain > objects. > > attributes hash of the object: > _ If a variable holds a hash of attributes of object 'thing', then > we give this variable the name 'thing' (camel case). > > document describing another object: > j If a variable holds the contents of a document that describes > object 'Thing' using JSON, then we prepend a 'j', and use camel-case, > so: jThing > x same for xml > h same for human-readable language > > virtual documents forming a way to contact another object: > c for instance, a mailbox or a printer queue on the internet of > things is an appendable document (this is a bit abstract, but it helps > simplify our model of the web and the APIs that live there if we think > of message queues as just documents). if you have a variable in a > program where you accumulate messages for Person, but that does not, > as a variable, represent that person, then you would call this > variable cPerson. > > boolean describing the truth value of a statement: > b if a variable holds a boolean describing whether 'statement' is > true in the current world view, then we call this variable bStatement > > number describing the value of a scalar: > n if a variable holds a numeric value representing the value of > 'scalar' in the current world view, then we call this variable nScalar > > data structure containing objects: > a if a variable holds an array of objects, then we can name that > variable aObject. for example a variable holding an array of 'author' > objects would be called aAuthor. > t if a variable holds a tree (arrays, nested recursively), then we > can name it after its leaves, so if the leaves are authors, then we > call the tree variable tAuthor. > > web presence: > p if a variable holds the URL of document 'document' then it would > be confusing to call that variable 'document' (especially because both > documents and URLs are strings). so then it's better to call that > variable pDocument. > > So that's the Hungarian notation that i'm proposing for the read-write web: > - no prefix for attribut hashes, > - j,x,h for strings describing objects > - c for 'virtual documents' that are contact interfaces of objects > - b for truth value of a statement > - n for numeric value of a scalar combinations > - a,t for composite objects > - p for strings (addresses) describing where to obtain/edit documents > or where to interact with virtual documents > > So we could make combinations obviously, to get more powerful naming > schemes. > > For instance, applying Hungarian notation to both variable names and > attribute names, how would you Hungarianize this: > > var book = { > authorMailboxUrl = 'mailto:user@host' > }; > > The variable name 'book' is OK because the variable is an attribute > hash of a book. But obviously, the string 'mailto:user@host' is not > an attribute hash of the author. It's an address at which we can > interact with the mailbox of the author. That's why this attribute > name is so long - 'authorMailboxUrl' - a really cumbersome attribute > name. So what a lot of (IMO sloppy) programmers would do is just call > the attribute 'author' and then say 'well, programmers that come after > me will know what i mean'. But luckily, we no longer have to be so > sloppy, and can now abbreviate it, first to 'pAuthorMailbox' and then > even to 'pcAuthor'. > > That's my proposal for using Hungarian notation in linked data. i > think it's absolutely necessary to introduce this. i'm going to start > using it myself. It will probably change as i start using it, this is > just a first draft. Let me know what you think! > > > Cheers, > Michiel > >
Received on Saturday, 12 May 2012 10:41:16 UTC