# KEHOME/bin/dmoz.mkr # May/14/2003 #==============# # dmoz methods # # read dmoz # # find topic # # find term # #==============# # general usage: # $ ke # set dbmode if desired (default is "none") # ke$ set dbmode = gdbm; # save hierarchy in GDBM database # read this file (define dmoz methods) # ke$ do read from bin/dmoz.mkr done; # read desired dmoz directory, for example # ke$ do read dmoz from netscape done; # enter search commands, for example # ke$ topics := do find topic od sports done; # ke$ topics := do find term od browser done; # ke$ every topic in $topics { # ke> $topic isa* ?; # all superTopics # ke> $topic isc* ?; # all subTopics # ke> }; # ke$ Topic isc* ?; # all Topic instances # ke$ term isc* ?; # all term instances # exit # ke$ exit; # $ # # Note: dmoz file size # netscape-structure.rdf 102 KB # netscape-terms.rdf 1 KB # kt-structure.rdf 1360 KB # kt-terms.rdf 47 KB # structure.rdf 420 MB (make your own copy) # terms.rdf 487 KB set KEDB = http://rhm.cdepot.net/db; set UniqueName = rootname; set DisplayName = shortname; read dmoz isa method with description = "read dmoz directory files", usage = { do read dmoz from netscape done; do read dmoz from kids and teens done; do read dmoz from dmoz done; do read dmoz from filename done; }, automatic = none, format = {do read dmoz from directory:1 done;}, meaning = { Top iss directory; Topic has d:term; do print od "# INFO: read dmoz: dbmode = $dbmode" done; do print od "# INFO: read dmoz: reading $1 directory" done; if $1 is netscape; then Top isg Top/Netscape; do read_dmoz from "${KEDB}/netscape-structure.rdf" done; do read_dmoz from "${KEDB}/netscape-terms.rdf" done; else if $1 is kids and teens; then Top isg Top/Kids_and_Teens; do read_dmoz from "${KEDB}/kt-structure.rdf" done; do read_dmoz from "${KEDB}/kt-terms.rdf" done; else if $1 is dmoz; then do read_dmoz from "${KEHOME}/db/structure.rdf" done; do read_dmoz from "${KEDB}/db/terms.rdf" done; else do read_dmoz from $1 done; fi; fi; fi; }; find topic isa method with description = "find Topics containing phrase", usage = { do find topic od phrase:1 done; }, automatic = none, format = {do find topic od phrase:1 done;}, meaning = { do find od *$1* done; }; find term isa method with description = "find Topics with term", usage = { do find term od term:1 done; }, automatic = none, format = {do find term od term:1 done;}, meaning = { ? has term += $1; };