Oracle CTX_THES
Version 21c

General Information
Library Note Morgan's Library Page Header
Which has the higher priority in your organization: Deploying a new database or securing the ones you already have? Looking for a website, and resources, dedicated solely to securing Oracle databases? Check out DBSecWorx.
Purpose Context Thesaurus and Translation Utilities used to manage and browse thesauri primarily based on the ISO-2788 and ANSI Z39.19 standards.

Knowing how information is stored in your thesaurus helps in writing queries with thesaurus operators. A thesaurus can also be used to extend the knowledge base, such as for ABOUT queries in English and French and for generating document themes.
AUTHID DEFINER
Constants
Name Data Type Value
 Public
OP_PT VARCHAR2(2) 'PT'
OP_RENAME VARCHAR2(6) 'RENAME'
OP_SN VARCHAR2(2) 'SN'
OP_TRUNCATE VARCHAR2(8) 'TRUNCATE'
Data Types 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;
Dependencies
DBMS_STANDARD DRITHS DRVDISP
DR$THS_BT DRITHSC DRVDOC
DR$THS_FPHRASE DRITHSX DRVUTL
DR$THS_PHRASE DRIUTL DR_DEF
DRIG DRIXMD PLITBLM
DRILIST DRUE  
Documented Yes: Packages and Types Reference
Exceptions
Error Code Reason
DRG-11704 Phrase <string> does not exist
First Available Not known
Security Model Owned by CTXSYS with EXECUTE granted to MDSYS and PUBLIC
Source {ORACLE_HOME}/ctx/admin/dr0thes.pkh
Subprograms
 
ALTER_PHRASE
Modify a thesaurus phrase ctx_thes.alter_phrase(
tname   IN VARCHAR2,
phrase  IN VARCHAR2,
op      IN VARCHAR2,
operand IN VARCHAR2 DEFAULT NULL);
PRAGMA SUPPLEMENTAL_LOG_DATA(alter_phrase, AUTO);
TBD
 
ALTER_THESAURUS
Renames or truncates a thesaurus ctx_thes.alter_thesaurus(
tname   IN VARCHAR2,
op      IN VARCHAR2,
operand IN VARCHAR2 DEFAULT NULL);
PRAGMA SUPPLEMENTAL_LOG_DATA(alter_thesaurus, AUTO);
TBD
 
BT
Returns all broader, terms of a phrase

