DAP4 Attribute Model

From OPeNDAP Documentation
Revision as of 01:26, 22 January 2009 by Ndp (talk | contribs) (→‎Schema)
⧼opendap2-jumptonavigation⧽

Re-factoring the representation of DAP Attribute objects.

Goals

  • Provide an improved XML representation of the DAP Attributes.
  • Provide a mechanism for including any XML markup from namespaces other than the DAP namespaces as metadata associated with any DAP variable.

Background

The original DDX represented Attribute objects as a single XML element dap:Attribute. The type of the DAP Attribute was represented as the value of an XML attribute names type. For example:

   <Attribute name="bears" type="Container">
       <Attribute name="act" type="String">
           <value>text string\\012\\011123</value>
       </Attribute>
       <Attribute name="acs" type="Int16">
           <value>-40</value>
       </Attribute>
   </Attribute>

This is unlike the scheme for variables in which each one is represented by an XML element whose name reflects the type of the variable:

       <String name="satellite"/>
       <Int32 name="year"/>

A more parallel representation can be achieved by creating a separate namespace for the DAP Attribute data model. This way the two representations can more closely resemble each other, and they can be easily filtered and manipulated using namespace aware processing (which really is a key component of the XML use model).

Design

Each type of DAP Attribute type will have its own XML element representation in the DAP Attribute namespace: http://xml.opendap.org/ns/DAP/3.3/att#

  • xmlns:att="http://xml.opendap.org/ns/DAP/3.3/att#" Using the att prefix to identify the DAP Attribute namespace.
  • <att:Byte /> - Holds a Byte valued Attribute.
  • <att:Int16 /> - Holds a 16 bit integer valued Attribute.
  • <att:UInt16 /> - Holds an unsigned 16 bit integer valued Attribute.
  • <att:Int32 /> - Holds a 32 bit integer valued Attribute.
  • <att:UInt32 /> - Holds an unsigned 32 bit integer valued Attribute.
  • <att:Float32 /> - Holds a 32 bit floating point valued Attribute.
  • <att:Float64 /> - Holds a 64 bit floating point valued Attribute.
  • <att:String /> - Holds a String valued Attribute.
  • <att:URL /> - Holds a URL valued Attribute.
  • <att:Container /> - Holds a Container Attribute.
  • <att:XML /> - Holds any XML not in the DAP namespaces and identifies it as an Attribute. (Assuming we want to wrap foreign XML in an Attribute tag)

Schema

