DAP4 Attribute Model

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽

Add a DAP Attribute with type xml.

Goal

Provide a mechanism for including any XML markup from namespaces other than the DAP namespaces as metadata associated with any DAP variable.

Background

In order to create a more flexible metadata channel for the DAP we will add a new type of Attribute object the DAP Attribute data model. This new Attribute type, called xml, will be allowed to contain any XML from a non DAP namespace. For example, XML content from the GML or WCS namespaces could be included here. Even an Open Office document describing the content would be legal.

Design

In the DAP2 DDX schema this change would be made by adding a new value to the DataType type enumeration used by the dap:Attribute element's type attribute:

   <xs:simpleType name="DataType">
       <xs:restriction base="xs:string">
           <xs:enumeration value="Byte"/>
           <xs:enumeration value="Int16"/>
           <xs:enumeration value="UInt16"/>
           <xs:enumeration value="Int32"/>
           <xs:enumeration value="UInt32"/>
           <xs:enumeration value="Float32"/>
           <xs:enumeration value="Float64"/>
           <xs:enumeration value="String"/>
           <xs:enumeration value="URL"/>
           <xs:enumeration value="Container"/>
           <xs:enumeration value="Xml"/>
       </xs:restriction>
   </xs:simpleType>

However, in the DAP2 schema no content rules are available for the Attribute elements. This makes it easy to add the new type, but doesn't provide any functional information about it's content.

Since this change is taking place in conjunction with re-factoring the XML representation of DAP Attribute objects this new Attribute type will be included those sections.

Example Document

    <?xml version="1.0" encoding="UTF-8"?>
    <Dataset name="200803061600_HFRadar_USEGC_6km_rtv_SIO.nc"
    xmlns="http://xml.opendap.org/ns/DAP/3.3#"
    xmlns:dap="http://xml.opendap.org/ns/DAP/3.3#"
    dap_version="3.3"
    xmlns:xml="http://www.w3.org/XML/1998/namespace"
    xml:base="http://localhost:8080/opendap/coverage/200803061600_HFRadar_USEGC_6km_rtv_SIO.nc.ddx"


        <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"
                                 >
                <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>
        </Attribute>

        <Grid name="u">
            <Attribute name="wcsStuff" type="xml">
                <Field 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"
                                 >
                    <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>
            <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>

    </Dataset>






While this works to include foreign xml in the DAP, I think we would be better off if we had some stronger semantics than "attribute" availabe. In particular, I think we need to say in this particular example that the XML enclosed is an alternate description of the node in question, i.e. a dataset is an wcs CoverageDescription and a Grid is a wcs:Field. We need that connection in order to build the code that moves data from one representation to another, e.g. build a WCS response from DAP data.

One possibility would be a property dap:alsoKnownAs.

--BennoBlumenthal 08:03, 25 January 2009 (PST)

Re-factoring the representation of DAP Attribute objects.

Goals

Provide an improved XML representation of the DAP Attributes.

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).

Additionally, the way that our current Attribute semantics cannot be expressed in XML Schema 1.0, as they require "conditional type assignment" which is only available in (the as yet to released) XML Schema 1.1

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 /> - Represents a byte valued Attribute.
  • <att:Int16 /> - Represents a 16 bit integer valued Attribute.
  • <att:UInt16 /> - Represents an unsigned 16 bit integer valued Attribute.
  • <att:Int32 /> - Represents a 32 bit integer valued Attribute.
  • <att:UInt32 /> - Represents an unsigned 32 bit integer valued Attribute.
  • <att:Float32 /> - v a 32 bit floating point valued Attribute.
  • <att:Float64 /> - Represents a 64 bit floating point valued Attribute.
  • <att:String /> - Represents a String valued Attribute.
  • <att:URL /> - Represents a URL valued Attribute.
  • <att:Container /> - Represents a Container Attribute.
  • <att:XML /> - Represents an Attribute object that may hold 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 DAP4 namespace

  • This schema document is made much simpler due to moving the DAP Attributes to their own schema.

Here is the prototype schema for the DAP4 Attribute namespace This schema needs a few changes/corrections:

  1. The AttributeUrlType Allows the URL type to contain any URI. We need to modifiy the schema so that it it is restricted to any URL. Or we might wish to relax the DAP definition of the URL Attribute type to become a URI.
  2. The AttributeXMLType - 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 namespaces (IE: XML not in http://xml.opendap.org/ns/DAP/3.3/att# or http://xml.opendap.org/ns/DAP/3.3/dap#)

Example Document

<?xml version="1.0" encoding="UTF-8"?>
<Dataset name="200803061600_HFRadar_USEGC_6km_rtv_SIO.nc"
         xmlns="http://xml.opendap.org/ns/DAP/3.3#"
         xmlns:dap="http://xml.opendap.org/ns/DAP/3.3/dap#"
         xmlns:att="http://xml.opendap.org/ns/DAP/3.3/att#"
         dap_version="3.3"
         xmlns:xml="http://www.w3.org/XML/1998/namespace"
         xml:base="http://localhost:8080/opendap/coverage/200803061600_HFRadar_USEGC_6km_rtv_SIO.nc.ddx">


    <att:Xml name="wcsStuff">
        <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"
                >
            <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>

    </att:Xml>

    <att:Container name="NC_GLOBAL" >
        <att:String name="title" >
            <att:value>Near-Real Time Surface Ocean Velocity</att:value>
        </att:String>
        <att:String name="institution">
            <att:value>Scripps Institution of Oceanography</att:value>
        </att:String>
        <att:String name="source">
            <att:value>Surface Ocean HF-Radar</att:value>
        </att:String>
        <att:String name="history" >
            <att:value>12-Mar-2008 22:26:19: NetCDF file created</att:value>
        </att:String>
        <att:String name="references">
            <att: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.
            </att:value>
        </att:String>
    </att:Container>

    <Grid name="u">
        <att:Xml name="wcsStuff" type="xml">
            <Field 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"
                >
                <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>
        </att:Xml>
        <att:String name="standard_name" >
            <value>surface_eastward_sea_water_velocity</value>
        </att:String>
        <att:String name="units" >
            <value>m s-1</value>
        </att:String>
        <att:Int16 name="_FillValue" >
            <value>-32768</value>
        </att:Int16>
        <att:Float32 name="scale_factor" >
            <value>0.009999999776</value>
        </att:Float32>
        <att:String name="ancillary_variables">
            <value>DOPx</value>
        </att:String>
        <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>

</Dataset>