ADL_query_translator modules/paradigms/Adaptor_IndirectQualification.py

modules / paradigms / Adaptor_IndirectQualification.py 


 SYNOPSIS

     Adaptor_IndirectQualification (mainFieldColumn, auxiliaryTable,
         auxiliaryFieldColumn, auxiliaryUriColumn, paradigm)

         mainFieldColumn
             The main table column that contains field keys, e.g.,
             "field_code".

         auxiliaryTable
             The auxiliary table that stores field information, e.g.,
             "fields".

         auxiliaryFieldColumn
             The auxiliary table column to be joined with
             'mainFieldColumn', e.g., "field_code".

         auxiliaryUriColumn
             The auxiliary table column that stores field URIs, e.g.,
             "field_uri".

         paradigm
             The underlying paradigm.

 DESCRIPTION

     An adaptor that adds support for field-level searching to a
     paradigm (the "underlying" paradigm) by adding a condition to
     each SELECT statement returned by the paradigm.

     The underlying paradigm must return, given an appropriate atomic
     bucket-level constraint, a Select object that queries exactly
     one main table, i.e., a SELECT statement of the form:

         SELECT idColumn FROM mainTable, ...
             WHERE condition

     This adaptor passes constraints through to the underlying
     paradigm; the paradigm should treat all constraints as being
     bucket-level.  The translations of bucket-level constraints are
     returned unmodified.  But given a field-level constraint, this
     adaptor adds an INNER JOIN to an auxiliary table and adds a
     condition to the SELECT statement's WHERE clause:

         SELECT idColumn FROM mainTable, ..., auxiliaryTable
             WHERE mainTable.mainFieldColumn =
                 auxiliaryTable.auxiliaryFieldColumn AND
             auxiliaryUriColumn = 'F.uri' AND
             condition

     where F.uri is the URI of the field mentioned in the constraint.

     Thus this adaptor is useful in situations in which a table
     stores multiple values (in multiple rows) per collection item
     and the values are directly qualified by a field code which
     serves as a foreign key into a table of field URIs.  The
     underlying paradigm should generally indicate that the
     cardinality of the main table is isMany().

     Exceptions thrown:

         none

 AUTHOR

     Greg Janee
     gjanee@alexandria.ucsb.edu

 HISTORY

     $Log: Adaptor_IndirectQualification.py,v $
     Revision 1.2  2003/10/28 21:53:08  gjanee
     Per revision 1.8 of UniversalTranslator.py, this paradigm now
     invokes field-level methods of the underlying paradigm if the
     latter supports field-level searching.

     Revision 1.1  2002/10/17 00:38:59  gjanee
     Initial revision

Imported Modules   

import UniversalTranslator
import edu.ucsb.adl.middleware
import types

Classes   

Adaptor_IndirectQualification


This document was automatically generated Thu Mar 4 12:45:23 2004 by HappyDoc version WORKING