OPENDAP / libdap4

A new version of libdap that contains both DAP2 and DAP4 support
GNU Lesser General Public License v2.1
13 stars 14 forks source link

DAP4: Attribute containers are being transmitted with type="Container" which is incorrect #260

Open ndp-opendap opened 1 month ago

ndp-opendap commented 1 month ago

Consider:

http://test.opendap.org:8080/opendap/tds/OR_ABI-L2-SSTF-M6_G16_s20242820000206_e20242820059514_c20242820104416.nc.dmr.xml

At the end of the response is an Attribute container element:

    <Attribute name="NC_GLOBAL" type="Container">

However the section 1.5.14 of the specification says:

Attributes may also serve as containers for other attributes (and other containers). In this case, no type is specified, only a name.

And there is no explicit Attribute type of Container rather for container type Attributes omit the XML type attribute:

<define name="attribute">
  <choice>
    <ref name="atomicattribute"/>
    <ref name="containerattribute"/>
  </choice>
</define>

<define name="atomicattribute">
  <element name="Attribute">
      <attribute name="name"><data type="dap4_id"/></attribute>
      <a:documentation>
        Semantic constraint: type must be compatible
        with the set of attribute value types
      </a:documentation>
      <attribute name="type">
        <choice>
          <value>Char</value>
          <value>Byte</value>
          <value>Int8</value>
          <value>UInt8</value>
          <value>Int16</value>
          <value>UInt16</value>
          <value>Int32</value>
          <value>UInt32</value>
          <value>Int64</value>
          <value>UInt64</value>
          <value>Float32</value>
          <value>Float64</value>
          <value>String</value>
          <value>URL</value>
          <value>Enum</value>
          <value>Opaque</value>
        </choice>
      </attribute>
      <optional>
          <ref name="namespace"/>
      </optional>
      <zeroOrMore>
          <choice>
               <element name="Value">
                  <attribute name="value">
                  <choice> <!-- technical ambiguity -->
                      <data type="dap4_integer"/>
                      <data type="dap4_float"/>
                      <data type="dap4_opaque"/>
                      <data type="dap4_char"/>
                      <data type="dap4_string"/>
                      <data type="dap4_fqn"/> <!-- for enum types -->
                  </choice>
              </attribute>
         </element>
     <element name="Value"><data type="dap4_text"/></element>
    </choice>
      </zeroOrMore>
  </element>
</define>

<define name="containerattribute">
  <element name="Attribute">
    <attribute name="name"><data type="dap4_id"/></attribute>
    <zeroOrMore>
    <ref name="attribute"/>
    </zeroOrMore>
  </element>
</define>

Additionally the use of top level Attribute containers like NC_GLOBAL is obviated by DAP4. The TDS returns all of the child Attributes found in the Hyrax NC_GLOBAL container as top level Attributes:

http://35.87.12.216:8080/thredds/dap4/data/tds/OR_ABI-L2-SSTF-M6_G16_s20242820000206_e20242820059514_c20242820104416.nc.dmr.xml