ADL_query_translator modules/paradigms/Temporal_BeginEnd.py

modules / paradigms / Temporal_BeginEnd.py 


 SYNOPSIS

     Temporal_BeginEnd (table, idColumn, beginColumn, endColumn, 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".

         beginColumn
             The table column that holds begin dates, e.g., "begin".

         endColumn
             The table column that holds end dates, e.g., "end".

         cardinality
             A Cardinality object representing the cardinality of
             'table' with respect to 'beginColumn' and 'endColumn'.

         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 begin date and an end date.
     Returned queries generally have the form:

         SELECT idColumn FROM table
             WHERE beginColumn op1 'C.begin' AND endColumn op2 'C.end'

     where 'op1' and 'op2' are relational operators and 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 time ranges.  (In the latter case, the
     "contains" operator *is* supported if, for each collection item,
     the item's time ranges 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_BeginEnd.py,v $
     Revision 1.2  2003/10/23 22:57:35  gjanee
     Added the 'format' argument.  Minor documentation change.

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

Imported Modules   

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

Functions   
  _formatDate 
_formatDate ( date,  format )
Classes   

Temporal_BeginEnd


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