Okapi-Pack 

Centre For Interactive Systems Research 
City University 
London EC1V 0BH 


Using The BSS: Examples. 


There are various ways in which the BSS may be used to perform searches on a database, for example:

  1. Using the Command Line Interface "i1+".
  2. Calling "i1+" from Perl Scripts.
  3. Calling i0() from C Programs.
First ensure that:
  1. <BSS_PARMPATH> has been set to the correct path.
  2. <OKAPI_ROOT>/bin (or wherever you have placed i1+) is in your search path.


1. Using the Command Line Interface "i1+"

The program may be run by typing its name (no parameters) at the Unix prompt. Doing this will result in the i1+ prompt (U: ) being displayed. E.g.
    (gladys.is.city.ac.uk)148%   i1+
    U:
Users may now type BSS commands at the prompt. The following example shows a search for "heart attack thrombosis cardiac arrest" on the sample database "med.sample". BSS commands are shown in bold; returned results are shown in italics. Note: At the end of the bestmatch search (using BM25) the first record from the result set is shown using two different show formats
    (gladys.is.city.ac.uk)148%   i1+
    U:   ch   med.sample
    U:   sp   t=heart attack thrombosis cardiac arrest
    5   t=heart   c=N   s=heart   t=attack   c=N   s=attack   t=thrombosis   c=N s=thrombosis
    t=cardiac   c=N   s=cardiac   t=arrest   c=N   s=arrest
    U:   f   t=heart
    S0   np=50   t=heart
    U:   w   fn=2   r=0   bigr=0   rload=4   bigrload=5   n=50
    4.068
    U:   f   t=attack
    S1   np=7   t=attack
    U:   w   fn=2   r=0   bigr=0   rload=4   bigrload=5   n=7
    6.018
    U:   f   t=thrombosis
    S2   np=3   t=thrombosis
    U:   w   fn=2   r=0   bigr=0   rload=4   bigrload=5   n=3
    6.784
    U:   f   t=cardiac
    S3   np=49   t=cardiac
    U:   w   fn=2   r=0   bigr=0   rload=4   bigrload=5   n=49
    4.089
    U:   f   t=arrest
    S4   np=12   t=arrest
    U:   w   fn=2   r=0   bigr=0   rload=4   bigrload=5   n=12
    5.502
    U:   f   s=0   w=4.068   s=1   w=6.018   s=2   w=6.784   s=3   w=4.089   s=4   w=5.502   op=bm25
    S5   np=92   maxwt=12.782   nmaxwt=1   ngw=92   mpw=58.214   nmpw=0
    U:   s   r=0
    Record 0 Weight 12.782
    1: med-0114

    3: congenital heart disease in the adult.
    events in the natural course of 310 adult patients with proved significant congenital cardiac anomalies have been reviewed to determine incidence, longevity, complications and cause of death. atrial septal defect and patent ductus arteriosus were the most frequently encountered lesions and comprised over one third of the entire series. ventricular septal defect and pulmonic stenosis made up almost a quarter of the group. twenty-two instances of the eisenmenger syndrome secondary to a variety of shunting lesions are included. bacterial endocarditis, sudden death and cardiac decompensation were the greatest threats to these patients. symptoms were minimal until the appearance of heart failure, which was the most common cause of death, especially with older patients. sudden death occurred most often in patients with ventricular septal defect. although the clinical features are usually characteristic of a congenital malformation, young adults with acyanotic congenital heart disease are often misdiagnosed as rheumatic,. and in older patients, presenting manifestations are frequently attributed to arteriosclerotic heart disease. at times an associated acquired cardiovascular disorder may alter the basic syndrome. three quarters of the patients survive and continue under observation the ability of many to live active, productive lives and to withstand stress, surgery, both cardiac and non-cardiac, and pregnancy was impressive. further observation of the patient with congenital heart disease but without surgical intervention is essential for accurate evaluation of the long term efficacy of cardiac surgery.

    U: s f=259 r=0
    00001991                                                        0000000000500000000000000000114000012.782000
                  000317003001000000000000000900200000009000000000030000000900001665000
    000000009A0000002000000005A0000013400000007A0000062000000007A000007340000
    0005 A0000102700000005A0000117400000005A0000143700000007A0000154300000005
    A0000165700000007med-0114
    congenital heart disease in the adult. events in the natural course of 310 adult patients with proved significant congenital cardiac anomalies have been reviewed to determine incidence, longevity, complications and cause of death. atrial septal defect and patent ductus arteriosus were the most frequently encountered lesions and comprised over one third of the entire series. ventricular septal defect and pulmonic stenosis made up almost a quarter of the group. twenty-two instances of the eisenmenger syndrome secondary to a variety of shunting lesions are included. bacterial endocarditis, sudden death and cardiac decompensation were the greatest threats to these patients. symptoms were minimal until the appearance of heart failure, which was the most common cause of death, especially with older patients. sudden death occurred most often in patients with ventricular septal defect. although the clinical features are usually characteristic of a congenital malformation, young adults with acyanotic congenital heart disease are often misdiagnosed as rheumatic,. and in older patients, presenting manifestations are frequently attributed to arteriosclerotic heart disease. at times an associated acquired cardiovascular disorder may alter the basic syndrome. three quarters of the patients survive and continue under observation the ability of many to live active, productive lives and to withstand stress, surgery, both cardiac and non-cardiac, and pregnancy was impressive. further observation of the patient with congenital heart disease but without surgical intervention is essential for accurate evaluation of the long term efficacy of cardiac surgery.

    U:


2. Calling "i1+" from Perl Scripts

There are two sample Perl scripts shown in Appendix L.  The script search.pl reads a set of query terms from a file, gets their number of postings from BSS, weights the terms using the BSS weighting function and searches ft_96 database using weighted operator bm2500. Another script record_number.pl retrieves the first 200 records in the database by their internal record number.

Perl scripts call i1+ using the standard Perl library module IPC::Open2, which establishes a bi-directional communication with the BSS.


3. Calling i0() from C Programs.

There are many examples that can be seen from the source code for the okapi GUI. A simpler application that reads some terms from a file, forms a bestmatch set and then displays the first five documents from the set is shown in Appendix L. The source code and Makefile for this program can be found in <OKAPI_ROOT>/using_the_bss/c_examples.

The steps to be performed when writing an application are:

    Initialise bss (call iinit())
    open database

    repeat

      input command
      send command to bss
      parse results
      act on results
    until command = quit

    Exit BSS (call iexit()
     
     



Okapi-Pack Main Menu  Mail Okapi Support  Registration 


Last modified:   12th November 2001