Overload 1
ctx_thes.bt(
phrase IN VARCHAR2,
lvl    IN NUMBER   DEFAULT 1,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.bt(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
lvl    IN            NUMBER   DEFAULT 1,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
BTG
Returns all broader, terms generic of a phrase

Overload 1
ctx_thes.btg(
phrase IN VARCHAR2,
lvl    IN NUMBER   DEFAULT 1,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.btg(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
lvl    IN            NUMBER   DEFAULT 1,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
BTI
Returns all broader, terms instance of a phrase

Overload 1
ctx_thes.bti(
phrase IN VARCHAR2,
lvl    IN NUMBER   DEFAULT 1,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.bti(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
lvl    IN            NUMBER   DEFAULT 1,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
BTP
Returns all broader, terms partitive of a phrase

Overload 1
ctx_thes.btp(
phrase IN VARCHAR2,
lvl    IN NUMBER   DEFAULT 1,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.btp(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
lvl    IN            NUMBER   DEFAULT 1,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
CREATE_PHRASE
Adds a phrase to the specified thesaurus ctx_thes.create_phrase(
tname   IN VARCHAR2,
phrase  IN VARCHAR2,
rel     IN VARCHAR2 DEFAULT NULL,
relname IN VARCHAR2 DEFAULT NULL);
PRAGMA SUPPLEMENTAL_LOG_DATA(create_phrase, AUTO);
Deprecated: Oracle recommends using CREATE_RELATION, See Below
 
CREATE_RELATION
Creates a relationship between two phrases ctx_thes.create_relation(
tname     IN VARCHAR2,
phrase    IN VARCHAR2,
rel       IN VARCHAR2,
relphrase IN VARCHAR2);
PRAGMA SUPPLEMENTAL_LOG_DATA(create_relation, AUTO);
See CREATE_TRANSLATION Demo Below
 
CREATE_THESAURUS
Creates the specified thesaurus ctx_thes.create_thesaurus(
name     IN VARCHAR2,
casesens IN BOOLEAN DEFAULT FALSE);
PRAGMA SUPPLEMENTAL_LOG_DATA(create_thesaurus, AUTO);
exec ctxsys.ctx_thes.create_thesaurus('UWTHES', TRUE);

PL/SQL procedure successfully completed.

SELECT * FROM ctxsys.dr$ths;

 THS_ID THS_NAME                  THS_OWNER# T
------- ------------------------- ---------- -
      1 UWTHES                             0 Y
 
CREATE_TRANSLATION
Creates a new translation for a phrase ctx_thes.create_translation(
name        IN VARCHAR2,
phrase      IN VARCHAR2,
language    IN VARCHAR2,
translation IN VARCHAR2);
PRAGMA SUPPLEMENTAL_LOG_DATA(create_translation, AUTO);
-- create relation
exec ctxsys.ctx_thes.create_relation('UWTHES', 'Que Pasa', 'BT', 'What''s Up');

PL/SQL procedure successfully completed.

col thp_id format 9999
col thp_thsid format 999
col thp_ringid format 999
col thp_phrase format a15
col thp_qualify format a15
col thp_note format a15

SELECT * FROM ctxsys.dr$ths_phrase;

THP_ID THP_THSID THP_PHRASE      THP_QUALIFY     THP_NOTE        THP_RINGID
------ --------- --------------- --------------- --------------- ----------
     5         4 Que Pasa
     6         4 What's Up


-- create translation
exec ctxsys.ctx_thes.create_translation('UWTHES', 'Que Pasa', 'English', 'What''s Happening');

PL/SQL procedure successfully completed.

col thf_phrase format a20

SELECT * FROM ctxsys.dr$ths_fphrase;

THF_THP_ID  THF_PHRASE            THF_TYPE
----------  --------------------- ----------
         5  What's Happening      ENGLISH
 
DROP_PHRASE
Removes a phrase from a thesaurus ctx_thes.drop_phrase(
tname  IN VARCHAR2,
phrase IN VARCHAR2);
PRAGMA SUPPLEMENTAL_LOG_DATA(drop_phrase, AUTO);
TBD
 
DROP_RELATION
Removes a relationship between two phrases ctx_thes.drop_relation(
tname     IN VARCHAR2,
phrase    IN VARCHAR2,
rel       IN VARCHAR2,
relphrase IN VARCHAR2 DEFAULT NULL);
PRAGMA SUPPLEMENTAL_LOG_DATA(drop_relation, AUTO);
TBD
 
DROP_THESAURUS
Drops a thesaurus ctx_thes.drop_thesaurus(name IN VARCHAR2);
PRAGMA SUPPLEMENTAL_LOG_DATA(drop_thesaurus, AUTO);
exec ctxsys.ctx_thes.drop_thesaurus('UWTHES');

PL/SQL procedure successfully completed.
 
DROP_TRANSLATION
Drops a thesaurus translation ctx_thes.drop_translation(
tname       IN VARCHAR2,
phrase      IN VARCHAR2,
language    IN VARCHAR2 DEFAULT NULL,
translation IN VARCHAR2 DEFAULT NULL);
PRAGMA SUPPLEMENTAL_LOG_DATA(drop_translation, AUTO);
TBD
 
EXPORT_THESAURUS
Exports a thesaurus from the thesaurus tables ctx_thes.export_thesaurus(
name     IN            VARCHAR2,
thesdump IN OUT NOCOPY CLOB);
TBD
 
HAS_RELATION
Tests for the existence of a thesaurus relationship ctx_thes.has_relation(
phrase IN VARCHAR2,
rel    IN VARCHAR2,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN BOOLEAN;
TBD
 
IMPORT_THESAURUS
Imports a thesaurus into the thesaurus tables ctx_thes.import_thesaurus(
name     IN VARCHAR2,
data     IN CLOB,
casesens IN VARCHAR2 DEFAULT 'N');
PRAGMA SUPPLEMENTAL_LOG_DATA(import_thesaurus, AUTO);
TBD
 
NT
Returns all narrower, terms of a phrase

Overload 1
ctx_thes.nt(
phrase IN VARCHAR2,
lvl    IN NUMBER   DEFAULT 1,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.nt(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
lvl    IN            NUMBER   DEFAULT 1,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
NTG
Returns all narrower, terms generic of a phrase

Overload 1
ctx_thes.ntg(
phrase IN VARCHAR2,
lvl    IN NUMBER   DEFAULT 1,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.ntg(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
lvl    IN            NUMBER   DEFAULT 1,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
NTI
Returns all narrower, terms instance of a phrase

Overload 1
ctx_thes.nti(
phrase IN VARCHAR2,
lvl    IN NUMBER   DEFAULT 1,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.nti(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
lvl    IN            NUMBER   DEFAULT 1,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
NTP
Returns all narrower, terms partitive of a phrase

Overload 1
ctx_thes.ntp(
phrase IN VARCHAR2,
lvl    IN NUMBER   DEFAULT 1,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.ntp(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
lvl    IN            NUMBER   DEFAULT 1,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
OUTPUT_STYLE
Sets the output style for the expansion functions ctx_thes.output_style(
showlevel   IN BOOLEAN DEFAULT FALSE,
showqualify IN BOOLEAN DEFAULT FALSE,
showpt      IN BOOLEAN DEFAULT FALSE,
showid      IN BOOLEAN DEFAULT FALSE);
exec ctxsys.ctx_thes.output_style(TRUE, TRUE, TRUE, FALSE);

PL/SQL procedure successfully completed.
 
PT
Returns the preferred term of a phrase

Overload 1
ctx_thes.pt(
phrase IN VARCHAR2,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.pt(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
RT
Returns the related terms of a phrase

Overload 1
ctx_thes.rt(
phrase IN VARCHAR2,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.rt(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
SN
Returns scope note for phrase ctx_thes.sn(
phrase IN VARCHAR2,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
 
SYN
Returns the synonym terms of a phrase

Overload 1
ctx_thes.syn(
phrase IN VARCHAR2,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.syn(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
THES_TT
Returns all top terms for phrase ctx_thes.thes_tt(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
TR
Returns the foreign equivalent of a phrase

Overload 1
ctx_thes.tr(
phrase IN VARCHAR2,
lang   IN VARCHAR2,
tname  IN VARCHAR2)
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.tr(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
lang   IN            VARCHAR2,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
TRSYN
Returns the foreign equivalent of a phrase, synonyms of the phrase, and foreign equivalent of the synonyms

Overload 1
ctx_thes.trsyn(
phrase IN VARCHAR2,
lang   IN VARCHAR2,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.trsyn(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
lang   IN            VARCHAR2,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
TT
Returns the top term of a phrase

Overload 1
ctx_thes.tt(
phrase IN VARCHAR2,
tname  IN VARCHAR2 DEFAULT 'DEFAULT')
RETURN VARCHAR2;
TBD
Overload 2 ctx_thes.tt(
restab IN OUT NOCOPY ctxsys.ctx_thes.exp_tab,
phrase IN            VARCHAR2,
tname  IN            VARCHAR2 DEFAULT 'DEFAULT');
TBD
 
UPDATE_TRANSLATION
Updates an existing translation ctx_thes.update_translation(
tname           IN VARCHAR2,
phrase          IN VARCHAR2,
language        IN VARCHAR2,
translation     IN VARCHAR2,
new_translation IN VARCHAR2);
PRAGMA SUPPLEMENTAL_LOG_DATA(update_translation, AUTO);
TBD

Related Topics
Built-in Functions
Built-in Packages
Database Security
CTX_ADM
CTX_ANL
CTX_CATSEARCH
CTX_CLS
CTX_CONTAINS
CTX_DDL
CTX_DOC
CTX_ENTITY
CTX_MATCHES
CTX_OUTPUT
CTX_QUERY
CTX_REPORT
CTX_TREE
CTX_ULEXER
CTX_XPCONTAINS
What's New In 19c
What's New In 20c-21c

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2022 Daniel A. Morgan All Rights Reserved
  DBSecWorx