Path: utzoo!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!well!jef From: jef@well.UUCP (Jef Poskanzer) Newsgroups: news.software.b Subject: Re: What should go in the References: line? Message-ID: <14676@well.UUCP> Date: 21 Nov 89 12:09:41 GMT References: <49816@looking.on.ca> Reply-To: Jef Poskanzer Organization: Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal Lines: 43 Brad, normally I charge $75/hour for advice like this, but since you're being such a dick I'll make an exception. Yes, Usenet is unreliable. Yes, articles arrive out of order or don't arrive at all. That's why you *can't* do it the way you want to. The basic problem with your approach is, what do you do if the "root" arrives late or not at all? And by induction the same problem applies to the rest of the tree. You basic conceptual model of the problem is useless. You have to view it as a database problem. Look at the questions you want to ask, and figure out what kind of database you need to answer them. For instance, one question is: given a current article X and a killed message id Y, is Y an ancestor of X? The database you have designed cannot answer this question in general. It can only answer the question if Y happens to be what you think of as a "root". This is a very bad design. One database that can answer this question correctly is, given a message id, return a list of ancestor message ids. (I apologize to the audience for belaboring the obvious, but Brad seems to need a little hand-holding.) Another question that one might want answered is, given a current article X, what is the immediate parent article? Your database can only answer the less interesting question, what is the closest preceeding article that happens to be somewhere in the same "tree"? The same database mentioned two paragraphs ago can handle this query, assuming the message id lists are returned sorted. And when the question cannot be answered, it can tell you that, instead of lying. In case this slipped by you, Brad, I'll emphasize it. It is better to report a failure when a question cannot be answered than to give an incorrect answer. Then the user can decide whether to ask a more general question or not. Brad, I suggest you take a look at "nn" for a sample implementation of a database derived from netnews. --- Jef Jef Poskanzer jef@well.sf.ca.us {ucbvax, apple, hplabs}!well!jef "How's it goin', eh?"