|
/ modules / paradigms / Textual_Constant.py
SYNOPSIS
Textual_Constant (table, idColumn, cardinality, phraseList,
mapping=TextUtils.mappings.uppercaseAlphanumericOthersToWhitespace,
deleteList=TextUtils.deleteLists.keepAll)
table
A table to query, e.g., "holding".
idColumn
The table's object identifier column (i.e., the column
to be selected), e.g., "holding_id".
cardinality
A Cardinality object representing the cardinality of
'table'. Should be Cardinality("1") or
Cardinality("1?").
phraseList
A list of zero or more phrases, e.g.,
["I am Sam", "Sam am I", "Green Eggs and Ham"].
mapping
A Python character mapping table (i.e., a string of
length 256, indexed by ASCII character code) to process
'phraseList' and constraint text with. Defaults to
'uppercaseAlphanumericOthersToWhitespace', which maps
alphanumeric characters to their uppercase equivalents
and all other characters to whitespace (i.e., to word
separators).
deleteList
A string of zero or more characters to delete from
'phraseList' and constraint text. The default is the
empty string, which keeps all characters.
DESCRIPTION
Translates a textual constraint to a constant TRUE or FALSE
depending on whether the constraint text matches a body of
constant text.
This paradigm parses both constraint text and the phrases in
'phraseList' into word sequences by: 1) deleting any characters
that appear in 'deleteList'; 2) mapping the remaining characters
using 'mapping'; and 3) treating sequences of whitespace
characters as word separators. Comparison of words is then
based on straight string equality.
A constraint that matches 'phraseList' results in the query
SELECT idColumn FROM table
WHERE 1 = 1
being returned. Otherwise, the query
SELECT idColumn FROM table
WHERE 1 = 0
is returned.
Exceptions thrown:
no query words specified
AUTHOR
Greg Janee
gjanee@alexandria.ucsb.edu
HISTORY
$Log: Textual_Constant.py,v $
Revision 1.2 2003/04/16 18:32:11 valentin
updated to latest translator code
Revision 1.1 2002/11/04 22:46:14 gjanee
Initial revision
|