Basics
A tool exists for interactively browsing and updating LoganBerry databases. Think of the browser as a convenient way of performing LoganBerry commands. To run the browser, type:
Bringover -p /Cedar/CedarChest®/Top/LoganBerryTools.df
LoganBerryBrowser some-database-schema-name
The convention for naming databases is the same as that used by LoganBerryStub (see above); both local and remote databases may be browsed concurrently. The browser reads the database schema to discover what indices exist for the database. It then builds an input form in which values for the various attribute keys can be entered. These values are treated as patterns against which database entries are compared.
For example, LoganBerryTools.df contains SampleDB.df, the schema for a sample database storing names and phone numbers. Typing "LoganBerryBrowser SampleDB.df" produces a viewer that looks something like the following:
User interface
The browser has several areas or subviewers. At the very top is the caption indicating the name of the database being browsed. Right below this is a menu with one or two lines (the display of the second line is controlled by the "AdminOps" button). The function of each menu button is explained in the next section.
Below the menu is the input form. Each line of the input form allows the user to type in a pattern for a given attribute. For instance, the browser tool shown above has an input form with two attributes: "Name" and "Phone". There may be some painting problems remaining in the browser. If what you type is not being displayed, make the browser iconic and then reopen it and the problem should go away (hopefully).
Preceding each attribute name on the input form is a choice button that allows the user to select what pattern matching is too be applied to the attribute value. Clicking on this choice button cycles through the various options (see the section on pattern-matching options below).
The last line of the input form is a text viewer with the label "other attributes:". This is used to type in values for attributes that are not keys of the database. The input syntax is identical to the attribute-pattern specifications that may be typed into a CommandTool (see below).
Below the input form is another choice button that allows users to select on which attribute the output should be ordered. (To speed up queries it is best to order the output on some attribute that has a well-specified pattern.) The pattern-selection and order-by choice buttons comprise the details subviewer.
The history window optionally resides below the input form and details subviewer (it is not shown in the browser above). Whether or not it is currently displayed is governed by the "History" menu button. This area contains a list of the operations that have been executed in the past; these operations are given in a format that could be typed into a CommandTool to get identical results (except the database name is omitted). Clicking on one of these "history commands" fills in the input form with the values that previously existed and also sets the previous details. Thus, a query can be re-executed by selecting a line in the history window and clicking "Browse" again. The user is also free to change any of the values once they are refreshed.
At the bottom of the browser tool is the output area where the results of queries are displayed. This area is scrollable.
Menu buttons
The LoganBerry Browser Tool displays the following menu buttons:
STOP!: terminates a currently executing database query.
Browse: initiates a database query to retrieve all entries matching the input form. That is all database entries whose attribute values match the corresponding pattern in the input form (according to the selected pattern matching style) are displayed in the output area of the browser. (Same as LBQuery.)
Update: writes a database entry consisting of all the non-null values in the input form. (Same as LBWrite.)
Delete: initiates a database query to retrieve all entries matching the input form; then deletes all of these entries. (Same as LBDelete.)
UnDelete: rewrites all of the entries deleted by the last "Delete" operation.
History: toggles whether or not the history of past queries is displayed.
Details: toggles whether or not the details that govern how a query is performed are displayed.
AdminOps: displays (or hides) a second menu line that contains buttons for performing administrative operations on the database.
The second menu line offers the following buttons (intended mostly for advanced users):
Open: opens the database. (This is automatically done when the browser is created and on every browse operation; thus a user should never have to use this button).
Close: closes the database and its associated files. (Same as LBClose.)
BuildIndices: rebuilds the database indices. (Same as LBBuildIndices.)
CompactLogs: compacts the database logs. (Same as LBCompactLogs.)
Pattern-matching options
The following assortment of pattern matching may be selected on the browser's input form:
exact: values must match exactly;
prefix: the pattern must be a prefix of the database entry's attribute value;
wildcard: the pattern may contain zero or more wildcards (the character "*") that match anything;
regular expression: the pattern is taken to be a regular expression as defined in RegularExpressionDoc.tioga;
soundex: the form value's Soundex code is compared with that of a database entry's attribute value, i.e. values match if they "sound" alike; for instance, Johnson, Jansen, and Johansen have identical Soundex codes.
subrange: the pattern is taken to be two strings (or rope literals) separated by a dash, e.g. "beginning-end"; a match occurs on a database entry's attribute value if beginningdvaluedend in lexicographic ordering or prefix(value)=end.
numrange: the pattern should consist of two positive integers separated by a dash. e.g. "18-21"; a match occurs if the value is in the numerical range specified by the pattern.
daterange: the pattern should consist of two date and times (as can be parsed by Tempus) separated by a dash, e.g. "today at noon-doomsday"; a match occurs if the value is in the chronological range specified by the pattern.
date: the pattern, as well as the value, should be a date and time (as can be parsed by Tempus); the value and pattern match if they represent the same time within the precision of the pattern. Note: A match can not occur unless the pattern is no more precise than the value. For example, a pattern of "Wednesday" will match a value of "Wednesday at 2 pm", but not vice versa.
DWIM: the browser attempts to deduce an appropriate filter type from the given pattern. The logic is as follows:
pattern-matching ←
IF pattern contains a dash
THEN
IF start and end are integers THEN "numrange"
ELSE IF start and end are dates THEN "daterange"
ELSE "subrange"
ELSE
IF pattern contains a * THEN "wildcard"
ELSE IF pattern is a date then "date"
ELSE "prefix"
Warning: The "numrange", "daterange", and "date" pattern-matching filters are problematic since they assert that the attributes in the database are of a certain type other then simply ropes. The LoganBerry data management system treats all attribute values as ropes and does not enforce any constraints on the these values. If the browser encounters an attribute value that can not be converted to the type desired by the filter, then the entry is deemed to not match. Also, the "DWIM" option has the obvious problem that its semantics are not easy to predict or determine. For these reasons. "numrange", "daterange", "date", and "DWIM" are provided on an experimental basis only and should be used with caution.