Oracle8i interMedia Text Reference
Release 2 (8.1.6)

Part Number A77063-01

Library

Product

Contents

Index

Go to previous page Go to beginning of chapter Go to next page

CTX_THES Package, 4 of 26


BT

This function returns all broader terms of a phrase as recorded in the specified thesaurus.

Syntax 1: Table Result

CTX_THES.BT(restab IN OUT NOCOPY EXP_TAB,
            phrase IN VARCHAR2, 
            lvl    IN NUMBER DEFAULT 1,
            tname  IN VARCHAR2 DEFAULT 'DEFAULT');

Syntax 2: String Result

CTX_THES.BT(phrase IN VARCHAR2, 
            lvl    IN NUMBER DEFAULT 1,
            tname  IN VARCHAR2 DEFAULT 'DEFAULT') 
RETURN VARCHAR2;
restab

Optionally, specify the name of the expansion table to store the results. This table must be of type EXP_TAB which the system defines as follows:

type exp_rec is record (
    xrel varchar2(12),
    xlevel number,
    xphrase varchar2(256)
);
type exp_tab is table of exp_rec index by binary_integer;

See Also:

For more information about EXP_TAB, see "CTX_THES Result Tables and Data Types" in Appendix B, "Result Tables".  

phrase

Specify phrase to lookup in thesaurus.

lvl

Specify how many levels of broader terms to return. For example 2 means get the broader terms of the broader terms of the phrase.

tname

Specify thesaurus name. If not specified, system default thesaurus is used.

Returns

This function returns a string of broader terms in the form:

 {bt1}|{bt2}|{bt3} ...

Example

String Result

Consider a thesaurus named MY_THES that has an entry for cat as follows:

cat 
   BT1 feline 
     BT2 mammal 
       BT3 vertebrate 
         BT4 animal

To look up the broader terms for cat up to two levels, issue the following statements:

declare 
  terms varchar2(2000); 
begin 
  terms := ctx_thes.bt('CAT', 2, 'MY_THES'); 
  dbms_output.put_line('The broader expansion for CAT is: '||terms); 
end; 

This code produces the following output:

The broader expansion for CAT is: {cat}|{feline}|{mammal}

Table Result

The following code does an broader term lookup for white wolf using the table result:

declare
  xtab ctx_thes.exp_tab;
begin
  ctx_thes.bt(xtab, 'white wolf', 2, 'my_thesaurus');
  for i in 1..xtab.count loop
    dbms_output.put_line(lpad(' ', 2*xtab(i).xlevel) || 
    xtab(i).xrel || ' ' || xtab(i).xphrase);
  end loop;
end;

This code produces the following output:

PHRASE WHITE WOLF
  BT WOLF
    BT CANINE
      BT ANIMAL

Related Topics

OUTPUT_STYLE

Broader Term (BT, BTG, BTP, BTI) Operators in Chapter 4


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index