kfr@dip.eecs.umich.edu (K. Fritz Ruehr) (11/29/89)
A friend of mine is in a Library and Info Sciences program and is building a demonstration stack to show off the usefulness of Hypercard as a user inter- face for bibliographic databases. He is looking for a way to do "Boolean searches" over keywords in a stack (i.e., Boolean combinations of keywords, such as: "'hyper' and 'nifty' and not 'expensive'"). I can direct him to commercial products such as HyperKRS from Knowledge Set, but at $195 I'm sure this is out of his price range. Sooo, ... Does anyone know of public domain or shareware offerings that will give this capability in a stack? I imagine that XCMDs or XFCNs would be the best way to do this, but hand-coding in HyperTalk might be feasible. Any help would be greatly appreciated. Thanks in advance. -- Fritz Ruehr kfr@dip.eecs.umich.edu
krona@nada.kth.se (Kjell Krona) (12/06/89)
There is several ways to do this in HyperTalk. I will briefly outline three of them: 1) Start with the HyperCard "find" on the words you want to find. Then, do a string search to check if the words you do NOT want to find are present; if so restart the HyperCard find, else the search is over (you might want to remember the card and continue the search until you found all hits). 2) Start with the HyperCard "find" as above; after a hit, remember the ID of the card, and do a HyperCard "find" on the words that should NOT be present; if you get a hit, check whether the ID of the card is the same; if not, or if the "find" does not succed, the card you found originally was correct. This is propably faster if the fields contains a very large amount of text. 3) Do a HyperCard "find" on the words you want to find, and repeat until you found all hits; then, do a HyperCard "find" on the words you do NOT want to find, and record these hits also. Finally, compare them; all cards in the first list which do not occur in the second are the final hits. I can not vote for the relativa efficency of the above methods. Generally, if you want to do anything complicated to a long text, it is better to recode this is Pascal or C; about a year ago I made som XCMDs to compare two strings and find all substrings that were equal. This was about 30 times faster than in HyperTalk. For small amounts of text, however, the savings are insignificant. The techniques outlined above can be expanded to cover the problem of having different terms i different fields: for example, find "name = John" and "street =/= Fifth Avenue". One way to do this is to store the "true" words in one container, the "false" in another, and the field names in a third. Then, repeat for the number of lines in the containers. This is merely a short outline of some possible methods. - kjell