Thread View: news.software.nntp
4 messages
4 total messages
Started by J.B. Nicholson-Owens
Sun, 07 Jul 1996 00:00
Suggested API for querying Usenet servers
Author: J.B. Nicholson-Owens
Date: Sun, 07 Jul 1996 00:00
Date: Sun, 07 Jul 1996 00:00
186 lines
8642 bytes
8642 bytes
I took the SELECT command from SQL and substituted `newsgroups' and
`headers' for references to `tables' and `columns'. Also, I tried to keep
things simple and not tie features to the capabilities of a relational
database (no joins, no newsgroup aliasing, no implicit functions like
count() and avg(), and no nested selects (if you want nested if-thens,
you'll have to combine this search command set with something fancier from
your news client). Keep in mind, this is a first attempt at something that
looks and feels like SQL syntactically but is tailored for Usenet. I'm not
trying to invent a whole new language, just some one-shot searching commands
that (with a minimal amount of support) can be typed into a dialog panel in
some news client. All the returned records are specified by the query.
If you're familiar with mSQL and its subset of ANSI SQL (its SELECT command,
in particular), this should look familiar. I purposefully picked something
that was small and not terribly complex. Looking at the SELECT command:
SELECT <header>[, <header>...] FROM <newsgroup>[, <newsgroup>...]
[WHERE <condition>...]
[ORDER BY <header> [DESCENDING][, <header> [DESCENDING]...]]
Keywords need not be in all caps as shown nor do they need to be in any
particular layout (I'm laying them out with the hanging indent just to make
it legible here). The whole query could be given on one line if you want.
``[]'' denotes optional arguments, ``<>'' denotes required arguments.
``...'' denotes repetition of the previous required or optional construct.
<header>
Can be a single header or list of Usenet article headers separated with
commas and an optional space. The specified headers need not exist in all
articles searched. You can ORDER BY any headers you want, not just a
subset of the headers you SELECTed (this may cause news servers to do two
actions to complete a search -- first, find relevant articles, and second,
sort them).
There are some pseudo-headers to consider, headers that are not currently
used in Usenet articles but are needed for searching purposes:
``article-body'' to search in the body of an article.
``e-mail-address'' to search in the e-mail address part of the From:
header.
``real-name'' to search in the real name part of the From:
header.
``article-number'' to search based on article numbers.
If you need to refer to a header called `real-name', use a leading
backslash (`\real-name') (see the examples below). I've hopefully
picked unusual but intuitive names for these pseudo-headers.
<newsgroup>
Can be any single newsgroup, list of newsgroups or wildmat string that
matches many newsgroups. Wildmat matches use ``?'' for any single
character and ``*'' for 0 or more characters.
<condition>
Is true for any matching article. Conditions are case insensitive and of
the form:
<header> [=|<|>|<>] <value> [AND | OR ]
A value can use wildmat characters only in strings. Greater than (>) and
less than (>) can be used only for numeric and date comparisons.
You can string together as many AND and OR clauses as you want in the
WHERE section. We should also let users use parentheses to force a
particular interpretation of the AND and OR clauses.
ORDER BY
Sorts the resulting articles by the named headers in ascending order
(default) or descending order if the ``DESCENDING'' keyword is stated.
Each sort criteria can be sorted in ascending or descending order.
When two or more sort headers are listed, the final result is sorted first
by the first named header, then (if multiple articles have the same value
for the header first used for sorting) those (and only those articles) are
sorted by the second named header and so on for every other header
thereafter.
DESCENDING refers to the sorting order of the resultant articles. This
keyword means something different for each type of header:
Type DESCENDING order
---------- -------------------------
Numeric [high end of range], 999, 998, 997, 996, ..., [low end of range]
String Z, Y, X, ..., A (perhaps a reverse ASCII will be fine here?)
Date ..., [tomorrow], [today], [yesterday], [day before yesterday], ...
Response codes: (more appropriate choices should come with discussion)
Using RFC-977-like response codes:
280 article(s) retreived - results follow.
380 query correct so far, send the rest of it.
480 query correct but couldn't be performed for some reason.
481 query correct but processing requires too much CPU time, partial
results follow.
580 query unimplemented, incorrect or a there was a serious program error.
581 query syntax is incorrect.
582 query explicitly includes newsgroups that don't exist at this server.
583 query explicitly includes distribution keywords that don't exist at
this server.
Here are some contrived search examples:
SELECT subject, date, article-body FROM news.*
WHERE real-name = Pat AND x-newsreader = 'SmartBase 2.1 Gold'
ORDER BY date DESCENDING, subject
This returns the Subject:, Date: and article bodies of all the articles in
news.* newsgroups written by someone with `Pat' in their real name field
using the `SmartBase 2.1 Gold' software. The returned set of articles are
sorted by date. If there are any two articles with the same date, those
articles are sorted in place by subject.
Example: ``Show me the entire content of all the articles written by
pat@patco.com between April 3, 1995 and December 12, 1995. Sort
the results by date, newest to oldest.''
SELECT * FROM *
WHERE from contains pat@patco.com
AND date > 19950403*
AND date < 19951212*
ORDER BY date DESCENDING
{This date construction needs work. It was something I used off the top of
my head -- YYYYMMDDHHMMSS where all times are either in GMT using a 24-hour
clock. The use of the asterisk is context sensitive in my made-up example;
here, it means match any hour, minute and second.}
Example: ``In the alt.tv.real-world newsgroup, I would like to see the
subject and content of any post written by Neil.''
SELECT subject, article-body FROM alt.tv.real-world
WHERE real-name = Neil
Example: ``List the message-Ids of all the articles written after December
1, 1994.''
SELECT message-id FROM *
WHERE date > 19941201
SELECT subject, date, from:, reply-to, article-body FROM *car*
Example: ``Show me all the articles that did not start threads.'' (articles
with References: headers are followups to something, so just show those)
SELECT * FROM *
WHERE references contains *
Example: (NNTP commands without response codes)
``ARTICLE <slrn4ts446.i3o.jbn@mystery-train.cu-online.com>''
SELECT * FROM *
WHERE message-id = <slrn4ts446.i3o.jbn@mystery-train.cu-online.com>
Since there is only one article with that message-id, this search should
return only one article.
Example: (searching on headers with the same name as pseudo-headers)
SELECT subject, date, article-body FROM *
WHERE \e-mail-address = abc@def.ghi.org AND \article-body = '-- '
This returns the subject, date and article bodies of articles where the
e-mail part of the From: header is abc@def.ghi.org and there are
sigdashes. The quotes around the sigdashes insure the space is taken as
part of the search.
There are undoubtedly tons of problems with this, but in the abstract it
seems to me like a good thing and I hope this suggestion is taken in the
spirit of good will with which it is intended. I am not suggesting this
should be adopted as-is without prior discussion. I'm suggesting we start
talking about our needs and draft something to meet those needs.
--
Due to local news server and feed problems, I might not see all followups.
Re: Suggested API for querying Usenet servers
Author: Mary Conner
Date: Sun, 07 Jul 1996 00:00
Date: Sun, 07 Jul 1996 00:00
72 lines
4194 bytes
4194 bytes
In article <slrn4u0au3.sj4.jbn@mystery-train.cu-online.com>, J.B. Nicholson-Owens <jbn@mystery-train.cu-online.com> wrote: >Keep in mind, this is a first attempt at something that >looks and feels like SQL syntactically but is tailored for Usenet. A darn good first draft too. I have some suggestions. :) > SELECT <header>[, <header>...] FROM <newsgroup>[, <newsgroup>...] > [WHERE <condition>...] > [ORDER BY <header> [DESCENDING][, <header> [DESCENDING]...]] Since Newsgroups: is just another header, the FROM part is strictly not necessary, but I can see the usefulness in making the search more efficient by making sure the server only searches in certain directories. Perhaps make it impossible to specify the Newsgroups: header on the left hand side in the WHERE clause? Otherwise I can see some idiot newsreader writer implementing their searching like SELECT foo FROM * (WHERE newsgroups=rec.humor AND from=bozo@clown.com), which would really put a strain on servers unless they are made smarter than they have to be. My personal preference would be to not do any sorting in the server itself and let client software handle it. A means to easily invert the select (i.e. an exclusion instead of a selection) might be a good feature. Since I've only used a superset of SQL, I am not sure if the NOT(<condition>) construct is allowed in strict SQL. From the point of view of a newsreader, I do not see too much use being got out of being able to select which "headers" are returned. I see client software wanting one of three things returned, and rarely if ever would want anything else. Those three things are "entire article", "message-id", and "article number". In fact, given the tendency for GUI newsreader authors to simply neglect to show users *any* headers, I'd hesitate to do anything that would encourage this practice. However, it is possible that this could be useful in server to server communications, such as negotiating which headers the feeder should supply so that the feedee can decide which articles to accept and which to reject. I'll have to think about this some more. For my own work the things that I am most concerned with are the pattern matching specifications. Full reg-exp searches are a necessity, and it would be extremely nice to be able to specify that idiotic spam that went around where the spammer used the last three characters of the newsgroup name as part of the From: and the Subject: of the posting, obviously in an attempt to defeat both killfiles and the spam cancellers. I'm extremely leary of making CONTAINS so easy to use, since searches that are pegged to either the start or the end of a string are far more efficient. I'd prefer to require syntax like email-address=*@blarg.com*, since it would be more likely that the user would then use *@blarg.com instead of contains(blarg.com). I can see it useful to have a special construct to be able to specify original articles or followups in a subject search without having to use a contains. For example, in one group, I have to have both ^OT and ^Re: OT in my killfile because for whatever reason the group decided on OT to key certain articles, and OT is too common a string to simply specify as a generic killfile entry. If I could simply have some way to say, "I don't care if it has a Re: in front, but it has to start the actual subject", life would be simpler. Total wishlist item, I know, but hey, we're dreaming here, aren't we? :) -- Mary Conner trif@serv.net
Re: Suggested API for querying Usenet servers
Author: Bruce Becker
Date: Mon, 05 Aug 1996 00:00
Date: Mon, 05 Aug 1996 00:00
81 lines
4758 bytes
4758 bytes
In article <slrn50aran.6pm.jbn@mystery-train.cu-online.com>, J.B. Nicholson-Owens <jbn@mystery-train.cu-online.com> wrote: | |Disadvantages: Soundex is primarily for English speakers. I don't think it |recognizes any characters other than the 26 letters of the alphabet English |speakers use. This will not work well for non-English newsgroups. However, |if there is an international Soundex perhaps this idea could still work (I'm |not sure what exactly an international Soundex would look like or how it |would work, but I hope I've conveyed the vague idea of what I'm aiming for). |I would be interested in offering this header strictly as an experiment |because I'm interested to see how useful this phonetic search would be but |at the same time I'm hesitant because I don't want to promote an |English-only Usenet. A Soundex mapping for different languages is probably required - perhaps it could be linked to ISO-8859 to start. Mapping to non-phonetic orthographies is more problematic, although the base concept of error locus as an analogy to mis-spelling might be developed for such languages (probably this has been done for many) |(2) The best keywords for an article are chosen by the person posting that |article, unfortunately too few users use the Keywords: header. Since we |don't have the technology to let the computer comprehend an article and |prepare a sensible list of keywords, perhaps we should consider scanning the |article body for "interesting" words, using a subset of them as the default |for the Keywords: header. | |It would work something like this--you prepare an article without a |Keywords: header and post it. Your posting software (or the server) scans |the body of your article plus the content of the Subject: and Summary: |headers for uncommon words by comparing all the words to a list of known |"uninteresting" words. An English list would include Re:, and, or, if, but, |some, for, each, etc. The words not mentioned in this list would be deemed |"interesting" words and sorted by length and number of occurrences. The |most frequently occurring "interesting" words are counted and if they are |few in number, they are used as the basis of a Keywords: header. The user |is prompted with this list and encouraged to make appropriate changes (which |might include scrapping the entry altogether and choosing to have no |Keywords: header at all). | |Obviously, certain groups will need to be excluded from certain aspects of |this search (there's no point in searching the body of posts to binary |newsgroups, for instance) and multiple lists of "uninteresting" words will |be needed for different languages, but I don't think this poses a |significant problem. The correlation of frequency of occurrence is one dimension - the global frequency is another, so words that are common like "and", "the", etc. would have very little weight, whereas words such as "nntp" or "3l33t" (8^) would be weighted highly due to their rarity. Weightings for sub-languages such as medical or rap might vary for a given word in a given context. Work on spelling dictionaries may apply both here & to the Soundex issues above. Note that each language or language group is likely to have its own specific requirements, so the best one can probably hope for is to start to rigorously identify the issues & track & help coordinate the specific solutions as they arise. This is a lengthy process since it will eventually need bodies such as ISO to effectively promulgate useful solutions; the work you do now might be structured to keep such issues in mind at least so as to have a long term coherent growth path... -- ,u, Bruce Becker Toronto, Ontario 1 416 699 1868 a /i/ Internet: bdb@gts.org Uucp: ...!gts!bdb `\o\-e "The Gates Motel - users check in but they never check out" _< /_ - Windfall 95
Re: Suggested API for querying Usenet servers
Author: J.B. Nicholson-Owens
Date: Mon, 05 Aug 1996 00:00
Date: Mon, 05 Aug 1996 00:00
176 lines
10255 bytes
10255 bytes
Before I get into replying, I should note that I've had some changes of heart since I wrote that proposed search API. I'll get into the ideas at the end of my response, but much of what's here shouldn't need to change radically. On 7 Jul 1996 23:17:41 -0700, Mary Conner <trif@serv.net> wrote: > Since Newsgroups: is just another header, the FROM part is strictly > not necessary, but I can see the usefulness in making the search more > efficient by making sure the server only searches in certain > directories. Actually, "search[ing] in certain directories" is an implementation detail I'd rather keep out of any syntax specification (and out of my thoughts when dreaming up worthwhile API changes) since that makes it harder for new server developers to implement some or all of this API. As for the "FROM" keyword, I think you're right and "FROM" has been dropped entirely. > My personal preference would be to not do any sorting in the server > itself and let client software handle it. Unfortunately, the client might not be able to sort data unless the data to sort on is returned. I've responded to the corollary to this--what to return--below. Just as in a relational database, the returned data might not have the information necessary to sort the items. > A means to easily invert the select (i.e. an exclusion instead of a selection) > might be a good feature. Since I've only used a superset of SQL, I am not > sure if the NOT(<condition>) construct is allowed in strict SQL. What query (with this syntax) that uses NOT(<condition>) can't be specified with "<>"? > From the point of view of a newsreader, I do not see too much use > being got out of being able to select which "headers" are returned. Currently, that might be so, but this searching API stems from a desire to read news sorted and grouped any way *the reader* wants, not necessarily newsgroups. I, for one, don't like being forced to read certain groups. A lot of the time I want to follow a conversation thread regardless of where the thread goes. Or I want to see the recent articles written by some user(s), regardless of where they appear. Now that that's out of the way, I'll address your point. Returning a standard set of headers means wasted data if you don't want those headers or additional requests if the headers you want aren't there. Current software might want those headers, but more advanced software (software that doesn't force the user to do group-level newsreading) could do with customized header retrieval. > In fact, given the > tendency for GUI newsreader authors to simply neglect to show users > *any* headers, I'd hesitate to do anything that would encourage this > practice. To me, that's their problem. No matter what protocol is used, there will always be developers who do not provide the users with the information they should be providing. > For my own work the things that I am most concerned with are the pattern > matching specifications. Full reg-exp searches are a necessity, and it > would be extremely nice to be able to specify that idiotic spam that > went around where the spammer used the last three characters of the > newsgroup name as part of the From: and the Subject: of the posting, > obviously in an attempt to defeat both killfiles and the spam cancellers. I would like a fuller regular expression set as well, and I'll certainly reconsider what to include (probably what perl provides). Like I said in the intro, much of the limits in this came from mSQL's SELECT (which offers an extremely limited regular expression set of characters, probably doing what SQL-92 specifies). It was an unintentional shortcoming that the original suggestion did not include fuller regexp. > I'm extremely leary of making CONTAINS so easy to use, since searches > that are pegged to either the start or the end of a string are far more > efficient. I'd prefer to require syntax like email-address=*@blarg.com*, > since it would be more likely that the user would then use *@blarg.com > instead of contains(blarg.com). I think having fuller regexp support would make this problem go away. "@blarg.com$" or ".*@blarg.com" would work to match anyone with an e-mail address ending in blarg.com. > I can see it useful to have a special construct to be able to specify > original articles or followups in a subject search without having to > use a contains. Would using References: work for you? The References: header won't be there if the post is starting a new thread, but it will contain the message IDs of other posts on that branch of the thread if that post is a followup. There are some things I am considering and I'd like some feedback on these ideas too. I'll mention as many good and bad points as I can think of while I list these ideas. In no particular order: * Body searches Searching the entire body of an article takes a lot of work on the part of the server both to maintain an index of the articles and to perform the searches on the index. Using the headers seems like a more pragmatic approach to searching huge (and constantly changing) article collections, like the collections of articles at a Usenet news server. * Making good use of the Keywords: header. (two parts) (1) I think it's time we (all Usenet users) encourage good use of the Keywords: header. To help against spelling errors, I thought it might be useful to either include Soundex codes (in lieu of real key words) in this header or make up a new header as a companion to the Keywords: header. Like Xref:, this new header would not be propagated between servers, just between servers and clients. It would work like this--you post an article with a Keywords: header of "alpha,beta,gamma" and this new header (call it X-Soundex-Keywords: for the time being) would hold "A410,B300,G500" (the Soundex hash of the three keywords in the same order). You can't go from the hash back to the word--you can't do a reverse Soundex search--but when performing a search based on keywords, you can compute the Soundex hash of the search criteria for this header and compare against the X-Soundex-Keywords: header. Advantage: If either you or the article author misspelled any keywords but the misspellings map to the same hash, you can still find the article you want. This is one of the big pluses of Soundex in general. Advantage: Soundex is PD and widely implemented in ready-to-use forms (for instance, perl has it in the standard distribution). It has been used for large-scale databases in the past (some US states use it as to generate the first segment of driver's license numbers). Disadvantages: Soundex is primarily for English speakers. I don't think it recognizes any characters other than the 26 letters of the alphabet English speakers use. This will not work well for non-English newsgroups. However, if there is an international Soundex perhaps this idea could still work (I'm not sure what exactly an international Soundex would look like or how it would work, but I hope I've conveyed the vague idea of what I'm aiming for). I would be interested in offering this header strictly as an experiment because I'm interested to see how useful this phonetic search would be but at the same time I'm hesitant because I don't want to promote an English-only Usenet. (2) The best keywords for an article are chosen by the person posting that article, unfortunately too few users use the Keywords: header. Since we don't have the technology to let the computer comprehend an article and prepare a sensible list of keywords, perhaps we should consider scanning the article body for "interesting" words, using a subset of them as the default for the Keywords: header. It would work something like this--you prepare an article without a Keywords: header and post it. Your posting software (or the server) scans the body of your article plus the content of the Subject: and Summary: headers for uncommon words by comparing all the words to a list of known "uninteresting" words. An English list would include Re:, and, or, if, but, some, for, each, etc. The words not mentioned in this list would be deemed "interesting" words and sorted by length and number of occurrences. The most frequently occurring "interesting" words are counted and if they are few in number, they are used as the basis of a Keywords: header. The user is prompted with this list and encouraged to make appropriate changes (which might include scrapping the entry altogether and choosing to have no Keywords: header at all). Obviously, certain groups will need to be excluded from certain aspects of this search (there's no point in searching the body of posts to binary newsgroups, for instance) and multiple lists of "uninteresting" words will be needed for different languages, but I don't think this poses a significant problem. I'd really appreciate it if someone familar with Library Science would comment on this. These ideas mean some changes to my inital API--searching the body would become optional for implementors. Header searches would be the main focus, and allowing searches on *all* the headers wouldn't even be necessary, just the common headers plus Keywords:, Summary: and X-Soundex-Keywords: (if that ever became a reality).
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads