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

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

<sddl>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- -->
<!--  SDDL Name:    KEYWORD_SOURCE-->
<!-- -->
<!--  Purpose:      This SDDL file defines the KEYWORD_SOURCE relation.-->
<!-- -->
<!--  Modification History:-->
<!-- -->
<!--    Date       PR      Who                       Reason-->
<!--  - - - -    - - - -   - -   - - - - - - - - - - - - - - - - - - - - - -->
<!--  07/02/96   28182     Rose  Original implementation-->
<!--  02/06/03   47507     MSwam Rename source field to sourcename (reserved word) -->
<lm>  07/03/03   48821     CTB   Converted to XML format </lm> <!-- last mod -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


    <record name="KEYWORD_SOURCE">

        <description>This relation specifies the source of selected keywords.
		The source may be specified in three ways, from the PDB
		(Project Database), from the PMDB (Proposal management
		Database), or as a difference calculation.

		In the first case (PDB) the source of the keyword will be
		the name of a mnemonic as specified in the EUDL.DAT file
		of the PDB.  The OPUS software will look up the location
		of that mnemonic in the yurintab relation.  If it is
		desired to convert the value of the mnemonic to a string
		(discrete conversion) or to engineering units (linear or
		polynomial conversion), then the second field (subsource)
		specifies the 8 character mnemonic of a conversion.  See
		the description of conv_discrete, conv_linear, and 
		conv_polynomial.

		In the second case (PMDB) the source field is the name of
		a database relation in the PMDB.  The subsource specifies
		the name of the field in that relation.  Only relations
		which can be joined with the relation qolink on the basis
		of program_id, obset_id and ob_number can be used.  There
		is a special case of deep relations like qesiparm.  In this
		case there is only a field for si_par_name and si_par_value,
		both of which are string fields.  To obtain a value from
		such a deep relation, specify the name of the parameter
		in a form (usually uppercase) that will match the value in
		the database.

		Finally, for keywords which are simply differences between
		two already dredged keywords, only the names of the
		subtrahend and minuend mnemonics are required for the
		source and subsource fields. </description>

        <field name="instrument">
            <type>C3</type>
            <description>short instrument name</description>
            <discrete>NIC</discrete>
            <discrete>STI</discrete>
        </field>

        <field name="keyword">
            <type>C8</type>
            <description>Name of the keyword</description>
        </field>

        <field name="sourcetype">
            <type>C8</type>
            <description>which kind of source applies</description>
            <discrete>PDB</discrete>
            <discrete>PMDB</discrete>
            <discrete>DELTA</discrete>
        </field>

        <field name="sourcename">
            <type>C30</type>
            <description>source name: mnemonic, relation, subtrahend</description>
        </field>

        <field name="subsource">
            <type>C30</type>
            <description>specify: conversion mnemonic,
			      fieldname or parameter name,
			      minuend mnemonic</description>
        </field>

    </record>


    <relation name="keyword_source">

        <type>KEYWORD_SOURCE</type>

        <description>Source of the keyword values</description>

        <subsystem_using>OPUS</subsystem_using>

        <index name="keyword_source_1">
            <type>unique clustered</type>
            <field name="instrument"/>
            <field name="keyword"/>
        </index>

    </relation>


    <instance  name="keyword_source" scope="global" type="KEYWORD_SOURCE" />

</sddl>
