Interactive Query for CDS/ISIS Search System

Introducing IQUERY© v1.0.3 Engine

Access:

August 1996



Description
IQUERY is a software designed to run under three plattforms, Linux, SCO and DOS. The system was designed to act as an interactive search engine for Mini Micro CDS/ISIS DataBases, it was developed taking the directives showed in the ISIS 3.0 version. The software can run in three different modes, as an interactive command shell, as a CGI to run under WWW servers, and as an interpreter taking the statements from a file.

How it Works
When you start up IQUERY, the fisrt thing, is search for the SYSPAR.PAR file in the default ISIS install path defined by IQUERY ( '/usr/local/isis-3.0/' for Linux and SCO or 'C:\ISIS\' for DOS) or the path that you can pass to the program with the '-conf absolute_path' parameter, in that file is searched for the DataPath that is where your databases files reside in ( IQUERY also recognizes that you can have your files redirected by the dbn.PAR file where dbn is the Data Base Name), from there, it changes to one of the three modalities: shell, html or file. In any of the modalities IQUERY reads and process one line at a time showing the results in the standard output terminal.
Keep in mind that when you pass an 'absolute_path' with the '-conf' parameter this path must have the final slash, this is, if your 'SYSPAR.PAR' is located in the 'isis' directory under '/usr' your parameter would be '/usr/isis/' and NOT '/usr/isis'.
The Search Engine has two special parameters to play with, there are '-nocase' permitting you the search of KeyWords case insensitive, and '-nostrict' that consider all the blank spaces in the beginning and end of the KeyWord to find for, case sensitive searchs and strict delete of blank spaces is the default for IQUERY.
The line below describes all the parameters to IQUERY, refer to the Specification for HTML for a complete explanation on how IQUERY works for httpd CGI interfaces.

iquery [ -conf isis_path ][ -html | -file absolute_path_to_file ] [ -nocase ] [ -nostrict ]

Statements recognized.
#FILEPRINT FileName Reads the file identified by 'FileName' and outputs its contents. Note that 'FileName' would be an absolute file path or a relative one ( relative to the isis system path).
#STRPRINT OutputString This statement prints the 'OutputString', this string can be of any format, but be carefull when you are in HTML (read the Specification for HTML later in this document).
#OPEN DBFile:DBAlias Open the Data Base file determined by 'DBFile' and build inside IQUERY all the structures necessary to manage the information, from there, this Data Base is refered as 'DBAlias'.
#CLOSE DBAlias Closes and freeis the memory of the Data Base file structure that was created by a previous OPEN statement.
#CLOSEALL Do a 'CLOSE DBAlias' for any open alias in the internal IQUERY Data Base Structure.
#


SELECT
FROM
WHERE
OutputFormat
DBFile_1:DBAlias_1, ...
QueryCondition
First the SELECT statement opens all the comma separated DBFile_x associating DBAlias_x, and those alias/files were maintained open as long as IQUERY terminates or when a CLOSE statement is encountered. Iterates along the Data Base, secuential or indexed, and for those registers that match the 'QueryCondition' prints in the standard output the 'OutputFormat', read later in this document the Field Replacement Section, to understand how to build in IQUERY SELECT statements, the 'OutputFormat' and 'QueryCondition' fields.
#VERSION Prints IQUERY version and some information about registered version or the Trial up expiration date, only works in shell mode.

Field Replacement
Each field in each register has two identifers, Field Tag and Field Name, and also you may have more than one open Alias corresponding to different Data Base Files, thus, we need to set a convention on naming each field in each Alias in some part of the output string or in a query condition of a SELECT statement.
When you are constructing the 'QueryCondition' you have to put your query like: DBAlias, followed by a '.', the Tag Number, the match separator '=', and finally the string that you have to match. The matches will be reached by default when the string is part of the field in the record, if you would like to change this type of match be sure to check the Match String/Integers Modifiers below. For example, i have to select in the alias CORPORATION those records that have in the Tag number 40 ( that is identified also by the Field Name 'Section') the string 'Sales', then my 'QueryCondition' must be 'CORPORATION.40=Sales'.
Also it's possible to write QueryConditions including boolean operators joining two or more conditions in a query which is very common in database searching to narrow down the search request, be sure to check later the Boolean Operators section.
The format of the 'OutputFormat' is so similar, you can put anything you want that will be printed when a match is found, and when you would like to replace a Field Value in the string, you have to put there a '%' Field Replacement Character folowed by the DBAlias, a '.' and finally the Tag Number of the field. Continuing with the example in the previous paragraph, now i would like to output the Tag numer 20 ( that is identified also by the Field Name 'Employer's Name'), so, my 'OutputFormat' must be '%CORPORATION.20', if you also would like to output the real character '%' then you have to put a '%%' to say IQUERY that ignores the Field Replacement function.
Of course this is not the format used in CDS/ISIS program, this is because the software is oriented to WWW Clients that have its own Format Macro Language, unless you can use it in text only format. Also in this IQUERY version there isn't a way to extract a Sub Field nor defining a block of repeatable extraction, i'm working now in this features for a newer version...

Match String/Integer Modifiers
The match string modifier is the first character in the string you want to match, and the actions taken are described below...

'=' Match exactly the string passed, i.e., 'ALIAS.40==Sales' match for 'Sales' and do not match for 'Sales Representative'.
'!' Is the complement of the '=' modifier, do not match for 'Sales', and match for 'Sales Representative or any other field string value.
'~' Do not match those fields that have the match string inside, i.e, 'ALIAS.40=~Sales', do not match for 'Sales', 'Sales Representative' or 'Dept. of Sales', and do match for 'February Sale' or any other.
'^' Match those fields that begins with the match string passed, the match were reached for 'Sales' and do not for 'Sales Representative' or 'Corp. Sales'.
'>' This applies only to a integer filed, this is, if you want to match those fields that are greater than some integter you must put this modifier. The condition 'ALIAS.60=>45' match those records that have persons of 45 years old or more having the tag 60 corresponding to the description Employee's name.
'<' This is the complement of the above modifier, that is, if you want to match records having integer fields less than some integer value, the last chance is if you want to match fields having and exact integer value, you have to use the '=' sign as for the string exact matching, the type conversion will be done automatically.
'\' Is the escape char, for example if your fields have in its first position any of the Modifiers Characters and you'd like to match exactly for '^Sales-Rep', then your match string must be '\^Sales-Rep'.

Boolean Operators
It's so difficult to think in good QueryConditions without boolean operators, you need this feature to join two or more conditions building more complex expressions, as an example, suppose you have to do a query that match for some Country and also a Description, so you need to put in your QueryCondition two expressions joined by an AND. IQUERY have included the two necessary boolean operators: %AND and %OR. As an example suppose you has a Library DataBase and your job consist in matching those books that were edited in 'Uruguay' and has 'Computers Architecture' in it's Description, so your QueryCondition will be: 'ALIAS.80==Uruguay %AND ALIAS.90=Computers Architecture' having the tags 80 and 90 as Country and Description. You can build QueryConditions of more than two match statements joining with %AND and %OR's.

Specification for HTML
In shell mode or file mode, there is no mystery, the statement you enter is the order that IQUERY will process and the iquery program could be installed in any directory; in html mode there are three things that you have to keep in mind when you pass data to the IQUERY CGI.
First, you have to link or copy your iquery program to your CGI execute path and rename it to iquery.cgi or do anything you want that permits the httpd server to execute iquery. Also, you have to learn the HTML code to build FORMS (maybe you are a doctor in that), and the convention to pass data to a CGI, the prefered method of passing data to IQUERY is POST, in any case GET is also covered by IQUERY.
Second, if you would like to pass more than one command line parameter to a CGI, the HTML interface only can pass the first, that's why I added a variable that you must call 'HTMLPARAMS' to pass there the other parameters like '-nocase' and '-nostrict', and you have to pass only '-html' parameter to the CGI.
Third, IQUERY takes the statements from the 'QUERY' variable, so when you are writing an IQUERY code you must have to put it in a variable called 'QUERY', inside this variable IQUERY takes its order statements ignoring spaces and CR's/LF's (like HTML code), and translate the ';' character as a CR/LF, so the line 'strprint hi world; strprint bye', will be translated inside IQUERY as
strprint hi world
strprint bye
processing 'strprint hi world' and then 'strprint bye', if you forget to put the ';' in the end of each statement in your code, IQUERY understands nothing.

Macro Substitution
Up to here, you have the knowledge for writing IQUERY code for static orders, now i will explain how you can write a code to pass inside the 'QUERY' variable a macro substitution to tell IQUERY to replace that macro with a real value.
A Macro Substitution will occur when you put the beginning macro character '$' followed by a '{', the variable name and the close macro character '}', when IQUERY finds a macro, try to obtain the real value from the variable that has a name equal to the name of the macro, for example the statement 'strprint ${SEARCH}' will be interpreted inside IQUERY as a print out of the value of the variable 'SEARCH' passed to IQUERY. Also you have to know that IQUERY does the macro substitution before the execution of the first statement has passed.

IQUERY Examples
Employees Corporation Database. This is a simple example putting all the information in this document together. I make a separate html page for the real form & query code explanation so you can view or save in a simple action of 'View -> Document Source'.

Spanish Web Servers This is a real IQUERY example of a search in a CDS/ISIS DataBase that have information for all the Spanish Web Hosts maintained here by Marcelo Kruk.

DOWNLOAD!!!
IQUERY© v1.0.3b trial version


WebEdition and IQUERY Design by Alejandro Ferreira Guido.