).
# ----------------------------------------------------------------------
# URA
# ----------------------------------------------------------------------
# Initialize the URA, its search specs and searchable services
# URA init
set uraDebug 1
uraInit {
{name {DejaNews Search}}
{author {Leslie Daigle}}
{version {1.0}}
{description "This URA will search for UseNet News articles."}
{help "This is help on UseNet News search script."}
# bug: handling of choices/labels is kind of gross
# Search spec. init
foreach item {
{
{name {Topic Keywords}}
{field Topic
{tag STRING
{description {Keywords to search for in news articles}}
{prompt {Topic Keywords}}
{help {Symbols to look up, separated by spaces.}}
{type STRING
{subtype {}}
{allowed .*}
{numvals 1}
{required 0}
Daigle, et. al. Experimental [Page 17]
RFC 2016 Uniform Resource Agents October 1996
{response {}}
{respset 0}
}
} {
uraSearchSpecInit $
uraAnnotationInit {
{help {Enter comments to store with an instance}}
{numvals 1}
{subtype {}}
{response {}}
{name Comments
{required 0}
{class ANNOTATION
{type TEXT
{description {General comments about this URA.}}
{respset 1}
{prompt Comments
{field {}}
{allowed .*}
uraResultInit {
{name {Related Pages}}
{contents { {
{HEADLINE {The DejaNews UseNet search service}}
{TYPE text/plain
{URL http://www.dejanews.com
} }}
foreach item {
{
{name dejanews
{protocol http-post
{url http://marge.dejanews.com/cgi-bin/nph-dnquery
}
} {
uraServicesInit $
proc dejanews_uraHTTPPostCanonicalize {htmlRes} {
set result {}
set lines {}
Daigle, et. al. Experimental [Page 18]
RFC 2016 Uniform Resource Agents October 1996
set clause {}
set garb1 ""
set garb2 ""
# Get the body of the result
# -- throw away leading and trailing
regexp {([^]*)(.*)
.*} $htmlRes garb1 garb2
set lines [split $mainres "\n"]
foreach clause $lines {
uraDebugPuts stderr [format "Line: %s" $clause
if [
{
.*(..\/..).*([^<]*).*([^<]*).*} \
$clause garb1 dt relurl desc grp] {
uraDebugPuts stderr [
"Date: %s Rel URL: %s Desc: %s Group: %s
$dt $relurl $desc $grp
lappend r [list HEADLINE [format "%s (%s, %s)"
[string trim $desc] \
[string trim $grp] $dt]]
lappend r [list URL [
"http://www.dejanews.com/cgi-bin/%s" $relurl]]
lappend r [list TYPE "text/plain"]
lappend result $
}
}
return $
# ----------------------------------------------------------------------
# Mapping
# ----------------------------------------------------------------------
# There is one procedure, for each searchable service, to map the
# spec responses to a form suitable for inclusion into a search URL (
# whatever form the particular query procedure accepts).
Daigle, et. al. Experimental [Page 19]
RFC 2016 Uniform Resource Agents October 1996
proc mapResponsesToDejanews {} {
set resp ""
if {[uraAreResponsesSet {Topic Keywords}]} {
lappend resp [list query [uraGetSpecResponse {Topic Keywords}]]
}
return $
# bug: need better error
# (i.e. which searches didn't work and why, etc.)
proc uraRun {} {
global
foreach serv [uraListOfServices] {
set u [uraGetServiceURL $serv
switch -- $serv {
dejanews {
if [catch {
set query [mapResponsesToDejanews
uraDebugPuts stderr [format "%s: query is `%s'."
$serv $query
if {$query != {}} {
set result [uraHTTPPostSearch $u $query
if {$result != ""} {
uraDebugPuts stderr [format "%s: result is `%s'."
$serv $result
set list [dejanews_uraHTTPPostCanonicalize $result
uraDebugPuts stderr [format "%s: list is `%s'."
$serv $list
puts $
}
}
}] {
puts stderr $
}
}
default {
# can't handle other searches, yet
}
Daigle, et. al. Experimental [Page 20]
RFC 2016 Uniform Resource Agents October 1996
}
}
Daigle, et. al. Experimental [Page 21]
if you see any problems within the linking, don't worry be happy,
this is version 0.1 of the Relevance System and you gotta expect some crappy subroutines sometimes,
just be content we did not write this in Java, which would have made this "bigger and better" HAHAHHA.
RFC documents can be found at I.E.T.F.
Relevance System Copyright © 2002 Spectrum WorldResearch
other technical nosh by ServerMasters Corporation
collaboration of BobX