Outline as a hierarchy of database queries
Not logged in


I would like to make the parent/child relationships of the outline much more flexible and user definable. The user will have the ability to add, modify and delete property/value pairs of any outline nodes. Queries can be made on these properties to get a list of matching nodes. These queries can then be attached to a node in order to define which nodes are children of that node. With this functionality, nodes will be able to appear in multiple places in the outline. By default the queries will be setup so the outline behaves like a typical tree structure.

XML XPath as the database/query system?

XML stores tree-structured data and XPath is a syntax used to select portions of such data. Seems like this would be a natural fit for what I want to do. Since the syntax is meant for tree-structured data, it will likely be easier to work with than what I would come up with using prolog.

Everything I know about XPath (which isn't much), I learned from the tutorial at 1


Prolog as the database?

My intial idea for implementing this is to use Prolog as the query/database. A parent/child relationship can be defined using either facts or rules. When a fact is used, the parent/child relationship will be explicit. For example, node n2 can be explicitly assigned as a child of node n1 with the Prolog fact


When a rule is used the relationship is more flexible. For example, node n1 can be made the parent of all nodes with the property project=tkoutline by declaring the Prolog rule


This rule would match node n2 if there were a fact in the database declaring


In order to discover the children of a node n1, the prolog query


can be executed and the variable Child will be bound in succession to each child node. When a property is added/modified/deleted for a node, the parents of this node will need to be recomputed with the following query:


I have written a very rough, Initial prototype for an outline as a database to see if I find this concept useful.

Options for accessing prolog from Tcl:

The web page at http://jeans.studentenweb.org/tcltk/conn.html contains a binding between SWI Prolog 2 and Tcl/Tk. It appears this software embeds Tcl/Tk in Prolog which is the reverse of what I want. I want to be able to access prolog from Tcl.

The interface to prolog should be simple enough that it won't be that hard to write some Tcl code to access the interpreter via a pipe. For simple cases all I should need is the following:

I have the initial prolog code for Embedding a standalone prolog interperter in Tcl written.

Similar software:

The ideas of using an outline as a hierarchy of database queries appears to be similar to the following software:

Lotus Agenda is available for free download (see the above links). However, a 720Kb formmatted disk is required! I don't have any of those, so I've never seen agenda in action.

[bad-link: You can tape over the second pin hole on a 1.44 disk and then format it to 720KB. Covering the second hole makes the drive think that the floppy is DD instead of HD.</p><p>-Edwin King ] You can tape over the second pin hole on a 1.44 disk and then format it to 720KB. Covering the second hole makes the drive think that the floppy is DD instead of HD.-Edwin King

Brian Theado - Thanks for the tip! I'll have to try that sometime. Since I wrote the above, I found a 'preinstalled' version available for download at http://www.palmtop.net/ (search for agenda). It is a standard zip file. On a related note, there is a new, open source project named Chandler at http://www.osafoundation.org that is supposed to be implemented in the spirit of Agenda.