From: Ross Ridge <ross@zooid.guild.org>
Subject: Re: relaynews vs the "threaded" newsreaders
Organization: ZOOiD BBS
Date: Fri, 28 Aug 1992 08:20:12 GMT

geoff@world.std.com (Geoff Collyer) writes:
>Further staring has convinced me that in fact trn wants two distinct
>databases:  a ``presentation menu'' database, sharable with nn and other
>readers, stored per group and containing at least article number, subject and
>author for each message (possibly message-id too); and the link data used
>to generate the trn `hunt the wumpus' diagrams, indexed by article file
>name and yielding the link data and a message-id or history file offset.

I really don't if you can really make that seperation with trn.  With trn
you select entire threads, and those threads are defined by the link data.

>So I think I'm going to skip the intermediate stage I had proposed, and
>go straight to a common adjunct data base.  Does anyone understand what's
>*in* the link data in the trn database?  (I still don't; I think I've got
>a block against `hunt the wumpus' diagrams.)

Well basically they're not squashed dodecahedrons, they're trees.  :-)

I'm not quite sure what you want to know, so please forgive me if
I completely fail to answer your question.  I think the best place
to start is trn's internal data structures. 

This structure is for the list of threads:

	typedef struct Root {
	    struct Root *link; /* the link to next oldest thread */
	    ARTICLE *articles; /* the root of a tree of articles in
				  the thread */
	    SUBJECT *subjects; /* a list subjects in the thread.   */
	    /* ... */
	} ROOT;

Here's the one for the tree of articles:

	typedef struct Article {
	    struct Article *parent, *children, *siblings;
/* These are the basic links of the tree, |parent| is the article that
   this is follow-up to, |children| is a pointer to the oldest article
   that is a follow-up to this article, and |siblings| is a list of
   newer articles that are also follow-ups to the parent.  The normal
   order of reading is this article then the children, then the siblings.
   This is the link data. */

	    struct Subject *subject;
/* The subject of the article.  This points to one of the members of the
   list of subjects for this thread. */

	    struct Author *author;
/* The author of the article, this points to a member of list of authors
   for the current newsgroup  */

	    struct Root *root;
/* the thread that this article belongs to */

	    struct Domain *domain;
	    char *id;
	    struct Article *id_link;
/* these members define the message-id of this article.  It's divdided
   into two parts, the "id" part before the '@' and the "domain" part
   after the '@'.  |domain| is a pointer to member of a list of domains
   for this newsgroup, and |id| is the id part for this article.
   |id_link| is a list of articles sharing the same domain as this one. 
   The |Domain| structure containts a pointer to the article that is
   the start of this list.  Searching for message-id's is done simply,
   first look sequentially through the list of domains and then through
   the list of id's for that domain. */

	    /* ... */
	} ARTICLE;

For reference the |Domain| structure:

	typedef struct Domain {
	    char *name;
	    ARTICLE *ids;
	    struct Domain *link;
	} DOMAIN;

To save space and for clarity I've deleted some members and reordered them
a bit, see "threads.h" for the complete structures.  The database used by
trn parallels these structures, the chief difference is that pointers are
replaced with sequence numbers.  There are special cases for referenced
articles that haven't arrived yet, and for articles that have expired.

							Ross Ridge

-- 
Ross Ridge - The Great HTMU					     l/	 //
								    [OO][oo]
ross@zooid.guild.org						    /()\/()/
uunet.ca!zooid!ross						     db	 //
Newsgroups: news.software.b