ADL_query_translator modules/paradigms/Hierarchical_IntegerSet.py

modules / paradigms / Hierarchical_IntegerSet.py 


 SYNOPSIS

     Hierarchical_IntegerSet (table, idColumn, codeColumn, cardinality)

         table
             A table to query, e.g., "holding_type".

         idColumn
             The table's object identifier column (i.e., the column
             to be selected), e.g., "holding_id".

         codeColumn
             The table's code column (i.e., the column against which
             the constraint is to be placed), e.g., "type_id".

         cardinality
             A Cardinality object representing the cardinality of
             'table' with respect to 'codeColumn'.

 DESCRIPTION

     Translates a hierarchical constraint to an SQL set inclusion
     test.

     Given a hierarchical constraint (B, "is-a", T, V) where B is a
     hierarchical bucket, T is a term, and V is the term's
     vocabulary, this paradigm uses the translator's vocabulary
     interface (i.e., the 'vocabularies' argument) to locate
     vocabulary (B, V) and translate T to an array of zero or more
     integer codes.  The paradigm then returns the following query:

         SELECT idColumn FROM table
             WHERE codeColumn IN (code1, code2, ...)

     If no codes are associated with T, the paradigm returns:

         SELECT idColumn FROM table
             WHERE 1 = 0

     Exceptions thrown:

         unsupported vocabulary for bucket
         unrecognized term in vocabulary

 AUTHOR

     Greg Janee
     gjanee@alexandria.ucsb.edu

 HISTORY

     $Log: Hierarchical_IntegerSet.py,v $
     Revision 1.2  2003/04/16 18:32:10  valentin
     updated to latest translator code

     Revision 1.4  2003/01/29 21:13:50  gjanee
     Recoded slightly to take advantage of new paradigm convenience
     functions.

     Revision 1.3  2003/01/24 16:59:09  gjanee
     Minor update to conform to the "transparent immutable objects"
     programming model.

     Revision 1.2  2002/10/16 21:53:49  gjanee
     Bug fix.  When returning a constant FALSE, we now preserve the
     isOptional()/isMandatory() nature of the table reference.

     Revision 1.1  2002/10/03 21:44:16  gjanee
     Initial revision


Imported Modules   

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

Classes   

Hierarchical_IntegerSet


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