Here is the prototype schema for the DAP Attribute namespace:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://xml.opendap.org/ns/DAP/3.3/att#"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dap="http://xml.opendap.org/ns/DAP/3.3/att#"
    xmlns="http://xml.opendap.org/ns/DAP/3.3/att#" elementFormDefault="qualified"
    attributeFormDefault="unqualified">
    <!--
	
	-->

    <xs:element name="Byte" type="AttributeByteType"/>
    <xs:element name="Int16" type="AttributeInt16Type"/>
    <xs:element name="UInt16" type="AttributeUInt16Type"/>
    <xs:element name="Int32" type="AttributeInt32Type"/>
    <xs:element name="UInt32" type="AttributeUInt32Type"/>
    <xs:element name="Float32" type="AttributeFloat32Type"/>
    <xs:element name="Float64" type="AttributeFloat64Type"/>
    <xs:element name="String" type="AttributeStringType"/>
    <xs:element name="Url" type="AttributeUrlType"/>
    <xs:element name="Container" type="AttributeContainerType"/>
    <xs:element name="Xml" type="AttributeXmlType"/>

    <!--
	
	-->
    <xs:group name="allAttributeTypes">
        <xs:annotation>
            <xs:documentation>Reusable Content Model for Container type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element ref="Byte" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="Int16" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="UInt16" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="Int32" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="UInt32" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="Float32" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="Float64" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="String" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="Url" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="Container" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="Xml" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
    </xs:group>

    <!--
        
    -->
    <xs:complexType name="AttributeContainerType">
        <xs:annotation>
            <xs:documentation>DAP Attribute Container Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:group ref="allAttributeTypes" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <!--
	
	-->
    <xs:complexType name="AttributeByteType">
        <xs:annotation>
            <xs:documentation>DAP Attribute Byte Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="value" type="xs:unsignedByte" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <!--
        
    -->
    <xs:complexType name="AttributeInt16Type">
        <xs:annotation>
            <xs:documentation>DAP Attribute Int16 Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="value" type="xs:short" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <!--
        
    -->
    <xs:complexType name="AttributeUInt16Type">
        <xs:annotation>
            <xs:documentation>DAP Attribute UInt16 Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="value" type="xs:unsignedShort" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
    <!--
        
    -->
    <xs:complexType name="AttributeInt32Type">
        <xs:annotation>
            <xs:documentation>DAP Attribute Int32 Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="value" type="xs:int" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
    <!--
        
    -->
    <xs:complexType name="AttributeUInt32Type">
        <xs:annotation>
            <xs:documentation>DAP Attribute UInt32 Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="value" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
    <!--
        
    -->
    <xs:complexType name="AttributeFloat32Type">
        <xs:annotation>
            <xs:documentation>DAP Attribute Float32 Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="value" type="xs:float" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
    <!--
        
    -->
    <xs:complexType name="AttributeFloat64Type">
        <xs:annotation>
            <xs:documentation>DAP Attribute Float64 Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="value" type="xs:double" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
    <!--
        
    -->
    <xs:complexType name="AttributeStringType">
        <xs:annotation>
            <xs:documentation>DAS Attribute String Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <!--
       - This allows the URL type to contain anyURI. We need to modifiy the schema so that it really is
       - any URL. 
       -
       - OR 
       -
       - We need to relax the DAP definition of the URL Attribute type.
       -       
    -->
    <xs:complexType name="AttributeUrlType">
        <xs:annotation>
            <xs:documentation>DAS Attribute URL Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:element name="value" type="xs:anyURI" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>

    <!--
       - This allows any XML not in the DAP Attribute namespace. We should try to make this
       - any XML not in the DAP or the DAP ATtribute namespace.
       - IE: XML not in http://xml.opendap.org/ns/DAP/3.3/att# or http://xml.opendap.org/ns/DAP/3.3/dap#
       -        
    -->
    <xs:complexType name="AttributeXmlType">
        <xs:annotation>
            <xs:documentation>DAS Attribute XML Type</xs:documentation>
        </xs:annotation>
        <xs:choice>
            <xs:any namespace="##other" minOccurs="1" maxOccurs="unbounded" processContents="strict"
            />
        </xs:choice>
        <xs:attribute name="name" type="xs:string" use="required"/>
    </xs:complexType>
    <!--
        
    -->
</xs:schema>

Source XML

