<?xml version="1.0" encoding="UTF-8"?>

<!-- <!DOCTYPE sddlschema SYSTEM "sddlschema.xsd">-->

<sddl>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- -->
<!--  SDDL Name:    NIC_SAA_LINK.SDDL -->
<!-- -->
<!--  Purpose:      This SDDL file defines the NIC_SAA_LINK relation.-->
<!-- -->
<!--  Modification History:-->
<!-- -->
<!--    Date       PR      Who                       Reason-->
<!--  - - - -    - - - -   - -   - - - - - - - - - - - - - - - - - - - - - -->
<!--  03/03/00   40279     Baum  Original implementation-->
<lm>  07/03/03   48821     CTB   Converted to XML format </lm> <!-- last mod -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <record name="SAA_LINK_TYPE">

        <description>This relation is used to link NICMOS exposures to the
                   SAA dark association that is relevant to the exposure. If
                   no record exists, then either the exposure is an SAA dark
                   or the exposure occurs too long after the SAA exit time.
                   The individual exposures of the associations can be accessed
                   through the asn_product_link table. All the timing info for 
                   both the exposures and the darks are found in the 
                   nic_saa_exit table. 

                   For records in this table, the dark association must have 
                   nearly the same saa_exit time (from NIC_SAA_EXIT table) as
                   the exposure. That is, the most recent SAA exit for both the
                   darks and the exposures must be in the same orbit. 
                   The exposure from the dark association must have the same 
                   qelogsheet.config value.  The qelogsheet.targname value
                   for the dark exposures will be POST-SAA-DARK. 

                   The records in this table are inserted during the processing
                   of the mission schedule, after updating the the asn tables. </description>


            <field name="program_id">
                    <type>C3</type>
                    <description>When a proposal is accepted into the PMDB by SPSS it must
                    be assigned a unique 3 character base 36 program identifier.
                    This is done by the PMDB/ACCEPT_PROP command.  This program
                    identifier is tagged as 'program_id' in most PMDB relations.
                    Is is used for identification of proposals by spacecraft
                    and OPUS software. It is also used in the OPUS and DADS
                    rootname for all archived science data files.
                    Because of flight design software, program_id must be
                    three characters.</description>
            </field>


            <field name="obset_id">
                    <type>C2</type>
                    <description>An observation set is a collection of one or more
                    alignments that are grouped together based on FGS pointing
                    requirements.  That is, if multiple alignments can all be
                    executed using the same guide star pair, they are grouped
                    into the same observation set.

                    An observation set is identified by a 2 character base 36
                    string.  This field,  typically called 'obset_id', will
                    often contribute to the index on relation together with a
                    proposal_id, version_num, and possibly other fields.

                    OBSET is an abbreviation for observation set.</description>
            </field>

            <field name="ob_number">
                    <type>C2</type>
                    <description>Observations are numbered sequentially throughout
                     an observation set and are assigned by SMS -generat.
                     An ob_number is _NOT_ the same as an obset_ID.
                     This field can be joined to member_num for 
                     exposure records in asn_members.</description>
            </field>

            <field name="dark_program_id">
                    <type>C3</type>
                    <description>The program_id of the dark association. See 
                    asn_product_link.program_id. </description>
            </field>

            <field name="dark_obset_id">
                    <type>C2</type>
                    <description>Association observation set identifier of the dark
                    association. See asn_product_link.asn_obset_id. " </description>
            </field>

            <field name="dark_member_num">
                    <type>C3</type>
                    <description>Member number of the dark association primary product.
                     See asn_product_link.member_num. </description>
            </field>

            <field name="dark_association">
                    <type>C9</type>
                    <description>This is a convenience field. It can be reconstructed
                     from the letter N, the dark_program_id, the 
                     dark_obset_id, and the dark_member_num. See 
                     asn_members for complete definition of association_id. </description>
            </field>

    </record>


    <relation name="nic_saa_link">

        <type>SAA_LINK_TYPE</type>

        <description>NICMOS SAA Link Relation</description>

        <subsystem_using>OPUS</subsystem_using>

        <index name="nic_saa_link_1">
            <type>unique clustered</type>
            <field name="program_id"/>
            <field name="obset_id"/>
            <field name="ob_number"/>
        </index>

        <index name="nic_saa_link_2">
            <type>nonclustered</type>
            <field name="dark_program_id"/>
            <field name="dark_obset_id"/>
            <field name="dark_member_num"/>
        </index>

    </relation>
</sddl>
