Pamela is right, it's easy to serialise/deserialize JSON strings, the browsers that support Wave have native JSON support.
Simply use JSON.parse(jsonString) and JSON.stringify(object) As Davis says, it's probably a good idea to store the nodes and structure of the tree separately to avoid conflicts. Since a tree is a simplified form of a graph, you can store it like a lot of graph implementations do, as a set of vertices and a set of edges. The one user can edit the structure and another the fields of a node and avoid *some* conflicts Cheers Benjamin On Dec 9, 5:20 pm, "Jiang, Guoqian, Ph.D." <[email protected]> wrote: > Thank you very much for your suggestion and this is very helpful, > > I think DataBlip is a great idea. Let us assume that each node of a tree > structure is represented as a wave blip and the entire tree will be a > wavelet. We just need a UI rendering layer (say a Gadget) that can > access the data blip. The curation of the tree will just mimic the blip > creating, editing or deleting. In this way, we do not need worry about > the conflicts among collaborators as we can leverage built-in wave > feature. > > I think the Google Wave API can transform a tree structure into a > wavelet and its blips but I am not sure if there is a way that a UI > layer in a Gadget can access and communicate with the blips, > > Any idea? > > Thanks, > > -Guoqian > > ________________________________ > > From: [email protected] > [mailto:[email protected]] On Behalf Of David Nesting > Sent: Wednesday, December 09, 2009 10:31 AM > To: [email protected] > Subject: Re: [Google Wave APIs] Google Wave Gadget persistence layer > > On Tue, Dec 8, 2009 at 10:36 AM, Jiang, Guoqian, Ph.D. > > <[email protected]> wrote: > > My use case is that I want to reprensent a tree structure in a > google wave gadget and a group will work collaboratively on curating the > tree structure e.g. editing a node, adding a sub node or deleting a > node. > > Assuming the tree structure is based on a json object, my > question is whether there is a persistence layer API to store and > restore a json object, > > You can serialize the JSON to a text string, and store that text string, > as Pamela says, but I would not recommend serializing the entire tree in > this way. If two people are editing different parts of the tree at the > same time, one person's edits could revert the edits done by the other > person, if they are made close together. If you can come up with a > scheme to represent your tree in as granular a manner as possible, that > would work best, possibly by doing something like: > > ...submitDelta({'tree.0.1.0'}, value) # Sets the first child of the > second child of the first child of the tree > > By doing this, you're reinventing some of what Wave automatically does > for blip content. It's a shame there isn't a way to better leverage > that (e.g. a DataBlip that you control the mutations to and presentation > of). > > David > > -- > > You received this message because you are subscribed to the Google > Groups "Google Wave API" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/google-wave-api?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en.
