home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / database / trilogy.arc / TRILOGY.DOC < prev    next >
Text File  |  1988-04-04  |  23KB  |  367 lines

  1.                                 
  2.          
  3.          
  4.          
  5.          
  6.                       TRILOGY - A Note Retrieval System      
  7.          
  8.                                   B. J. Ball
  9.                                3304 Glen Rose Dr.
  10.                                Austin, Texas 78731
  11.  
  12.  
  13.  
  14.                This program was initially developed as an aid to authors 
  15.          who, during the preliminary stages of writing a book, may 
  16.          accumulate several hundred individual notes dealing with 
  17.          particular aspects of the general subject to be written about. 
  18.          During the actual writing phase, the question inevitably arises 
  19.          of locating, as quickly as possible, all notes dealing with the 
  20.          specific topics currently under consideration.  If the notes 
  21.          are kept in a computer file with each note having a header 
  22.          indicating the kinds of things it deals with, the program will 
  23.          allow the rapid retrieval of all notes dealing with  a 
  24.          specified Boolean combination of topics. Since the keywords 
  25.          used in the note headers are likely to be dependent on the 
  26.          particular project, and not easily characterized in advance, 
  27.          use of a standard data base program might be inconvenient. Also 
  28.          the fact that the notes may range in length from a paragraph or 
  29.          two to several pages would be a nuisance in a program requiring 
  30.          a fixed (or maximum) record length to be specified at the 
  31.          outset. 
  32.                  
  33.                Another obvious use for such a program as this is keeping 
  34.          track of business or personal correspondence. Since most 
  35.          letters fall into several different classifications, it is 
  36.          sometimes difficult to know exactly where a particular one was 
  37.          filed. More importantly, when all letters relating to one or 
  38.          more specified topics need to be collected together, it would 
  39.          be convenient to have a better procedure than an exhaustive 
  40.          search of all the likely places. Using TRILOGY, it would only 
  41.          be necessary to give each letter a header consisting of 
  42.          keywords describing its relevant categories, after which all 
  43.          letters having a given combination of keywords in their headers 
  44.          could easily be retrieved. 
  45.          
  46.                The program requires an IBM PC or compatible with at 
  47.          least 128K available memory . A hard disk, while helpful, is by 
  48.          no means necessary. 
  49.                 
  50.                To use TRILOGY, one starts with a text file consisting of 
  51.          a collection of "notes"; each note must be immediately preceded 
  52.          by an "identifier", which is just a sequence of keywords 
  53.          suggesting the content of the note. In order for the program to 
  54.          recognize identifiers as opposed to the text of notes, it is 
  55.          required that each identifier be enclosed in distinctive 
  56.          symbols which are not used anywhere else. (The file also should 
  57.          not use a tilde (~) since the program uses this symbol as an 
  58.          "end-of-text" marker.) By changing a configuration file, the 
  59.          user may select the header markers to be used, choose the 
  60.          delimiters for separating keywords in headers, specify which 
  61.          symbols other than letters and numbers will be allowed in 
  62.          keywords and determine whether keywords will be automatically 
  63.          capitalized or allowed to contain lower case letters. Color 
  64.          monitor users may also choose the foreground, background and 
  65.          border colors desired. (In default mode, headers are to be 
  66.          enclosed in curly braces {...} and keywords in headers may be 
  67.          separated by spaces, commas, semicolons, or any other symbol 
  68.          not eligible to be part of a keyword. Also, in default mode, 
  69.          all letters in keywords, whether originally entered as capitals 
  70.          or lower case, are converted to capitals by the program; 
  71.          keywords may contain apostrophes, hyphens or the underline 
  72.          character (as a space substitute), but may not contain spaces. 
  73.          For color monitor users, the default settings are white text on 
  74.          a blue background. The accessory program, TRIL-SET, allows the 
  75.          creation of a configuration file with different default values 
  76.          from these.) It is very important that the program be told 
  77.          whether or not a color/graphics card is being used, since there 
  78.          is a machine-language subroutine for fast screen printing which 
  79.          uses this information, and which will hang up the machine if 
  80.          this data is wrong. If there is no configuration file available 
  81.          to the program, the default values listed above will be used, 
  82.          but you will first be asked whether you are using a color card. 
  83.          
  84.                Keywords must contain at least four characters, but there 
  85.          is no formal limitation on the maximum length - only the first 
  86.          eighteen characters of each keyword will be printed in the 
  87.          keyword list, but all characters are relevant in a search. 
  88.          There is a limitation (160 characters) on the length of the 
  89.          total identifier for a note, however, in order to help detect 
  90.          the fairly common error of failing to put a closing } at the 
  91.          end of an identifier. (If this happens, the program will try to 
  92.          read all the rest of the that note as part of its identifier, 
  93.          probably exceeding the 160 character limit in the attempt, 
  94.          whereupon processing will cease, with the suggestion that the 
  95.          source file be checked for a missing `}'. Although exceeding 
  96.          the maximum header length is a "Fatal Error", in the sense that 
  97.          the program will not continue after encountering it, nothing 
  98.          that has been done up to this point will be lost.) 
  99.          
  100.          
  101.                            Operation of the Program 
  102.                  
  103.                Given a Source file satisfying the conditions stated 
  104.          above, TRILOGY will create three additional files - an 
  105.          Identifiers file containing a list of all the note headers from 
  106.          the source file, a Keywords file containing an alphabetized 
  107.          list of all keywords appearing in the headers, and a Records 
  108.          file, containing the individual notes. These three files may 
  109.          then be used to isolate quickly all notes whose headers contain 
  110.          a specified combination of keywords.  The retrieved notes may 
  111.          be displayed on the screen, printed out on the printer, deleted 
  112.          altogether, or sent to a file. If a note is sent to a file, it 
  113.          can then be edited (using a word processor, after exiting 
  114.          TRILOGY) and can later be replaced in the Records file from 
  115.          which it came. In fact, it is possible to replace any note with 
  116.          an arbitrary one contained on the default disk, and thus 
  117.          information can be added to or removed from a note at will. 
  118.          Provision is also made for "updating" an existing collection of 
  119.          Trilogy files; i.e., adding additional notes, headers and 
  120.          keywords from a new Source File. 
  121.          
  122.                The TRILOGY program and the desired Source File must 
  123.          initially be accessible to the program but need not be on the 
  124.          default drive/directory; the Identifiers, Keywords and Records 
  125.          files, however, are always placed on the default drive when 
  126.          created by TRILOGY, and must be there when used. As usual, 
  127.          "filespec" denotes the filename, preceded by the drive 
  128.          identification if different from the default drive, and 
  129.          followed by the filename extension, if any is used. For 
  130.          convenience, the program adopts a single "generic" name for all 
  131.          files related to a given source file - if the original file is 
  132.          A:SOURCE.BAS, the generic name is "SOURCE" and the Identifiers, 
  133.          Keywords and Records files are automatically named SOURCE.ID, 
  134.          SOURCE.KW and SOURCE.REC. 
  135.          
  136.                When the program starts, you are presented with an 
  137.          abbreviated menu, since there is not much you can do until some 
  138.          Trilogy files have been created. The creation process will take 
  139.          about one minute for every 10K bytes in the Source File - 5 
  140.          minutes for a 50K file, 10 minutes for a 100K file, etc. (These 
  141.          times are considerably less with a hard disk and are 
  142.          approximately halved if a Ramdisk is used. The time may also 
  143.          vary considerably depending on the average length of the notes 
  144.          and other factors.)  Once a set of Trilogy files has been 
  145.          created - or selected, if previously created - the menu is 
  146.          expanded and the "Active" files are listed at the bottom. You 
  147.          may now choose to have the keywords or the identifiers printed, 
  148.          on the screen or on the printer. And you may also now use the 
  149.          "Findnote" feature, which is the primary purpose of the 
  150.          program. 
  151.          
  152.                In Findnote, you will first be asked to enter either a 
  153.          "Search String" or a "Direct Command" both of which require 
  154.          some explanation.  
  155.          
  156.                A Search String is a Boolean combination of OR's and 
  157.          AND's of Keywords, with OR taking precedence over AND, contrary 
  158.          to the usual convention. The only construction recognized is 
  159.          (xxx OR xxx OR ...) AND (xxx OR xxx OR ...) AND ... AND ... ; 
  160.          here the xxx's represent keywords, of which at least one must 
  161.          be present. Parentheses are optional, and punctuation (except 
  162.          for symbols which are allowed in keywords) will be ignored. The 
  163.          Boolean operators  "AND" and "OR" must be set off by spaces, 
  164.          but need not be capitalized.  (The program will supply 
  165.          parentheses to enforce the prescribed logical form - e.g., an 
  166.          entry such as "(x AND y) OR z" will be changed to "x AND (y OR 
  167.          z)", not at all what was wanted; to search for the former 
  168.          combination, use "(x OR z) AND (y OR z)". It would, of course, 
  169.          be possible to include a complete Boolean parsing routine, so 
  170.          that all combinations would be directly recognized, but that 
  171.          seems to be more trouble than it is worth.  Giving OR 
  172.          precedence over AND and using the simple parsing scheme 
  173.          indicated above appears to handle the majority of desired 
  174.          searches, and the remainder present the user with interesting 
  175.          logical problems. The Boolean operator NOT has not been 
  176.          implemented, simply because it seems unnecessary.) 
  177.           
  178.                Rather than entering a Search String, you may choose to 
  179.          give a Direct Command, identifying the desired notes by their 
  180.          positions in the original file (which may be read from an 
  181.          Identifiers list printed out by the program). You may enter a 
  182.          list of note numbers, a range of numbers, or a combination of 
  183.          these and may optionally end the command with one of the 
  184.          letters D,P,F,X,R to have the notes immediately Displayed, 
  185.          Printed, Filed, Deleted or Replaced. Direct Commands must start 
  186.          with the symbol "#" to distinguish them from Search Strings. 
  187.          Examples of Direct Commands are : 
  188.          
  189.               #2,5,7-10,23 P       to print out notes 2,5,7,8,9,10,23
  190.               #6-8x                to delete notes 6,7,8 
  191.               #5d                  to display note 5 
  192.           
  193.          In a Direct Command, spaces are irrelevant and invalid entries 
  194.          (including any letter not at the end of the command) will be 
  195.          ignored. Numbers larger than the total number of notes will be 
  196.          replaced by that total number. (This gives an easy way to 
  197.          operate on all notes in the current file, by using in a direct 
  198.          command a number known to be larger than the number of notes 
  199.          present.) The letter suffix, if used, may be upper or lower 
  200.          case; if a Direct Command has no letter suffix, the specified 
  201.          notes will be treated just as if they had been discovered 
  202.          through a search. Entering a question mark at the "Enter Search 
  203.          String or Direct Command" prompt will call up a help screen, 
  204.          which briefly describes the formats for Search Strings and 
  205.          Direct Commands. It should perhaps be noted that sending a note 
  206.          to a disk file does not automatically delete that note from the 
  207.          active Trilogy files; the X suffix on a separate command is 
  208.          necessary to delete notes. Since there is no provision for 
  209.          recovering deleted notes, deletion should be done with care and 
  210.          only on backed-up files. 
  211.          
  212.                The strength of this program is not in its handling of 
  213.          Direct Commands, since any database program can do things to 
  214.          records whose numbers are specified by the user, but in its 
  215.          ability to quickly find all notes of a specified kind, through 
  216.          a Search String entry. In the Findnote routine the program will 
  217.          locate those notes whose headers contain a specified 
  218.          combination of keywords. Normally an exact match with a keyword 
  219.          is required in any search, but this may be changed by the use 
  220.          of the wildcard symbol * : a search for MAN will not find 
  221.          MANKIND, but a search for MAN* will; similarly, *MAN would find 
  222.          HUMAN and *MAN* would find both HUMAN and MANKIND (as well as 
  223.          MISMANAGEMENT,...). 
  224.          
  225.                If you have chosen to allow keywords to contain lower 
  226.          case letters, all searches will be case-sensitive; otherwise 
  227.          (with the default settings, for example) you may use mixed case 
  228.          freely in entering search strings, since all letters will 
  229.          automatically be converted to upper case. 
  230.          
  231.                Once a search string has been entered, all notes whose 
  232.          headers contain the specified combination of keywords will be 
  233.          located in a very few seconds. The screen will be cleared and 
  234.          the Search String used by the program will be displayed, 
  235.          followed by the identifiers of the located notes. You now have 
  236.          the option of choosing a note and either displaying it on the 
  237.          screen, printing it out on the printer, sending it to a file, 
  238.          deleting it from the Active files or replacing it with a note 
  239.          from the default drive. (If a Direct Command had been entered 
  240.          without a letter suffix, the identifiers for the specified 
  241.          notes would have been listed as above, and the same options 
  242.          would be available.) It is possible to display, print, delete 
  243.          or file several of the listed notes as one operation, by 
  244.          entering the analog of a Direct Command. Here the "#" prefix 
  245.          indicates that the numbers of the notes in the original file 
  246.          are used, just as before; if a list or range of numbers is 
  247.          entered here without using the "#" prefix, the numbers will be 
  248.          interpreted as the positions of the notes in the list of 
  249.          located notes (the result of the previous search). Both note 
  250.          numbers appear on the screen, with the original file numbers in 
  251.          parentheses. If the # prefix is notused and a number is  
  252.          entered which is greater than the number of notes in the 
  253.          current list, no action is taken and you are asked to reenter 
  254.          your choice; otherwise the Direct Command rules apply, with 
  255.          numbers that are too large being replaced by the total number 
  256.          of notes in the active files. Also, with the # prefix, you are 
  257.          not limited to only those notes in the current list, but may 
  258.          enter an arbitrary Direct Command. 
  259.                
  260.                Before printing any notes, you should make sure the paper 
  261.          is located with the printer's "top-of-form" at the top of a 
  262.          page; the program counts lines to avoid printing on 
  263.          perforations, but this does no good unless the printer knows 
  264.          where the top of the page is, and starts there. When a sequence 
  265.          of notes is being printed, new pages are begun only when 
  266.          necessary, not at the begining of each note. You will be asked 
  267.          at the start of each printout whether you wish to begin a new 
  268.          page with this note or sequence of notes. There are no error 
  269.          traps for an off-line printer, so to avoid a bomb-out, be sure 
  270.          the printer is ready when the program wants it. (You are always 
  271.          given an opportunity to check that the printer is ready, but if 
  272.          you make a mistake about this, you will have the fun of 
  273.          starting all over.) 
  274.                   
  275.                There are two reasons for the File option - you may wish 
  276.          to write a note to a disk file in order to correct or modify it 
  277.          and then replace it in its original Trilogy file, or you may 
  278.          wish to separate off a subgroup of notes from the original file 
  279.          into a separate reference file, perhaps to be used later as the 
  280.          Source File for another application of TRILOGY. 
  281.          
  282.                The "modify and replace" procedure - saving a note, 
  283.          exiting TRILOGY, using a word processor on the offending note, 
  284.          then reloading TRILOGY and replacing the note - is obviously a 
  285.          rather cumbersome procedure. Including even simple editing 
  286.          facilities, however, would make the program unacceptably large. 
  287.          (A resident word processor like Sidekick, or any of several  
  288.          commercially available multi-tasking or memory-partitioning 
  289.          programs will greatly simplify the modify and replace process 
  290.          by making both TRILOGY and your word processing program 
  291.          immediately available.) It should be noted that the "R" option 
  292.          can be applied to only one note at a time. When this option is 
  293.          used, however, the replacement note can be a virtually 
  294.          arbitrary file, not necessarily one which was previously 
  295.          extracted from the current Trilogy files. The only restriction 
  296.          is that any file used as a replacement for a TRILOGY note must 
  297.          include a header in the appropriate form. 
  298.          
  299.                As mentioned, you may create a subcollection of the 
  300.          original note collection by sending a sequence of notes to a 
  301.          single disk file. This may be done all at one time or, since 
  302.          saved notes are appended to the target file rather than 
  303.          overwriting it, notes may be added to the subcollection 
  304.          individually or in small groups, just by specifying the same 
  305.          file name for each   them. If you have deleted a significant 
  306.          number of notes, you may wish to save all the remaining ones to 
  307.          use as a Source File for a later application of TRILOGY, since 
  308.          the deletion process does not automatically reduce the size of 
  309.          the Records file. 
  310.          
  311.                When a note is deleted from the Active files by using the 
  312.          X  command, all keywords which occur only in the header of the 
  313.          deleted note will be removed from the keyword list. Similarly, 
  314.          if the header of a replacement note is different from that of 
  315.          the original, the keyword list will be updated appropriately.  
  316.          
  317.                It might be convenient not to make the entire Source File 
  318.          at once,and the Update facility was included to allow creation 
  319.          of large Trilogy files from a series of separately composed, 
  320.          smaller, source files. Only the currently Active files can be 
  321.          updated, and it should be borne in mind that the updating 
  322.          process adds all the notes from the "Update  File" (i.e. the 
  323.          Source File for this operation) to the existing Trilogy files; 
  324.          therefore the Update File should contain only new information. 
  325.          Also, of course, the Update File must be in the same form as an 
  326.          original Source File - a sequence of notes each preceded by an 
  327.          identifier delimited by the chosen header markers.  
  328.          
  329.                Whenever the program is waiting for input from you, you 
  330.          may return to the menu by pressing the Esc key. This might be 
  331.          useful if, for example, the program wants you to enter a 
  332.          filename and you have forgotten what's available and want to 
  333.          use Option 1 to find out, or if you simply change your mind and 
  334.          want to cancel the operation you've started. Most single- 
  335.          character entries do not require that the Enter key be pressed, 
  336.          but all multiple entries do; generally, pressing Enter alone 
  337.          when a multiple-character entry is expected will return you to 
  338.          the menu. 
  339.          
  340.                Overall, error trapping is pretty good, but as mentioned 
  341.          earlier, there are no error traps for an off-line printer; 
  342.          these were originally included, but turned out to be so 
  343.          unreliable (on my machine, at least) that eliminating them 
  344.          entirely seemed best. (The problem was that the error would be 
  345.          trapped the first time it occurred, and possibly the second 
  346.          time, but not every time.) 
  347.           
  348.                The arrays used in the program are dimensioned to allow a 
  349.          total of 500 notes, 1500 distinct keywords and 2000 records 
  350.          (corresponding to a Source File of about 500K). Search Strings 
  351.          are arbitrarily limited to one screen line (79 bytes), and to a 
  352.          maximum of 10 AND phrases, each containing at most 10 OR's. 
  353.          (The program will not allow you to exceed the specified limits, 
  354.          but no information will be lost by an idadvertent attempt to do 
  355.          so.) 
  356.          
  357.                This program should be useful to anyone involved in 
  358.          research of almost any kind, since in any research, a great 
  359.          deal depends on having readily at hand a large variety of 
  360.          information on particular aspects of the subject. Often, 
  361.          perhaps usually, creating the original Source File is a natural 
  362.          part of the procedure, especially if a computer file is 
  363.          ordinarily used. Everything else is done automatically by the 
  364.          program. 
  365.  
  366.  
  367.