The search options in costwish are based on Joe English's manual which is complete and clear, but rather terse if you haven't had experience with structured documents. It's worth trying the tutorial if you have difficulties.
The nodes in a document can be thought of as people in a family tree (genealogy) and the same terms are used: parent, ancestor, child, descendant, sibling (sister/brother). In some cases there are slightly strange conventions - a node is an ancestor of itself, but is not a descendant of itself. I did not realise till I started SGML how powerful this type of structure is, and I am still adding options to costwish to reflect this.
A search can be extremely precise and very powerful. Here is how an HTML
document could be searched for all content of the form:
<A HREF="index.html">
i.e. links to "index.html".
The CoST query (submittable in a script or on a commandline) is:
query* doctree element A withattval HREF "index.html".
costwish supports the graphical submission of queries like this and can,
if needed, be more complex, supporting two GIs. An HTML example could be
to search for links within lists as in:
<LI> yet another <A HREF="index.html"> link </A>.
This search can be coded in CoST as:
query* doctree element LI descendant A withattval HREF "index.html"
which shows the way that clauses can be strung together.
For anything more complex, you will need to code it manually or use the
UserClass mechanism below.
Where you wish to save the results of a query, or where you need to break a query into smaller parts which are combined, costwish has a mechanism for saving a set of nodes or 'UserClass' or UC. (The word CLASS is likely to be used as an attribute in HTML3 and other SGML systems, so this is to avoid confusion.) A set of nodes (at present only from the results of a search or operations between UserClasses) can be denoted as a UserClass and given a symbolic name. For example, all SPEECHes which contain the SPEAKER whose content is 'Caesar' could be labelled as a UserClass with name CaesarSpeech. We could then use these as part of other queries such as 'find all ACTs in which there is NOT a speech by Caesar'. (We would create a UserClass AllActs, another CaesarActs, and carry out the Boolean operation AllActs NOT CaesarActs. With practice this becomes quite rapid.)
NOTE: this is an experimental interface and should be treated gently. It is worth starting very slowly with simple queries whose results you can easily confirm - e.g. find all nodes with GI FOO.
Note that for a simple search like this, Context must be set to 'None'
NOTE: I'm thinking about how these queries can be constructed completely graphically - watch this space. Joe is also thinking about how to add regexps and similar to CoST.
NOTE: Do not rely on the results of this search for complex queries - combinations of GI and UC may well not have been thoroughly tested.
BUG: sometimes the GI/UC switches get out of sync
BUG: The list of GIs can sometimes get doubled - it doesn't affect the selection - just messy.
When a search is completed a Results window pops up. If there are hits, they are shown as buttons, with 'MeaingfulTitles' if requested. They will also be highlighted in the TOC (pink at present). If they were not originally in the TOC, they will be added automatically and so will all their ancestors. Activating any of the buttons is equivalent to activating the node in the TOC.
The results can be saved as a UserClass (entry widgets ta bottom of window). A UserClass name can be any case-insensitive alpha string without whitespace. An optional Description can also be given. The UserClass can then be used for futher seaches (see above) or combined in Boolean operations (see below).
This menu offers the ability to combine UserClasses with simple Boolean
operations. The user can carry or any operation:
userclass1 operator userclass2
where operator is AND, OR or NOT. The queries can be constructed
by picking the UserClasses and the Operators from buttons. (More complex
queries could be parsed, but I feel it's best to proceed in small steps
and save inetrmediate results).
There are also tools for managing existing UserClasses (deletion, renaming, etc.).
NOTE: Like much else, this is still experimental. :-)
Peter Murray-Rust
April 1996