ADL_query_translator modules/paradigms/Temporal_IntegerYear.py

modules / paradigms / Temporal_IntegerYear.py 


 SYNOPSIS

     Temporal_IntegerYear (table, idColumn, yearColumn, cardinality)

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

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

         yearColumn
             The table's year column, e.g., "year".

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

 DESCRIPTION

     Translates a temporal constraint to a pair of SQL numeric
     comparisons.  This paradigm assumes that a collection item's
     temporal footprint is described by a single integer year.
     Returned queries generally have the form:

         SELECT idColumn FROM table
             WHERE yearColumn BETWEEN C.beginYear AND C.endYear

     where C.beginYear and C.endYear are the year components of the
     limits of the constraint range, although other query forms are
     possible.

     The semantics of the "contains" and "is-contained-in" operators
     will generally be correct only if the cardinality is "1" or
     "1?".  The "0+" and "1+" cardinalities should be used with this
     paradigm only if collection items truly have multiple,
     equivalent temporal footprints.  In particular, this paradigm
     does not support temporal footprints that are unions of
     multiple, arbitrary years.  (In the latter case, the "contains"
     operator *is* supported if, for each collection item, the item's
     years are separated by at least one year, i.e., they never form
     a contiguous multi-year range.)

     (Known bug: support for the "is-contained-in" operator *should
     be* added by wrapping this paradigm in an
     Adaptor_TemporalIsContainedInRewriter paradigm.  But this
     doesn't work because of the way this paradigm rounds dates to
     years by truncation.  Given a range of dates [B, E], the
     Adaptor_TemporalIsContainedInRewriter paradigm defines exclusion
     regions by subtracting (adding) a single day from B (E), but
     usually year(B) = year(B - 1 day) and so year(B) ends up being
     excluded.)

     Exceptions thrown:

         none

 AUTHOR

     Greg Janee
     gjanee@alexandria.ucsb.edu

 HISTORY

     $Log: Temporal_IntegerYear.py,v $
     Revision 1.2  2003/10/24 03:59:07  gjanee
     Minor documentation addition.

     Revision 1.1  2003/01/28 18:23:58  gjanee
     Initial revision

Imported Modules   

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

Classes   

Temporal_IntegerYear


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