1 package drvimr authid current_user as
2
3 /*=========================================================================*/
4 /*====================== CTX_QUERY FUNCTIONS =============================*/
5 /*=========================================================================*/
6
7 /*---------------------------- explain ------------------------------------*/
8
9 type exprec is record (
10 id binary_integer,
11 parent_id binary_integer,
12 operation varchar2(30),
13 options varchar2(30),
14 object_name varchar2(80),
15 position binary_integer
16 );
17
18 type exptab is table of exprec index by binary_integer;
19
20 r_exp exptab;
21
22 procedure add_explain(
23 p_id in binary_integer,
24 p_parent_id in binary_integer,
25 p_operation in varchar2,
26 p_options in varchar2,
27 p_object_name in varchar2,
28 p_position in binary_integer
29 );
30
31 /*---------------------------- hqfeedback ---------------------------------*/
32
33 type hqfrec is record (
34 id binary_integer,
35 parent_id binary_integer,
36 operation varchar2(30),
37 options varchar2(30),
38 object_name varchar2(80),
39 position binary_integer,
40 bt ctx_feedback_type,
41 rt ctx_feedback_type,
42 nt ctx_feedback_type
43 );
44
45 type hqftab is table of hqfrec index by binary_integer;
46
47 r_hqf hqftab;
48
49 procedure add_hqf(
50 p_id in binary_integer,
51 p_parent_id in binary_integer,
52 p_operation in varchar2,
53 p_options in varchar2,
54 p_object_name in varchar2,
55 p_position in binary_integer,
56 p_bt in ctx_feedback_type,
57 p_rt in ctx_feedback_type,
58 p_nt in ctx_feedback_type
59 );
60
61 /*---------------------------- browse_words --------------------------------*/
62
63 type brwrec is record (
64 word varchar2(256),
65 doc_count binary_integer
66 );
67
68 type brwtab is table of brwrec index by binary_integer;
69
70 r_brw brwtab;
71
72 procedure add_brw(
73 p_word in varchar2,
74 p_count in binary_integer
75 );
76
77 /*=========================================================================*/
78 /*======================== CTX_DOC FUNCTIONS =============================*/
79 /*=========================================================================*/
80
81 TTYPE_NORMAL constant number := 0;
82 TTYPE_THEME constant number := 1;
83 TTYPE_STEM constant number := 2;
84 MODE_CLOB constant number := 1;
85 MODE_BLOB constant number := 2;
86 MODE_BFILE constant number := 3;
87 MODE_VCHR2 constant number := 4;
88 direct_mode number;
89 direct_clob clob;
90 direct_blob blob;
91 direct_if_blob blob;
92 direct_bfile bfile;
93 direct_vchr2 varchar2(32767);
94 direct_lang varchar2(256);
95 direct_format varchar2(256);
96 direct_cset varchar2(256);
97
98 PROCEDURE direct_set (
99 p_mode in binary_integer default NULL,
100 p_lang in varchar2 default NULL,
101 p_format in varchar2 default NULL,
102 p_cset in varchar2 default NULL,
103 p_vchr2 in varchar2 default NULL,
104 p_bfile in bfile default NULL,
105 p_clob in clob default NULL,
106 p_blob in blob default NULL
107 );
108
109 /*---------------------------- themes --------------------------------------*/
110
111 type thmrec is record (
112 theme varchar2(2000),
113 weight number
114 );
115 type thmtab is table of thmrec index by binary_integer;
116
117 r_thm thmtab;
118
119 PROCEDURE add_theme(
120 p_theme in varchar2,
121 p_weight in number
122 );
123
124 /*------------------------------ gist --------------------------------------*/
125
126 type gsttab is table of varchar2(31000) index by binary_integer;
127
128 r_gst thmtab;
129 r_gsttxt gsttab;
130
131 PROCEDURE add_gist(
132 p_pov in varchar2
133 );
134
135 PROCEDURE add_gist_txt(
136 p_text in varchar2
137 );
138
139 /*------------------------------ tokens ------------------------------------*/
140
141 type tokrec is record (
142 token varchar2(64),
143 offset number,
144 length number,
145 ttype number
146 );
147 type toktab is table of tokrec index by binary_integer;
148
149 r_tok toktab;
150
151 PROCEDURE add_token(
152 p_token in varchar2,
153 p_offset in number,
154 p_length in number,
155 p_ttype in number
156 );
157
158 /*------------------------------ stems ------------------------------------*/
159 /* Beehive */
160 type stemrec is record (
161 /* We made the size of stem to be larger than the size used for tokens
162 * as this might be a multi-word stem
163 */
164 stem varchar2(1000),
165 offset number,
166 length number,
167 is_in_lexicon boolean,
168 orig varchar2(64)
169 );
170 type stemtab is table of stemrec index by binary_integer;
171
172 r_stems stemtab;
173
174 PROCEDURE add_stem(
175 p_stem in varchar2,
176 p_offset in number,
177 p_length in number,
178 p_is_in_lexicon in number,
179 p_orig in varchar2
180 );
181
182 /*------------------------------ noun phrases ------------------------------------*/
183 /* Beehive */
184 type nprec is record (
185 term varchar2(64),
186 pos varchar2(64), /* TBD: Confirm with Inxight and reduce size */
187 offset number,
188 length number,
189 is_grp_start boolean,
190 is_in_lexicon boolean
191 );
192 type nptab is table of nprec index by binary_integer;
193
194 r_noun_phrases nptab;
195
196 PROCEDURE add_noun_phrase(
197 p_np_term in varchar2,
198 p_term_pos in varchar2,
199 p_offset in number,
200 p_length in number,
201 p_is_grp_start in number,
202 p_is_in_lexicon in number
203 );
204
205 /*------------------------------ languages ------------------------------------*/
206 /* Beehive */
207 type languagerec is record (
208 language varchar2(64),
209 score number
210 );
211 type languagetab is table of languagerec index by binary_integer;
212
213 r_languages languagetab;
214
215 PROCEDURE add_language(
216 p_language in varchar2,
217 p_score in number
218 );
219
220 /*------------------------------ part of speech ---------------------------------*/
221 /* Beehive */
222 type posrec is record (
223 word varchar2(64),
224 pos varchar2(64), /* TBD: Confirm with Inxight and reduce size */
225 offset number,
226 length number,
227 is_new_word boolean,
228 is_in_lexicon boolean
229 );
230 type postab is table of posrec index by binary_integer;
231
232 r_pos postab;
233
234 PROCEDURE add_pos(
235 p_word in varchar2,
236 p_pos in varchar2,
237 p_offset in number,
238 p_length in number,
239 p_is_new_word in number,
240 p_is_in_lexicon in number
241 );
242
243 /*------------------------------ highlight ---------------------------------*/
244
245 type hilrec is record (
246 offset number,
247 length number
248 );
249 type hiltab is table of hilrec index by binary_integer;
250
251 r_hil hiltab;
252
253 PROCEDURE add_highlight(
254 p_offset in number,
255 p_length in number
256 );
257
258 /*========================================================================*/
259 /*=================== DOCUMENT FEATURE FUNCTIONS =========================*/
260 /*========================================================================*/
261 /* reset the document feature buffer */
262 PROCEDURE reset_feature;
263
264 /* add one feature */
265 PROCEDURE add_feature(id number, weight number);
266
267 /* get feature number */
268 FUNCTION feature_count RETURN NUMBER;
269
270 /* get feature by index */
271 PROCEDURE get_feature(
272 idx BINARY_INTEGER,
273 id OUT NUMBER,
274 weight OUT NUMBER
275 );
276
277 /*========================================================================*/
278 /*=================== DOCUMENT CLUSTERING FUNCTIONS ======================*/
279 /*========================================================================*/
280 /* in-memory table for document assignment */
281 TYPE doc_rec IS RECORD (
282 docid number, -- document ID to identify the document
283 clusterid number, -- the ID of the cluster the document is assigned to
284 score number -- the similarity score between document and cluster
285 );
286 TYPE doc_tab is TABLE OF doc_rec INDEX BY BINARY_INTEGER;
287
288 /* in-memory table for cluster information */
289 TYPE cluster_rec IS RECORD (
290 clusterid number, -- cluster ID to identify a cluster
291 descript varchar2(4000), -- a string to describe the cluster
292 label varchar2(200), -- a suggested label for the cluster
293 sze number, -- number of documents assigned to the cluster
294 quality_score number, -- the quality score of the cluster
295 parent number -- parent cluster id. negative means no parent
296 );
297 TYPE cls_tab IS TABLE OF cluster_rec INDEX BY BINARY_INTEGER;
298
299 /* document items record */
300 TYPE did_rec IS RECORD (
301 did number, -- document id
302 row rowid -- rowid of the document
303 );
304 TYPE did_tab IS TABLE OF did_rec INDEX BY BINARY_INTEGER;
305
306 pv_doctab doc_tab;
307 pv_clstab cls_tab;
308 pv_didtab did_tab;
309 pv_didcur integer := 1;
310
311 /* add one item to the document cluster assignment table */
312 PROCEDURE add_doccls(
313 docid number,
314 clusterid number,
315 score number);
316
317 /* add one item to the cluster table */
318 PROCEDURE add_cluster (
319 clusterid number,
320 descript varchar2,
321 label varchar2,
322 sze number,
323 quality_score number,
324 parent number);
325
326 /* start item id scan */
327 PROCEDURE start_didscan;
328
329 /* next item id */
330 FUNCTION next_did (
331 did out number,
332 row out rowid)
333 return number;
334
335
336 /*=========================================================================*/
337 /*====================== CTX_REPORT FUNCTIONS ============================*/
338 /*=========================================================================*/
339
340 s1 constant varchar2(10) := ' ';
341 s75 constant varchar2(75) :=
342 ' ';
343 e75 constant varchar2(75) :=
344 '===========================================================================';
345 h75 constant varchar2(75) :=
346 '---------------------------------------------------------------------------';
347
348 procedure initreport;
349
350 procedure title(
351 title in varchar2 default null,
352 title2 in varchar2 default null,
353 sep in varchar2 default null
354 );
355 procedure wl(lline in varchar2);
356 procedure w(lline in varchar2);
357 procedure blankln;
358 procedure endreport(report in out nocopy clob);
359
360 /*--------------------------query_log_summary -------------------------------*/
361 type queryrec is record (
362 query varchar2(4000),
363 times number
364 );
365
366 type querytab is table of queryrec index by binary_integer;
367
368 r_query querytab;
369
370 PROCEDURE add_query(
371 p_query in varchar2,
372 p_times in number
373 );
374
375 pv_kwic varchar2(32767);
376
377 function get_kwic return varchar2;
378
379 procedure set_kwic(kwic in varchar2);
380
381 end drvimr;