Implementing a directed acyclical graph with TiddlyWiki5

154 views
Skip to first unread message

James Weaver

unread,
Dec 3, 2013, 9:59:51 AM12/3/13
to tiddl...@googlegroups.com
I want to implement a simple case of a directed acyclic graph [1] with TiddlyWiki5.  Specifically, each node (edge) in the graph can have 0..n children and 0..1 parents.  I don't yet have an understanding of The Way of TiddlyWiki5, so I'd like to get input on the following approach:

- Create a tiddler (perhaps named Taxonomy) that contains
  - an additional field that hold a list of children (by the way, I'm already using the list field, and I'm not sure how add a new field that holds a list to a tiddler)
  - either/or:
    - an additional field that holds a link to a parent, if it has one (by the way, I'm not sure how add a new field that holds a link)
    - a mechanism for linking back to a parent of a tiddler (not sure how to do this)
- Tag this tiddler with $:/tags/ViewTemplate so that all tiddlers in the Wiki have the children field

So, here are my questions:
- Is this the best approach, or is there some other approach that fits TiddlyWiki5 better?
- How can I add fields to a tiddler?
- Is the Taxonomy tiddler described above a "Template" in TiddlyWiki5 parlance?

Thanks for bearing with newbie questions,
Jim


[1] http://en.wikipedia.org/wiki/Directed_acyclic_graph

PMario

unread,
Dec 3, 2013, 1:32:56 PM12/3/13
to tiddl...@googlegroups.com
Hi Jim,

I think what you describe is the standard TW tagging mechanism.

eg:

- if you create a tiddler named "task"  .. and
- several tiddlers eg:
  - "Go to Mordor"
  - "Get the Ring"
- tag those tiddlers as "task"

What you get is a "parent" child relation between "task" = "parent" and "Go .." / "Get .." = "children"

I'm using those examples, because you can find exactly that at http://five.tiddlywiki.com
So you can open it and see the stuff described below.

If you open the tiddler "Go to Mordor" you can see, that it is tagged "task" ...
If you click the "task" pill,
 - You can see all other tiddlers tagged with "task"

If you open the "task" tiddler
 - click the (i) info button
 - open the "Tagging" tab  ... you'll see all tiddlers that are tagged with "task"

IMO the mechanism is, (almost) what you described. ... But I think the implementation is different, to what you expect. ... because

The "tagging" list is created at runtime.
So if you click the "tagging" tab, the TW core searches for all tiddlers that are tagged "task" ... the tiddler named "task" doesn't contain a field "tagging" or in your case "children".

IMO adding "parent" and "children" fields (or RDF tiddlers) can be done. But there is a whole lot of "syncing problems" that will pop up. Every time you rename / create / update / delete / import / export ... a tiddler, you'll need to check all tiddlers and keep them in sync. Exactly at that point you create a "real database" behaviour. ... and databases are kind of complicated, highly optimized beasts. ...

I think a similar usecase was introduced by Leo at a hangout #19 [1].
IMO if we need a real database behaviour, we should use a real database. May be the storage is not so important, but I think the query language to retrive the data is ... and TW is no database, even if it is quite close :)

After the hangout 19 I did stumble upon ArangoDB [2] which imo would be a nice backend for TW5. It supports tiddlers out of the box (key-value store) and it would be possible to create "real" graph indexes with a graph query language.

@Jeremy,
Did you know ArangoDB?

have fun!
mario

[1] http://www.youtube.com/watch?v=wYaFsOzXnPY#t=509
[2] http://www.arangodb.org/













James Weaver

unread,
Dec 3, 2013, 2:39:49 PM12/3/13
to tiddl...@googlegroups.com
Thanks Mario.  A hierarchical structure of tags that you described should work for my purposes.  I'll need to be able to distinguish between a tiddler that is a tag (used for categorization) and a tiddler that isn't a tag (used for content).  I suppose I could do this with a naming convention, as tags are supposed to begin with lower-case, but do you know of other ways?  I could use the "tagging" filter, but if a given tag doesn't happen to be tagging tiddlers at a given moment, it seems that it would indicate that it isn't a tag.  Hope that makes sense.

Thoughts?
Jim

James Weaver

unread,
Dec 3, 2013, 3:51:42 PM12/3/13
to tiddl...@googlegroups.com
I think that I'm answering my own question here:  It seems that a tiddler is only a tag when it is tagging a tiddler; it can't be defined as a tag explicitly.  If this is incorrect, please advise.

Thanks,
Jim Weaver

Jeremy Ruston

unread,
Dec 3, 2013, 4:17:24 PM12/3/13
to TiddlyWiki
Hi Jim

On Tue, Dec 3, 2013 at 8:51 PM, James Weaver <james.l...@gmail.com> wrote:
I think that I'm answering my own question here:  It seems that a tiddler is only a tag when it is tagging a tiddler; it can't be defined as a tag explicitly.  If this is incorrect, please advise.

That's correct.

Tags themselves can be tagged, so you could create tiddlers for all your tags and tag them with the tag "tag". Then you can get a list of tags with [tag[tag]].

Best wishes

Jeremy

 

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Jeremy Ruston

unread,
Dec 3, 2013, 4:22:01 PM12/3/13
to TiddlyWiki
Hi Mario

I haven't come across ArangoDB, looks interesting thanks. It would be great to start experimenting with these things. As I think we've discussed during the hangouts, I think wiki.js could do with a bit of refactoring to make the tiddlers[] hashmap private so that it's easier to substitute a different storage module.

Best wishes

Jeremy


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.

Jim Weaver

unread,
Dec 3, 2013, 4:21:53 PM12/3/13
to tiddl...@googlegroups.com
Nice! Thanks Jeremy and Mario for your help.

Regards,
Jim Weaver
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/GyRqdjGWM0Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages