Oracle8 ConText Cartridge Application Developer's Guide Release 2.3 A58164-01 |
|
This appendix describes the sample SQL*Plus scripts provided by ConText. The scripts illustrate how to use SQL*Plus to build simple queries and generate linguistic output using ConText linguistics.
The scripts are divided into two functional areas: CTXPLUS (performing ad-hoc queries) and CTXLING (generating linguistic output).
The following topics are covered in this chapter:
Before you can use either the CTXPLUS or CTXLING, as well as the Oracle Forms sample application, you must create the required demonstration objects by preforming the following setup tasks.
Importing the export file creates an ARTICLES table for CTXDEMO and populates ARTICLES.TEXT with the text of the articles used in the samples.
The script creates the policies, preferences, views, and results tables used by the samples and creates a text index for the ARTICLES table.
This script illustrates the tasks you must perform to set up your tables for processing queries using ConText.
The CTXPLUS sample code consists of the following SQL scripts:
See Also:
For more information about the location of the scripts, see the Oracle8 Server installation documentation specific to you operating system. |
The ConText concepts illustrated in this sample code are:
To use the CTXPLUS sample SQL scripts:
For example:
@query1 Enter value for query_terms: coffee|tea
The script then returns a hitlist of the documents in the ARTICLES table that satisfy the query expression you enter. The hitlist consists of a score, ID, author, and title.
For example:
@view 14
The script then returns the text for the document with the article ID you specified.
For example:
@storeqry
Enter query name: test_sqe
Enter value for query_terms: coffee|tea
To view the SQEs for the demonstration user, use the CTX_USER_SQES view.
For example:
select pol_name, query_name, query_namefrom ctx_user_sqes;
The following examples execute the query1.sql, query2.sql, and querys.sql scripts using the query terms California and politics and various logical operators (OR, ACCUMULATE, and AND).
These examples illustrate how one-step, two-step, and (sorted) in-memory queries produce the same results and how the operators in a query expression affect the rows and scores returned by a query:
@query2 Enter value for query_terms: California SCR ID AUTHOR TITLE ---- -- --------------- ---------------------------- 100 17 Nolo Richards REVIEW & OUTLOOK (Editorial): California Smashup 50 18 Nolo Richards State Farm and California 30 25 David Shribman In the Wilderness: Democrats' Troubles In Winning 20 49 Nolo Richards California High Court Is Asked to Lift Block Of In 10 16 Heidi Waleson LEISURE & ARTS: Cynthia Phelps: Violist in Vogue @query1 Enter value for query_terms: politics SCR ID AUTHOR TITLE ---- -- --------------- ---------------------------- 20 25 David Shribman In the Wilderness: Democrats' Troubles In Winning 10 13 Frederick C. Kl LEISURE & ARTS -- Sports: Mediocrity's the Word Ar
@querys
Enter value for query_terms: politics|California SCR ID AUTHOR TITLE ---- -- --------------- ---------------------------- 100 17 Nolo Richards REVIEW & OUTLOOK (Editorial): California Smashup 50 18 Nolo Richards State Farm and California 30 25 David Shribman In the Wilderness: Democrats' Troubles In Winning 20 49 Nolo Richards California High Court Is Asked to Lift Block Of In 10 13 Frederick C. Kl LEISURE & ARTS -- Sports: Mediocrity's the Word Ar 10 16 Heidi Waleson LEISURE & ARTS: Cynthia Phelps: Violist in Vogue
@query1
Enter value for query_terms: politics,California SCR ID AUTHOR TITLE ---- -- --------------- ---------------------------- 100 17 Nolo Richards REVIEW & OUTLOOK (Editorial): California Smashup 50 18 Nolo Richards State Farm and California 50 25 David Shribman In the Wilderness: Democrats' Troubles In Winning 20 49 Nolo Richards California High Court Is Asked to Lift Block Of In 10 13 Frederick C. Kl LEISURE & ARTS -- Sports: Mediocrity's the Word Ar 10 16 Heidi Waleson LEISURE & ARTS: Cynthia Phelps: Violist in Vogue
@query2 Enter value for query_terms: politics&California SCR ID AUTHOR TITLE ---- -- --------------- ---------------------------- 20 25 David Shribman In the Wilderness: Democrats' Troubles In Winning
The CTXLING demo is a set of simple, related SQL*Plus scripts. Two of the scripts automate and track linguistic extraction on the demonstration documents. The remaining scripts can be used to query this linguistic output.
The CTXLING sample code consists of the following SQL scripts:
See Also:
For more information about the location of the scripts, see the Oracle8 Server installation documentation specifc to your operating system. |
The ConText concepts illustrated in this sample code are:
To use the CTXLING sample SQL scripts:
@genling Clearing theme table...
All articles submitted.
For example:
@status Linguistic Requests left: 36
Request Errors....
The extraction is complete when there are 0 Linguistic Requests left.
For example:
@gist 40 Points of View 01 GENERIC .. 15 production 16 purchases which point of view gist to print: 15
The script then returns the themes or Gists for the document with the article ID you specified.
For example:
@similar 14
The script then returns a list of the articles with the same themes as the article ID you specified.
The following examples illustrate using themes.sql, gist.sql, and similar.sql to view the linguistic output generated by genling.sql.
@themes 40 Commodities: Coffee Futures Prices Decline on News That U.S. Might Not Participate in New International Pact by John Valentine T# THEME WEIGHT --- --------------------------------------- ------ 01 United States 11 02 commerce and trade 10 03 coffee 10 ...
@gist 40 Points of View 01 GENERIC ... 15 production 16 purchases Which point of view gist to print: 15 Commodities: Coffee Futures Prices Decline on News That U.S. Might Not Participate in New International Pact by John Valentine Consuming and producing nations appear to be poles apart in their positions. Producing countries proposed a quota that would incorporate the sales of ...
@similar 40 Commodities: Coffee Futures Prices Decline on News That
U.S. Might Not Participate in New International Pact
by John Valentine
Article Themes 01 United States 02 commerce and trade 03 coffee .. 14 production 15 purchases Which theme to query: 15 Other articles with this theme ID WT AUTHOR TITLE
--- --- --------------- -------------------------------- 1 8 William Power OTC Focus: Composite Index Falls 33 7 Alex Kaufmann Your Money Matters: How to Take 5 7 George Anders Shades of U.S. Steel: J.P. 30 6 Michael Siconol Mutual Funds: ...And Find Out if 47 6 Nolo Richards Ponce Federal Bank Is in Talks 45 5 Nolo Richards Farley Wins Round In His Bid to 35 2 Alix M. Freedma Supermarkets Push Private-Label