ADL_query_translator modules/paradigms/Temporal_SingleDate.py

modules / paradigms / Temporal_SingleDate.py 


 SYNOPSIS

     Temporal_SingleDate (table, idColumn, dateColumn, cardinality,
         format="ISO 8601", minDate=101, maxDate=99991231)

         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".

         dateColumn
             The table's date column, e.g., "date".

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

         format
             The format in which dates are written in queries.  The
             default is "ISO 8601".  Currently supported formats are
             (using as an example March 5, 1997):

             ISO 8601
                 '1997-03-05'

             Oracle
                 TO_DATE('1997-03-05', 'YYYY-MM-DD')

         minDate
             The earliest supported date, expressed as an integer in
             the encoding YYYYMMDD.  The default value of 101
             corresponds to 0000-01-01, i.e., to January 1, 0000.
             Notice that leading zeros have been stripped off to
             suppress Python's octal interpretation!

         maxDate
             The latest supported date, expressed as an integer in
             the encoding YYYYMMDD.  The default value of 99991231
             corresponds to December 31, 9999.

 DESCRIPTION

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

         SELECT idColumn FROM table
             WHERE dateColumn BETWEEN 'C.begin' AND 'C.end'

     where C.begin and C.end are 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 dates.  (In the latter case, the "contains"
     operator *is* supported if, for each collection item, the item's
     dates are not only disjoint but are separated by at least one
     day.  Support for the "is-contained-in" operator can be added by
     wrapping this paradigm in an
     Adaptor_TemporalIsContainedInRewriter paradigm.)

     Exceptions thrown:

         begin date precedes earliest supported date
         end date follows latest supported date

 AUTHOR

     Greg Janee
     gjanee@alexandria.ucsb.edu

 HISTORY

     $Log: Temporal_SingleDate.py,v $
     Revision 1.2  2003/10/23 23:39:01  gjanee
     Added the 'format' argument.  Minor documentation change.

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

Imported Modules   

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

Functions   
  _formatDate 
_formatDate ( date,  format )
Classes   

Temporal_SingleDate


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