MINI MINI MANI MO
rem
rem Copyright (c) 1999, 2017, Oracle and/or its affiliates.
rem All rights reserved.
rem
rem NAME
rem drithsc.pkh - Spec for ConText Option thesaurus package
rem
rem DESCRIPTION
rem thesaurus Creation functions
rem
rem NOTES
rem
rem
rem BEGIN SQL_FILE_METADATA
rem SQL_SOURCE_FILE: ctx_src_2/src/dr/admin/drithsc.pkh
rem SQL_SHIPPED_FILE: ctx/admin/drithsc.pkh
rem SQL_PHASE: DRITHSC_PKH
rem SQL_STARTUP_MODE: NORMAL
rem SQL_IGNORABLE_ERRORS: NONE
rem SQL_CALLING_FILE: ctx/admin/ctxpkh.sql
rem END SQL_FILE_METADATA
rem
rem MODIFIED (MM/DD/YY)
rem surman 01/23/15 - 20411134: Add SQL metadata tags
rem surman 03/15/13 - 16473661: Common start and end scripts
rem hsarkar 08/23/11 - Logical Standby Support part2
rem hsarkar 05/18/11 - Bug 12384142
rem surman 09/09/03 - 3101316: Add drop_user_thesauri
rem ehuang 12/01/99 - add update_translation
rem ehuang 04/22/99 - add maintenance api
rem gkaminag 03/09/99 - creation
@@?/rdbms/admin/sqlsessstart.sql
CREATE OR REPLACE PACKAGE drithsc AS
-- last phrase id for TR
pv_last_id number;
/*-------------------------- check_thesaurus_exists ------------------------*/
/*
NAME
check_thesaurus_exists
DESCRIPTION
check if thesaurus already exists
ARGUMENTS
tname (IN) thesaurus name
RETURN
0 for thesaurus does not exist
1 for thesaurus exists
NOTES
*/
function check_thesaurus_exists (
tname in varchar2)
return number;
/*---------------------------- create_thesaurus -------------------------*/
/*
NAME
create_thesaurus
DESCRIPTION
create a new, empty thesaurus
ARGUMENTS
tname (IN) thesaurus name
casesens (IN) case-sensitivity
RETURN
new thesaurus ID
NOTES
error if thesaurus already exists
*/
function create_thesaurus(
tname in varchar2,
casesens in boolean default false)
return number;
procedure create_thesaurus_lsb(
lv_id in number,
tname in varchar2,
casesens in boolean default false
);
PRAGMA SUPPLEMENTAL_LOG_DATA(create_thesaurus_lsb, AUTO);
/*---------------------------- drop_thesaurus -------------------------*/
/*
NAME
drop_thesaurus - drop a thesaurus
DESCRIPTION
This procedure drops an existing thesaurus with the indicated name
ARGUMENTS
tid -- thesaurus id
NOTES
no error if the thesaurus does not exist
*/
procedure drop_thesaurus(tid in number);
/*------------------------ drop_user_thesauri -------------------------*/
/*
NAME
drop_user_thesauri - drops thesauri owner by a user
DESCRIPTION
This procedure drops all thesauri owned by the indicated user. If
the username is null, then all thesauri owned by non-existent users
are dropped (called by ctx_adm.recover).
ARGUMENTS
user_name
*/
procedure drop_user_thesauri(user_name in varchar2 := null);
/*------------------------- trunc_thesaurus -------------------------*/
/*
NAME
trunc_thesaurus - truncate a thesaurus
DESCRIPTION
This procedure truncate a thesaurus
ARGUMENTS
tid -- thesaurus id
NOTES
*/
procedure trunc_thesaurus(tid in number);
/*------------------------- rename_thesaurus -------------------------*/
/*
NAME
rename_thesaurus - rename a thesaurus
DESCRIPTION
This procedure rename a thesaurus
show
ARGUMENTS
tid -- thesaurus id
tname -- new thesaurus name
NOTES
*/
procedure rename_thesaurus(
tid in number,
tname in varchar2
);
/*---------------------------- create_phrase -------------------------*/
/*
NAME
create_phrase -- add a phrase to a thesaurus
DESCRIPTION
This procedure adds a phrase, or information about the phrase,
to the thesaurus.
ARGUMENTS
tid -- thesaurus id
tcs -- TRUE if thesaurus is case-sensitive
phrase -- phrase to add/modify
rel -- relationship type
id -- relationship id
NOTES
no error if the phrase already exists.
note funny order of arguments. PHRASE is the REL of RELID.
Thus, create_phrase(123, 'animal', 'BT', <id of dog>)
RETURN
created phrase id
*/
function create_phrase (
tid in number,
tcs in boolean,
phrase in varchar2,
rel in varchar2 default null,
relid in number default null
) return number;
procedure create_phrase_lsb(
tid in number,
tcs in boolean,
phrase in varchar2,
rel in varchar2 default null,
relid in number default null,
retval in out number
);
PRAGMA SUPPLEMENTAL_LOG_DATA(create_phrase_lsb, AUTO);
/*---------------------------- drop_phrase -------------------------*/
/*
NAME
drop_phrase -- drop a phrase from a thesaurus
DESCRIPTION
This procedure drops a phrase from the thesaurus
ARGUMENTS
phrid -- phrase id
NOTES
RETURN
*/
procedure drop_phrase (
phrid in number
);
/*--------------------------- rename_phrase -------------------------*/
/*
NAME
create_phrase -- rename a phrase in a thesaurus
DESCRIPTION
This procedure renames a phrase
ARGUMENTS
phrid -- phrase id
phrase -- phrase to add/modify
NOTES
RETURN
*/
procedure rename_phrase (
phrid in number,
phrase in varchar2
);
/*------------------------------- make_pt -----------------------------*/
/*
NAME
make_pt -- name a phrase the preferred term
DESCRIPTION
This procedure makes a phrase the preferred term
ARGUMENTS
phrid -- phrase id
NOTES
RETURN
*/
procedure make_pt (
phrid in number
);
/*----------------------------- change_sn -----------------------------*/
/*
NAME
change_sn -- change the scope notes of a phrase
DESCRIPTION
This procedure changes the scope notes of a phrase
ARGUMENTS
phrid -- phrase id
sn -- new scope notes
NOTES
RETURN
*/
procedure change_sn (
phrid in number,
sn in varchar2
);
/*------------------------------- create_tr -----------------------------*/
/*
NAME
create_tr -- add a translation to a thesaurus
DESCRIPTION
This procedure adds a translation to the thesaurus
ARGUMENTS
id1 -- phrase id 1
lang -- language
trans -- translation
NOTES
RETURN
*/
procedure create_tr(
id1 in number,
lang in varchar2,
trans in varchar2
);
/*------------------------------- drop_tr -----------------------------*/
/*
NAME
drop_tr -- drop a translation/s from a thesaurus
DESCRIPTION
This procedure drops a translation/s from the thesaurus
ARGUMENTS
id1 -- phrase id 1
lang -- language
trans -- translation
NOTES
RETURN
*/
procedure drop_tr(
id1 in number,
lang in varchar2,
trans in varchar2
);
/*------------------------------ update_tr -----------------------------*/
/*
NAME
update_tr -- update a translation
DESCRIPTION
This procedure updates a translation
ARGUMENTS
id1 -- phrase id 1
lang -- language
trans -- translation
ntrans -- new translation
NOTES
RETURN
*/
procedure update_tr(
id1 in number,
lang in varchar2,
trans in varchar2,
ntrans in varchar2
);
/*---------------------------- create_relation ------------------------*/
/*
NAME
create_relation -- add a relation to a thesaurus
DESCRIPTION
This procedure adds a relation to the thesaurus
ARGUMENTS
id1 -- phrase id 1
rel -- relationship type
id2 -- phrase id 2
NOTES
opposite of create_phrase -- ID2 is the REL of ID1.
RETURN
*/
PROCEDURE create_relation (
id1 in number,
rel in varchar2,
id2 in number
);
/*---------------------------- drop_relation ------------------------*/
/*
NAME
drop_relation -- drop a relation from a thesaurus
DESCRIPTION
This procedure drops a relation from the thesaurus
ARGUMENTS
id1 -- phrase id 1
rel -- relationship type
id2 -- phrase id 2
NOTES
RETURN
*/
PROCEDURE drop_relation (
id1 in number,
rel in varchar2,
id2 in number
);
end drithsc;
/
@?/rdbms/admin/sqlsessend.sql
OHA YOOOO