<?xml version="1.0" encoding="UTF-8"?>
<Dataset name="200803061600_HFRadar_USEGC_6km_rtv_SIO.nc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xml.opendap.org/ns/DAP2"
xsi:schemaLocation="http://xml.opendap.org/ns/DAP2  http://xml.opendap.org/dap/dap2.xsd">



  <Attribute name="wcsStuff" type="xml" >
    <CoverageDescription xmlns="http://www.opengis.net/wcs/1.1" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:owcs="http://www.opengis.net/wcs/1.1/ows" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:schemaLocation="http://www.opengis.net/wcs/1.1  http://schemas.opengis.net/wcs/1.1.0/wcsDescribeCoverage.xsd  http://www.opengis.net/ows/1.1  http://schemas.opengis.net/ows/1.1.0/owsAll.xsd  http://www.opengis.net/wcs/1.1/ows http://schemas.opengis.net/wcs/1.1.0/owsDataIdentification.xsd http://www.opengis.net/gml/3.2  http://schemas.opengis.net/gml/3.2.1/gml.xsd">
        <ows:Title>Near-Real Time Surface Ocean Velocity</ows:Title>
        <ows:Abstract>CoverageDescription generated by OPeNDAP WCS UseCase 2.0</ows:Abstract>
        <Identifier>coverage/200803061600_HFRadar_USEGC_6km_rtv_SIO.nc</Identifier>
        <Domain>
            <SpatialDomain>
                <ows:BoundingBox crs="urn:ogc:def:crs:EPSG::4326">
                    <ows:LowerCorner>-97.8839 21.736</ows:LowerCorner>
                    <ows:UpperCorner>-57.2312 46.4944</ows:UpperCorner>
                </ows:BoundingBox>
            </SpatialDomain>
            <TemporalDomain>
                <gml:timePosition>2008-03-27T16:00:00.000Z</gml:timePosition>
            </TemporalDomain>
        </Domain>
        <Range>
        </Range>
        <SupportedCRS>urn:ogc:def:crs:EPSG::4326</SupportedCRS>
        <SupportedFormat>netcdf-cf1.0</SupportedFormat>
        <SupportedFormat>dap2.0</SupportedFormat>
    </CoverageDescription>

    <CoverageSummary xmlns="http://www.opengis.net/wcs/1.1" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:owcs="http://www.opengis.net/wcs/1.1/ows" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:schemaLocation="http://www.opengis.net/wcs/1.1  http://schemas.opengis.net/wcs/1.1.0/wcsDescribeCoverage.xsd  http://www.opengis.net/ows/1.1  http://schemas.opengis.net/ows/1.1.0/owsAll.xsd  http://www.opengis.net/wcs/1.1/ows http://schemas.opengis.net/wcs/1.1.0/owsDataIdentification.xsd http://www.opengis.net/gml/3.2  http://schemas.opengis.net/gml/3.2.1/gml.xsd">
       <ows:Title>6km HF Radar data</ows:Title>
       <ows:Abstract>A test dataset for use developing WCS services.</ows:Abstract>
       <ows:Metadata xlink:href="http://ndp.opendap:8080/opendap/coverage/200803061600_HFRadar_USEGC_6km_rtv_SIO.nc.das"/>
       <ows:WGS84BoundingBox>
          <ows:LowerCorner>-97.8839 21.736</ows:LowerCorner>
          <ows:UpperCorner>-57.2312 46.4944</ows:UpperCorner>
       </ows:WGS84BoundingBox>
       <Identifier>coverage/200803061600_HFRadar_USEGC_6km_rtv_SIO.nc</Identifier>
    </CoverageSummary>
  </Attribute>

    <Attribute name="NC_GLOBAL" type="Container">
        <Attribute name="title" type="String">
            <value>Near-Real Time Surface Ocean Velocity</value>
        </Attribute>
        <Attribute name="institution" type="String">
            <value>Scripps Institution of Oceanography</value>
        </Attribute>
        <Attribute name="source" type="String">
            <value>Surface Ocean HF-Radar</value>
        </Attribute>
        <Attribute name="history" type="String">
            <value>12-Mar-2008 22:26:19:  NetCDF file created</value>
        </Attribute>
        <Attribute name="references" type="String">
            <value>Terrill, E. et al., 2006. Data Management and Real-time\\012Distribution in the HF-Radar National Network. Proceedings\\012of the MTS/IEEE Oceans 2006 Conference, Boston MA,\\012September 2006.</value>
        </Attribute>
    </Attribute>

    <Grid name="u">
      <Attribute name="wcsStuff" type="xml" >
        <Field>
            <ows:Title>surface_eastward_sea_water_velocity</ows:Title>
            <ows:Abstract>Eastward component of a 2D sea surface velocity vector.</ows:Abstract>
            <Identifier>u</Identifier>
            <Definition>
                <ows:AnyValue/>
            </Definition>
            <NullValue>-32768</NullValue>
            <owcs:InterpolationMethods>
                <owcs:DefaultMethod>nearest</owcs:DefaultMethod>
            </owcs:InterpolationMethods>
        </Field>
      </Attribute>
        <Attribute name="standard_name" type="String">
            <value>surface_eastward_sea_water_velocity</value>
        </Attribute>
        <Attribute name="units" type="String">
            <value>m s-1</value>
        </Attribute>
        <Attribute name="_FillValue" type="Int16">
            <value>-32768</value>
        </Attribute>
        <Attribute name="scale_factor" type="Float32">
            <value>0.009999999776</value>
        </Attribute>
        <Attribute name="ancillary_variables" type="String">
            <value>DOPx</value>
        </Attribute>
        <Array name="u">
            <Int16/>
            <dimension name="time" size="1"/>
            <dimension name="lat" size="460"/>
            <dimension name="lon" size="701"/>
        </Array>
        <Map name="time">
            <Int32/>
            <dimension name="time" size="1"/>
        </Map>
        <Map name="lat">
            <Float32/>
            <dimension name="lat" size="460"/>
        </Map>
        <Map name="lon">
            <Float32/>
            <dimension name="lon" size="701"/>
        </Map>
    </Grid>

    <dataBLOB href=""/>
</Dataset>